Bug in applying umask

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.
Post Reply
RichieB
Newbie
Newbie
Posts: 14
Joined: May 9th, 2008, 10:21 am

Bug in applying umask

Post 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
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Bug in applying umask

Post 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.
Post Reply