Item709: Foswiki in virtual hosting with SuexecUserGroup creates directories with wrong permissions
Priority: Normal
Current State: Closed
Released In: 1.0.10, 1.1.0
Target Release: patch
Applies To: Engine
Component: Store
Branches:
RcsFile.pm uses File::Path::mkpath to create the pub path for topic attachments.
Perl honors umask when creating files: From perldoc -f umask
"permission (or "mode") values you pass mkdir or sysopen are modified by your umask, so even if you tell sysopen to create a file with permissions 0777, if your umask is 0022 then the file will actually be created with permissions 0755"
Apache Suexec enforces a umask of 077 which causes the directories to be created without the "x" bit. Later, Apache is unable traverse the directories and is unable to read attachments until the directory is changed to 755.
RcsFile.pm should issue an explicit chmod on new directories to set the permissions per $Foswiki::cfg{RCS}{dirPermission}
It appears that on Linux, it is sufficient to issue a umask calculated as oct(777)-$Foswiki::cfg{RCS}{dirPermission} Adding
umask(oct(777)-$Foswiki::cfg{RCS}{dirPermission});
to Handler.pm just prior to the call to make the directory path resolves the issue.
Checking in for additional testing.