[scribus] collecting for output
cbradney at scribus.info
Tue Dec 10 21:10:35 UTC 2013
On 10/12/2013 9:48 pm, Craig Bradney wrote:
> On 10/12/2013 9:35 pm, Mark Heieis wrote:
>> I just repeated a simple test.
>> 1) set my umask to 0002
>> 2) created a 1 page doc
>> 3) added single, existing jpg image from ~/sub-directory that had 664
>> 4) saved document to home (~) directory.
>> resultant sla got 664, as expected.
>> 5) collected4 output to home (~) and shared subdirectories, both had 775 plus g+s for shared one.
>> The result in both cases the collected document had 664 (as expected), the "images" directory
>> created by Scribus had 775 (as expected) but the image file had 600 (not as expected)! At least for
>> the home dir, all file permissions should be set to according to umask.
>> *** So something is not respecting the umask conditions. So I don't see this as a conflict in
>> choosing which file permission settings to use for security purposes, especially when saving within
>> user home context.
>> I'm wondering whether it is something that happens (overriding?) or not happening (being set?)
>> within QFileInfo as I can't see any explicit setting of the umask/permissions in the src (could have
>> missed it though).
>> BTW - tested with 1.5.0svn
> util_file.cpp has copyFileAtomic() which uses QTemporaryFile to copy the file into, then rename it.
> There's no permissions being set or removed on purpose, which may be they should be (at least imo to
> be the same as the original source file). The reason the sla is different is that its just being
> resaved into the new location.
Apply this patch and re-test..
--- scribus/collect4output.cpp (revision 18628)
+++ scribus/collect4output.cpp (working copy)
@@ -23,6 +23,7 @@
@@ -465,7 +466,20 @@
- copyFileAtomic(oldFile, m_outputDirectory + "images/" + newFile);
+ QString outFile(m_outputDirectory + "images/" + newFile);
+ bool success=copyFileAtomic(oldFile, outFile);
+ if (!success)
+ qDebug()<<"CollectForOutput::collectFile copyFileAtomic failed for"<<oldFile<<"to"<<outFile;
+ QFileDevice::Permissions p=QFile::permissions(oldFile);
+ QFile of(outFile);
+ bool permsSet=of.setPermissions(p);
+ if (!permsSet)
+ qDebug()<<"Unable to set permissions successfully on"<<outFile;
+ qDebug()<<"Able to set permissions successfully on"<<outFile;
collectedFiles[newFile] = oldFile;
return m_outputDirectory + "images/" + newFile;
More information about the scribus