Bug #14153
closed
t3lib_extfilefunc::func_copy() does not set file permissions properly
Added by Steffen Müller over 20 years ago.
Updated over 18 years ago.
Description
If a file is being copied with the filelist modules, the permissions of the new one is 755 - no matter what perms the source file had.
This is somehow the "normal" behavior of PHPFileFunctions and exec('cp'), but I think this should be fixed.
A patch to fix this is attached as diff -urN
Can anyone verify if this does not produce errors on Win?
--
cheers,
Steffen
System:
Debian GNU/Linux (Woody 3.0)
Apache 1.3.26
PHP 4.1.2 (safe mode = off)
(issue imported from #M75)
Files
Sorry for submitting the wrong diff.
Corrected version is attached: corrected_patch_func_copy.diff (571 bytes) 11.05.04 20:58
I think it's argueabel whether or not this is a bug or a feature.
I suggest starting a discussion in the dev mailing list about this issues.
I also suggest to discuss this. My reason for closing this bugrepot (for now) is that cp and other copy functions usually have the default behaviour like we have now.
However, it would maybe make sense to make this configurable. If there is a need for it.
I reopen this bug, because otherwise I don't have a chance to comment Roberts note.
A note on discussion this bug in typo3.dev: I already started one on May,15th. There was very little feedback and as I interpret it, there has been a 2:0 opinion for fixing this bug. See: http://typo3.org/documentation/mailing-lists/dev-list-archive/thread/47850/
A note on default permission behaviour: I cannot follow Roberts argumentation. Is there a reason, why the default behaviour is be the right way in our case? I argue it is not.
Last, I don't see a reason to make this configurable. If there is one, please enlighten me.
Sorry, I didn't see the discussion.
Ingmar, could you implement that as you have access to Windows and we don't? It seems like with windows the octal values passed to chmod don't work, so you probably have to only call chmod if it's non windows.
Thanks!
robert
I just tested this on Win2k with PHP 5.0.5 and it breaks silently. Since neither fileperms nor chmod works reliably on Windows (since NTFS acls are completely ignored), adding this patch would not hurt.
Steffen, while I see this is nice we could still argue if it is better to mimic UNIX standards (which does not copy perms) or provide a better solution at the risk of pissing UNIX admins off.
Stucki, Ingmar, Robert - any final preferences, or should we leave this to Kasper? If not, I will try to commit this.
I think TYPO3 has it's very own way of dealing with files: All files which are generated have these file permissions:
- the files belong to the user of the webserver
- the group owner is set to the group of the webserver or (if set) the value of $TYPO3_CONF_VARS[BE][createGroup]
- the permissions of files are set according to $TYPO3_CONF_VARS['BE']['fileCreateMask']
- the permissions of directories are set according to $TYPO3_CONF_VARS['BE']['folderCreateMask']
I vote for doing everything this way, therfore call the function t3lib_div::fixPermissions($path) after the file is copied. I think you could use this for both cases of the if() statement$this->PHPFileFunctions.
- michael
Hi Michael, will you still look at this or should I make that change?
I'm unsure whether clearstatcache() should be called before or after my new line?
Just a note from #typo3-dev chat.
I did a little reading on clearstatcache just now and to me it seems like it should be after your fixPermissions line. That way the file's information is cleared for future use. Does this sound logical?
Also available in: Atom
PDF