SiT! Bugs - SiT!
View Issue Details
0000655SiT!setup/configpublic2009-04-20 15:072009-08-16 14:39
pasamio 
ivan 
normalblockalways
closedfixed 
3.45 
3.503.50 
0000655: Wrong permissions on attachments directory (previously 605)
This was previously:
http://bugs.sitracker.org/view.php?id=605 [^]

The information there remains relevant the conclusion is invalid. PHP with the appropriate permissions in the web server is more than capable of changing the permissions. The issue in this case is the mode string used to create the file is invalid.

In the setup.php file there is the following code:
    case 'createattdir':
        // Note this creates a directory with 777 permissions!
        $dir = @mkdir($CONFIG['attachment_fspath'], '0777');

This doesn't actually do what it says because of the quotes around it. If you look at the doc page from php.net (http://au2.php.net/mkdir [^]) you can see that it wants to be given a number. I can't remember the exact reason but I think it converts it to a number which drops the preceding zero and then uses this which isn't what you want.

Making it a straight integral value will fix the problem, e.g.:
$dir = @mkdir($CONFIG['attachment_fspath'], 0777);

For me this caused weird issues when installing in addition to the schema problems and the fact I didn't get a user created out of all of this (fun). What I don't get is why this installer creates a new attachments directory instead of using the existing one that is already writeable to it but thats another issue.
No tags attached.
related to 0000605closed  Wrong permissions on attachments directory 
Issue History
2009-04-20 15:07pasamioNew Issue
2009-04-21 11:30ivanNote Added: 0000951
2009-04-21 11:30ivanStatusnew => acknowledged
2009-04-21 11:31ivanRelationship addedrelated to 0000605
2009-07-20 22:02ivanNote Added: 0001357
2009-07-20 22:02ivanAssigned To => ivan
2009-07-20 22:02ivanStatusacknowledged => resolved
2009-07-20 22:02ivanResolutionopen => fixed
2009-07-20 22:02ivanFixed in Version => Current SVN
2009-07-20 22:02ivanTarget Version => 3.50
2009-07-21 10:38ivanNote Added: 0001359
2009-08-16 13:16ivanFixed in VersionCurrent SVN => 3.50
2009-08-16 14:39ivanNote Added: 0001644
2009-08-16 14:39ivanStatusresolved => closed

Notes
(0000951)
ivan   
2009-04-21 11:30   
Thanks for the report and for your helpful comments. I had no idea about that peculiarity with the conversion from a string... I need to have a look at this again obviously.

When I get chance I'll set this up and do some testing.
(0001357)
ivan   
2009-07-20 22:02   
This was fixed somewhere in the 3.50 dev cycle, not sure which commit without looking. Thanks again for the report.
(0001359)
ivan   
2009-07-21 10:38   
Sorry, I missed your question about why the attachment folder is recreated instead of using an existing folder.

It's simply that setup.php isn't clever enough to find an the existing folder if it's not already mentioned in the config file.
(0001644)
ivan   
2009-08-16 14:39   
Released in 3.50rc1