All over core used octal numbers to identify file permissions

CommentFileSizeAuthor
0-octal-perms-d7.patch856 bytesandypost

Comments

eustace’s picture

Patch 0-octal-perms-d7.patch applied with no errors.

  • Confirmed file permission masks changed from decimal numbers to octets.
  • Confirmed change is consistent with rest of coding style.
  • Use of octets over decimals for file permission masks is generally recommended for security. This probably prompted the included change from using arithmetic to bit masking operators i.e. from "+=" to "|=". The later is probably safer as it precludes possibility for overflow.

Change does not appear to break anything navigating around site. However, I wish there were a directed functional test for assurance.

andypost’s picture

@eustace, Is there any ideas about case for test?

eustace’s picture

A directed test would be to use this function repeatedly to create files with different permissions settings and verify the files were created with proper permissions. This would be appropriate as part of the automated test suite (probably an overkill too in this case).

An indirect way would be to recommend a set of operations that engages use of this function so that the person testing can go through to confirm. e.g. the operation may result in file creation on the local machine and the instructions would be to manually check the permissions to this file.

I'm too new to the drupal dev env. to intelligently discuss the mechanics of how either recommendations above could be accomplished. I also realize this function may not be used often after drupal installation making it even more obscure to access with a user test. However, the changes are straight forward enough that visual inspection alone may suffice.

andypost’s picture

Actually there's no need in tests because they are already provided in modules/simpletest/tests/file.test
and would be extended into windows platform in upcoming patch #443286: Windows File Handling: International characters break file handling, permissions don't translate

So you could just changes status to reviewed & tested... if code sane and patch works for you!

eustace’s picture

Status: Needs review » Reviewed & tested by the community

Thank you for the guidance andypost. Patch works and code looks good so rtbc.

Good Patch!

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Dries committed this about 20 minutes ago at http://drupal.org/cvs?commit=397794

Status: Fixed » Closed (fixed)
Issue tags: -Quick fix

Automatically closed -- issue fixed for 2 weeks with no activity.