Page 1 of 1

Bug in applying umask

Posted: May 9th, 2008, 10:28 am
by RichieB
In sabnzbd 0.3.4 assembler.py has the following code:

Code: Select all

    # Remove X bits for files
    umask_file = umask & int('7666', 8)

    # Make sure that user R is on
    umask_file = umask | int('0400', 8)
This sets the umask_file twice. The correct code should be:

Code: Select all

    # Remove X bits for files
    umask_file = umask & int('7666', 8)

    # Make sure that user R is on
    umask_file = umask_file | int('0400', 8)
In 0.4.0 beta4 the faulty code is in postproc.py

Re: Bug in applying umask

Posted: May 9th, 2008, 1:17 pm
by shypike
You are so right!
The solution can be improved even further:

Code: Select all

    try:
        # Make sure that user R is on
        umask = int(umask, 8) | int('0400', 8)
    except:
        return

    # Remove X bits for files
    umask_file = umask & int('7666', 8)
That way the user R bit will be forced for folders too.

Thanks for pointing this out.
I'll fix it too in the 0.3.x branch, but I don't think there will be a 0.3.5 release.