unrar 5 and metadata password

Report & discuss bugs found in SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
cytec
Newbie
Newbie
Posts: 17
Joined: April 9th, 2013, 9:55 am

unrar 5 and metadata password

Post by cytec »

Hi,

me and moneytoo from synocomunnity looked a little deeper at the "unrar" problem that occure on some synology installations.
It seems like SAB doesn't play verry nicely with unrar 5.

Sometimes password protected rar files will get unrared, sometimes not.
it seems like SAB Reads the password from the nzb file but than forgets about reading it and trys to unrar without a password:

Code: Select all

2013-11-05 12:31:05,709::DEBUG::[nzbstuff:473] META-DATA = {u'password': [u'UR-rNSKT#U!K7tV2=R0KCrx']}
2013-11-05 12:31:05,710::INFO::[__init__:569] Backing up /volume1/downloads/nzbbackup/test.nzb.gz
2013-11-05 12:31:58,515::DEBUG::[newsunpack:568] Running unrar ['/usr/local/sabnzbd/bin/unrar', 'x', '-idp', '-o-', '-or', '-p-', '/volume1/downloads/incomplete/test/test.part1.rar', '/volume1/downloads/complete/_UNPACK_test/']
2013-11-05 12:31:58,673::INFO::[newsunpack:714] Skipping unrar file check due to unreliable file names or old unrar
2013-11-05 12:31:58,674::INFO::[newsunpack:719] 0 Datei(en)/Ordner entpackt in 0 Sekunden
if the password is in the meta field AND the filename:

Code: Select all

2013-11-05 12:34:53,921::DEBUG::[nzbstuff:473] META-DATA = {u'password': [u'UR-rNSKT#U!K7tV2=R0KCrx']}
2013-11-05 12:34:53,922::INFO::[__init__:569]  Backing up /volume1/downloads/nzbbackup/test {{UR-rNSKT#U!K7tV2=R0KCrx}}.nzb.gz
2013-11-05 12:35:46,927::DEBUG::[newsunpack:503] Trying unrar with password "UR-rNSKT#U!K7tV2=R0KCrx"
2013-11-05 12:35:46,927::DEBUG::[newsunpack:523] rar_extract(): Extractionpath: /volume1/downloads/complete/_UNPACK_test
2013-11-05 12:35:46,928::DEBUG::[rarfile:324] CRC mismatch! ofs =20
2013-11-05 12:35:46,929::DEBUG::[newsunpack:568] Running unrar ['/usr/local/sabnzbd/bin/unrar', 'x', '-idp', '-o-', '-or', '-pUR-rNSKT#U!K7tV2=R0KCrx', '/volume1/downloads/incomplete/test/test.part1.rar', '/volume1/downloads/complete/_UNPACK_test/']
2013-11-05 12:38:08,770::INFO::[newsunpack:714] Skipping unrar file check due to unreliable file names or old unrar
2013-11-05 12:38:08,771::INFO::[newsunpack:719] 2 Datei(en)/Ordner entpackt in 2 minutes 21 Sekunden
the mentioned issue can be found here: https://github.com/SynoCommunity/spksrc/issues/693
if you need the nzb file for a deeper look, i can provide that too
User avatar
sander
Release Testers
Release Testers
Posts: 8830
Joined: January 22nd, 2008, 2:22 pm

Re: unrar 5 and metadata password

Post by sander »

Can you provide me the NZB and the password? You can PM if you want.

I will test it on Ubuntu, both with unrar 4.20 and 5
cytec
Newbie
Newbie
Posts: 17
Joined: April 9th, 2013, 9:55 am

Re: unrar 5 and metadata password

Post by cytec »

PM send
User avatar
sander
Release Testers
Release Testers
Posts: 8830
Joined: January 22nd, 2008, 2:22 pm

Re: unrar 5 and metadata password

Post by sander »

OK, renamed the NZBs to:

testing123-nopw.nzb
testing456-pw {{UR-rNSKT#U!K7tV2=R0KCrx}}.nzb

Platform: SAB 0.8, unrar5, Ubuntu

Results:
testing123-nopw.nzb results in a directory with 8 seperate .rar files
testing456-pw {{UR-rNSKT#U!K7tV2=R0KCrx}}.nzb results in one .avi file

Both results seem correct to me.

What do you get?
moneytoo
Newbie
Newbie
Posts: 4
Joined: August 3rd, 2013, 5:24 am

Re: unrar 5 and metadata password

Post by moneytoo »

It's the same issue as reported here: http://forums.sabnzbd.org/viewtopic.php?f=3&t=15275

File testing123-nopw.nzb should be extracted because the correct password is in the nzb file in meta tag. It's also read correctly but it's not passed to the command before executing rar.
cytec
Newbie
Newbie
Posts: 17
Joined: April 9th, 2013, 9:55 am

Re: unrar 5 and metadata password

Post by cytec »

like moneytoo said, the password is set inside the nzb headers password meta tag. so it /should/ unrar it anyway even if you don't append the password to the filename.

When i use unrar 3.8 BOTH nzbs get "unrared" and i end up with a single avi file.
User avatar
sander
Release Testers
Release Testers
Posts: 8830
Joined: January 22nd, 2008, 2:22 pm

Re: unrar 5 and metadata password

Post by sander »

Ah, confirmed:

SAB 0.7.16, unrar 4.00, on Ubuntu:

Both testing123-nopw.nzb and testing456-pw {{UR-rNSKT#U!K7tV2=R0KCrx}}.nzb fully unpack and result in the .avi file.

I can't yet see any difference let alone cause. I'll see if I can do further testing.
User avatar
sander
Release Testers
Release Testers
Posts: 8830
Joined: January 22nd, 2008, 2:22 pm

Re: unrar 5 and metadata password

Post by sander »

Back on the unrar5 (and SAB 0.8.x) system:

Code: Select all

sander@flappie:~/.sabnzbd/logs$ grep "ing unrar" sabnzbd.log
2013-11-06 20:35:26,209::DEBUG::[newsunpack:520] Trying unrar with password "UR-rNSKT#U!K7tV2=R0KCrx"
2013-11-06 20:35:26,210::DEBUG::[newsunpack:585] Running unrar ['/usr/bin/unrar', 'x', '-idp', '-o-', '-or', '-pUR-rNSKT#U!K7tV2=R0KCrx', '/home/sander/Downloads/incomplete/testing456-pw/oLKQfrcNVivzdzSG22a2xo7t001.part1.rar', '/home/sander/Downloads/complete/_UNPACK_testing456-pw/']

2013-11-06 20:35:56,459::DEBUG::[newsunpack:585] Running unrar ['/usr/bin/unrar', 'x', '-idp', '-o-', '-or', '-p-', '/home/sander/Downloads/incomplete/testing123-nopw/oLKQfrcNVivzdzSG22a2xo7t001.part1.rar', '/home/sander/Downloads/complete/_UNPACK_testing123-nopw/']
So, indeed there is no password value filled in the unrar -p parameter for the case of testing123 ... Interesting

And there is no "Trying unrar with password" for testing123. So SAB is even not trying.

More logging info:

First: testing456-pw with password in the file name (which works):

Code: Select all

sander@flappie:~/.sabnzbd/logs$ grep -A999999 "2013-11-06 20:5" sabnzbd.log | grep -i "running unrar" -B14 -A9
2013-11-06 20:53:05,428::INFO::[postproc:601] Par2 check finished on testing456-pw
2013-11-06 20:53:05,429::INFO::[misc:785] Creating directories: /home/sander/Downloads/complete/testing456-pw
2013-11-06 20:53:05,429::INFO::[postproc:343] Running unpack_magic on testing456-pw

2013-11-06 20:53:05,430::DEBUG::[newsunpack:1578] build_filelists(): joinables: []
2013-11-06 20:53:05,430::DEBUG::[newsunpack:1579] build_filelists(): zips: []
2013-11-06 20:53:05,430::DEBUG::[newsunpack:1580] build_filelists(): rars: [u'/home/sander/Downloads/incomplete/testing456-pw/oLKQfrcNVivzdzSG22a2xo7t001.part3.rar', u'/home/sander/Downloads/incomplete/testing456-pw/oLKQfrcNVivzdzSG22a2xo7t001.part1.rar', u'/home/sander/Downloads/incomplete/testing456-pw/oLKQfrcNVivzdzSG22a2xo7t001.part2.rar', u'/home/sander/Downloads/incomplete/testing456-pw/oLKQfrcNVivzdzSG22a2xo7t001.part5.rar', u'/home/sander/Downloads/incomplete/testing456-pw/oLKQfrcNVivzdzSG22a2xo7t001.part6.rar', u'/home/sander/Downloads/incomplete/testing456-pw/oLKQfrcNVivzdzSG22a2xo7t001.part4.rar', u'/home/sander/Downloads/incomplete/testing456-pw/oLKQfrcNVivzdzSG22a2xo7t001.part7.rar', u'/home/sander/Downloads/incomplete/testing456-pw/oLKQfrcNVivzdzSG22a2xo7t001.part8.rar']
2013-11-06 20:53:05,430::DEBUG::[newsunpack:1581] build_filelists(): 7zips: []
2013-11-06 20:53:05,431::DEBUG::[newsunpack:1582] build_filelists(): ts: []
2013-11-06 20:53:05,431::INFO::[newsunpack:215] Unrar starting on /home/sander/Downloads/incomplete/testing456-pw
2013-11-06 20:53:05,431::DEBUG::[newsunpack:427] Rar_sets: {u'oLKQfrcNVivzdzSG22a2xo7t001': [u'/home/sander/Downloads/incomplete/testing456-pw/oLKQfrcNVivzdzSG22a2xo7t001.part3.rar', u'/home/sander/Downloads/incomplete/testing456-pw/oLKQfrcNVivzdzSG22a2xo7t001.part1.rar', u'/home/sander/Downloads/incomplete/testing456-pw/oLKQfrcNVivzdzSG22a2xo7t001.part2.rar', u'/home/sander/Downloads/incomplete/testing456-pw/oLKQfrcNVivzdzSG22a2xo7t001.part5.rar', u'/home/sander/Downloads/incomplete/testing456-pw/oLKQfrcNVivzdzSG22a2xo7t001.part6.rar', u'/home/sander/Downloads/incomplete/testing456-pw/oLKQfrcNVivzdzSG22a2xo7t001.part4.rar', u'/home/sander/Downloads/incomplete/testing456-pw/oLKQfrcNVivzdzSG22a2xo7t001.part7.rar', u'/home/sander/Downloads/incomplete/testing456-pw/oLKQfrcNVivzdzSG22a2xo7t001.part8.rar']}
2013-11-06 20:53:05,431::INFO::[newsunpack:441] Extracting rarfile /home/sander/Downloads/incomplete/testing456-pw/oLKQfrcNVivzdzSG22a2xo7t001.part1.rar (belonging to oLKQfrcNVivzdzSG22a2xo7t001) to /home/sander/Downloads/complete/_UNPACK_testing456-pw
2013-11-06 20:53:05,431::DEBUG::[newsunpack:520] Trying unrar with password "UR-rNSKT#U!K7tV2=R0KCrx"
2013-11-06 20:53:05,432::DEBUG::[newsunpack:540] rar_extract(): Extractionpath: /home/sander/Downloads/complete/_UNPACK_testing456-pw
2013-11-06 20:53:05,432::DEBUG::[rarfile:322] CRC mismatch! ofs =20
2013-11-06 20:53:05,432::DEBUG::[newsunpack:585] Running unrar ['/usr/bin/unrar', 'x', '-idp', '-o-', '-or', '-pUR-rNSKT#U!K7tV2=R0KCrx', '/home/sander/Downloads/incomplete/testing456-pw/oLKQfrcNVivzdzSG22a2xo7t001.part1.rar', '/home/sander/Downloads/complete/_UNPACK_testing456-pw/']


2013-11-06 20:53:06,192::INFO::[downloader:674] Thread [email protected]: forcing disconnect
2013-11-06 20:53:06,193::INFO::[downloader:674] Thread [email protected]: forcing disconnect
2013-11-06 20:53:06,193::INFO::[downloader:674] Thread [email protected]: forcing disconnect
2013-11-06 20:53:06,193::INFO::[downloader:674] Thread [email protected]: forcing disconnect
2013-11-06 20:53:06,193::INFO::[downloader:674] Thread [email protected]: forcing disconnect
2013-11-06 20:53:06,294::INFO::[downloader:674] Thread [email protected]: forcing disconnect
2013-11-06 20:53:06,395::INFO::[downloader:674] Thread [email protected]: forcing disconnect
2013-11-06 20:53:06,496::INFO::[downloader:674] Thread [email protected]: forcing disconnect
2013-11-06 20:53:06,596::INFO::[downloader:674] Thread [email protected]: forcing disconnect
sander@flappie:~/.sabnzbd/logs$ 

Then: testing123 with password inside the NZB "<head><meta type="password">UR-rNSKT#U!K7tV2=R0KCrx</meta></head></nzb>"

Code: Select all

sander@flappie:~/.sabnzbd/logs$ grep -A999999 "2013-11-06 20:57" sabnzbd.log | grep -i "running unrar" -B14 -A10
2013-11-06 21:00:05,314::DEBUG::[__init__:806] Saving data for __verified__ in /home/sander/Downloads/incomplete/testing123-meta-tag-pw/__ADMIN__
2013-11-06 21:00:05,315::INFO::[postproc:601] Par2 check finished on testing123-meta-tag-pw
2013-11-06 21:00:05,315::INFO::[misc:785] Creating directories: /home/sander/Downloads/complete/testing123-meta-tag-pw
2013-11-06 21:00:05,317::INFO::[postproc:343] Running unpack_magic on testing123-meta-tag-pw

2013-11-06 21:00:05,319::DEBUG::[newsunpack:1578] build_filelists(): joinables: []
2013-11-06 21:00:05,319::DEBUG::[newsunpack:1579] build_filelists(): zips: []
2013-11-06 21:00:05,320::DEBUG::[newsunpack:1580] build_filelists(): rars: [u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part3.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part1.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part2.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part5.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part6.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part4.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part7.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part8.rar']
2013-11-06 21:00:05,320::DEBUG::[newsunpack:1581] build_filelists(): 7zips: []
2013-11-06 21:00:05,320::DEBUG::[newsunpack:1582] build_filelists(): ts: []
2013-11-06 21:00:05,320::INFO::[newsunpack:215] Unrar starting on /home/sander/Downloads/incomplete/testing123-meta-tag-pw
2013-11-06 21:00:05,321::DEBUG::[newsunpack:427] Rar_sets: {u'oLKQfrcNVivzdzSG22a2xo7t001': [u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part3.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part1.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part2.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part5.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part6.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part4.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part7.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part8.rar']}
2013-11-06 21:00:05,321::INFO::[newsunpack:441] Extracting rarfile /home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part1.rar (belonging to oLKQfrcNVivzdzSG22a2xo7t001) to /home/sander/Downloads/complete/_UNPACK_testing123-meta-tag-pw
2013-11-06 21:00:05,321::DEBUG::[newsunpack:540] rar_extract(): Extractionpath: /home/sander/Downloads/complete/_UNPACK_testing123-meta-tag-pw
2013-11-06 21:00:05,321::DEBUG::[rarfile:322] CRC mismatch! ofs =20
2013-11-06 21:00:05,322::DEBUG::[newsunpack:585] Running unrar ['/usr/bin/unrar', 'x', '-idp', '-o-', '-or', '-p-', '/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part1.rar', '/home/sander/Downloads/complete/_UNPACK_testing123-meta-tag-pw/']
2013-11-06 21:00:05,357::INFO::[newsunpack:724] Unpacked 0 files/folders in 0 seconds
2013-11-06 21:00:05,357::DEBUG::[newsunpack:458] rar_unpack(): Rars: []
2013-11-06 21:00:05,358::DEBUG::[newsunpack:459] rar_unpack(): Newfiles: []
2013-11-06 21:00:05,358::INFO::[newsunpack:219] Unrar finished on /home/sander/Downloads/incomplete/testing123-meta-tag-pw
2013-11-06 21:00:05,359::DEBUG::[newsunpack:1578] build_filelists(): joinables: []
2013-11-06 21:00:05,359::DEBUG::[newsunpack:1579] build_filelists(): zips: []
2013-11-06 21:00:05,359::DEBUG::[newsunpack:1580] build_filelists(): rars: [u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part3.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part1.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part2.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part5.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part6.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part4.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part7.rar', u'/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part8.rar']
2013-11-06 21:00:05,359::DEBUG::[newsunpack:1581] build_filelists(): 7zips: []
2013-11-06 21:00:05,360::DEBUG::[newsunpack:1582] build_filelists(): ts: []
2013-11-06 21:00:05,360::INFO::[postproc:345] unpack_magic finished on testing123-meta-tag-pw
sander@flappie:~/.sabnzbd/logs$
User avatar
sander
Release Testers
Release Testers
Posts: 8830
Joined: January 22nd, 2008, 2:22 pm

Re: unrar 5 and metadata password

Post by sander »

Logging from the unrar4 setup with the metadata nzb file:

Code: Select all

sander@veiling:~/.sabnzbd/logs$ grep "'-p" sabnzbd.log 
2013-11-06 15:51:34,412::DEBUG::[newsunpack:568] Running unrar ['/usr/bin/unrar', 'x', '-idp', '-o-', '-or', '-p-', '/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part1.rar', '/home/sander/Downloads/complete/_UNPACK_testing123-meta-tag-pw/']
2013-11-06 15:51:34,462::DEBUG::[newsunpack:568] Running unrar ['/usr/bin/unrar', 'x', '-idp', '-o-', '-or', u'-pUR-rNSKT#U!K7tV2=R0KCrx', '/home/sander/Downloads/incomplete/testing123-meta-tag-pw/oLKQfrcNVivzdzSG22a2xo7t001.part1.rar', '/home/sander/Downloads/complete/_UNPACK_testing123-meta-tag-pw/']
So it looks like SAB does a unrar run with '-p', and immediatly after that a run with '-UR-rNSKT#U!K7tV2=R0KCrx'. Maybe because the first run of unrar4 says "hey, I need a password"?

If so, the hypothesis could be that unrar5 does not say that, or in a different way? I'll try to run some manual commands ...
User avatar
sander
Release Testers
Release Testers
Posts: 8830
Joined: January 22nd, 2008, 2:22 pm

Re: unrar 5 and metadata password

Post by sander »

Yes, there is a difference:

Good old unrar 4:

Code: Select all

sander@flappie:~/Downloads/complete/unrar_test.1$ unrar4 x -idp -o- -or -p- *part1.rar

UNRAR 4.20 freeware      Copyright (c) 1993-2012 Alexander Roshal

CRC failed in the encrypted file oLKQfrcNVivzdzSG22a2xo7t001.part1.rar. Corrupt file or wrong password.

Extracting from oLKQfrcNVivzdzSG22a2xo7t001.part1.rar

No files to extract
sander@flappie:~/Downloads/complete/unrar_test.1$
New unrar 5:

Code: Select all

sander@flappie:~/Downloads/complete/unrar_test.1$ unrar5 x -idp -o- -or -p- *part1.rar

UNRAR 5.00 freeware      Copyright (c) 1993-2013 Alexander Roshal

Checksum error in the encrypted file oLKQfrcNVivzdzSG22a2xo7t001.part1.rar. Corrupt file or wrong password.
No files to extract
sander@flappie:~/Downloads/complete/unrar_test.1$ 
Source code:

Code: Select all

sander@flappie:~/git/sabnzbd$ grep -i "crc failed" * */* 
sabnzbd/newsunpack.py:        elif line.endswith('- CRC failed'):
sabnzbd/newsunpack.py:            msg = (u'[%s] '+T('ERROR: CRC failed in "%s"')) % (setname, filename)
sabnzbd/newsunpack.py:            logging.warning(T('ERROR: CRC failed in "%s"'), setname)
sabnzbd/newsunpack.py:        elif 'ncrypted file' in line and 'CRC failed' in line:
sabnzbd/newsunpack.py:                m = re.search(r'Encrypted file:  CRC failed in (.+) \(password', line)
sabnzbd/newsunpack.py~:        elif line.endswith('- CRC failed'):
sabnzbd/newsunpack.py~:            msg = (u'[%s] '+T('ERROR: CRC failed in "%s"')) % (setname, filename)
sabnzbd/newsunpack.py~:            logging.warning(T('ERROR: CRC failed in "%s"'), setname)
sabnzbd/newsunpack.py~:        elif 'ncrypted file' in line and 'CRC failed' in line:
sabnzbd/newsunpack.py~:                m = re.search(r'Encrypted file:  CRC failed in (.+) \(password', line)
No source code result for "grep -i "Checksum error " * */* "

We're getting closer...

Code: Select all

        elif 'ncrypted file' in line and 'CRC failed' in line:
            # unrar 4.x syntax
            m = re.search(r'encrypted file (.+)\. Corrupt file', line)
            if not m:
                # unrar 3.x syntax
                m = re.search(r'Encrypted file:  CRC failed in (.+) \(password', line)
            if m:
                filename = TRANS(m.group(1)).strip()
            else:
                filename = '???'
            nzo.fail_msg = T('Unpacking failed, archive requires a password')
            msg = (u'[%s][%s] '+ T('Unpacking failed, archive requires a password')) % (setname, filename)
            nzo.set_unpack_info('Unpack', unicoder(msg), set=setname)
            fail = 2
TBC
User avatar
sander
Release Testers
Release Testers
Posts: 8830
Joined: January 22nd, 2008, 2:22 pm

Re: unrar 5 and metadata password

Post by sander »

OK, solved!

In sabnzbd/newsunpack.py, change the code

Code: Select all

        elif 'ncrypted file' in line and 'CRC failed' in line:
            # unrar 4.x syntax
to

Code: Select all

        elif 'ncrypted file' in line and ( ('CRC failed' in line) or ('Checksum error' in line)):
            # unrar 3.x: "Encrypted file: CRC failed in oLKQfrcNVivzdzSG22a2xo7t001.part1.rar (password incorrect ?)"
            # unrar 4.x: "CRC failed in the encrypted file oLKQfrcNVivzdzSG22a2xo7t001.part1.rar. Corrupt file or wrong password."
            # unrar 5.x: "Checksum error in the encrypted file oLKQfrcNVivzdzSG22a2xo7t001.part1.rar. Corrupt file or wrong password."
(Ah, great: unrar changes the output with each major version change ::) )

Tested, and it works.

I'll inform ShyPike.
User avatar
sander
Release Testers
Release Testers
Posts: 8830
Joined: January 22nd, 2008, 2:22 pm

Re: unrar 5 and metadata password

Post by sander »

Message to SP:

Maybe only grepping for "encrypted file" (ignoring case) is enough; that line only occurs once in unrar3, unrar4 and unrar5. So no false match with other unrar output is possible

That would mean we could leave out "and ( ('CRC failed' in line) or ('Checksum error' in line))". It would make the source code easier.

Code: Select all

$ strings unrar3 | grep -i "Encrypted file"
Encrypted file:  CRC failed in %s (password incorrect ?)


$ strings /usr/bin/unrar4 | grep -i "Encrypted file"
CRC failed in the encrypted file %s. Corrupt file or wrong password.


$ strings /usr/bin/unrar5 | grep -i "Encrypted file"
Checksum error in the encrypted file %s. Corrupt file or wrong password.

EDIT:

I changed the code to the snippet below, did three downloads, and it works. So ...

Code: Select all

        elif 'ncrypted file' in line: 
            # unrar 3.x: "Encrypted file: CRC failed in oLKQfrcNVivzdzSG22a2xo7t001.part1.rar (password incorrect ?)"
            # unrar 4.x: "CRC failed in the encrypted file oLKQfrcNVivzdzSG22a2xo7t001.part1.rar. Corrupt file or wrong password."
            # unrar 5.x: "Checksum error in the encrypted file oLKQfrcNVivzdzSG22a2xo7t001.part1.rar. Corrupt file or wrong password."
EDIT

PS: maybe the chance of a collision with 'ncrypted file' in some file name (not unrar's output) could get too high ... ? Or is there no file name output in what SAB is reading back from unrar's output?
cytec
Newbie
Newbie
Posts: 17
Joined: April 9th, 2013, 9:55 am

Re: unrar 5 and metadata password

Post by cytec »

that seems like a possible solution for me :)
thanks
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: unrar 5 and metadata password

Post by shypike »

Fixed in 0.7.17.
Thank you Sander!
mad1993max
Newbie
Newbie
Posts: 2
Joined: December 21st, 2013, 8:33 am

Re: unrar 5 and metadata password

Post by mad1993max »

ok if still have the problem, that most of the times sabnzbd doesn't unpack the rar files
i have unrar 5 and the latest sabnzbd (fix is active i have checked)

sabnzb seams to always put a space infront of every pw and than unrar says wrong pw, any sugestions the log doesnt help much

lg max
Post Reply