[scribus] collecting for output

Mark Heieis mheieis at alois.ca
Wed Dec 11 03:18:59 UTC 2013


Hi Craig,

I dug a little deeper and this is what I found: If the destination 
file(s) already exist, then setPermissions() will succeed. It appears, 
however, if they don't exist, setPermissions() will fail.

In the patch, it doesn't look like the output files have actually been 
physically created when setPermissions() is called, only the file 
descriptors have.

mrh.


On 2013-12-10 15:05, Craig Bradney wrote:
> Worked for me but it could depend all all kinds of local settings etc. ownership, specific permissions, sgid etc.
>
> Craig
>
>
>
>> On 10 Dec 2013, at 23:55, Mark Heieis <mheieis at alois.ca> wrote:
>>
>> Interesting.
>>
>> "p" gets the correct permissions for "oldFile" but "permsSet" fails on "newFile".
>>
>> My dev version of Scribus sits outside of my user context, in a developer group but I do have them all set set to my UID:GID
>>
>>
>>> On 2013-12-10 13:10, Craig Bradney wrote:
>>>> 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
>>>
>>>
>>> ___
>>> Scribus Mailing List: scribus at lists.scribus.net
>>> Edit your options or unsubscribe:
>>> http://lists.scribus.net/mailman/listinfo/scribus
>>> See also:
>>> http://wiki.scribus.net
>>> http://forums.scribus.net
>>
>> ___
>> Scribus Mailing List: scribus at lists.scribus.net
>> Edit your options or unsubscribe:
>> http://lists.scribus.net/mailman/listinfo/scribus
>> See also:
>> http://wiki.scribus.net
>> http://forums.scribus.net
> ___
> Scribus Mailing List: scribus at lists.scribus.net
> Edit your options or unsubscribe:
> http://lists.scribus.net/mailman/listinfo/scribus
> See also:
> http://wiki.scribus.net
> http://forums.scribus.net




More information about the scribus mailing list