[scribus] collecting for output
Craig Bradney
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:
>> Hi
>>
>> 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
>>
>> mrh.
>>
>
> 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.
>
> Craig
>
Apply this patch and re-test..
Index: scribus/collect4output.cpp
===================================================================
--- scribus/collect4output.cpp (revision 18628)
+++ scribus/collect4output.cpp (working copy)
@@ -23,6 +23,7 @@
#include "scpattern.h"
#include "util_file.h"
+#include <QDebug>
#include <QDir>
#include <QMap>
#include <QMessageBox>
@@ -465,7 +466,20 @@
}
if (copy)
{
- 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;
+ else
+ {
+ QFileDevice::Permissions p=QFile::permissions(oldFile);
+ QFile of(outFile);
+ bool permsSet=of.setPermissions(p);
+ if (!permsSet)
+ qDebug()<<"Unable to set permissions successfully on"<<outFile;
+ else
+ qDebug()<<"Able to set permissions successfully on"<<outFile;
+ }
}
collectedFiles[newFile] = oldFile;
return m_outputDirectory + "images/" + newFile;
thanks
Craig
More information about the scribus
mailing list