Bug 83529

Summary: LibreOffice tries to make user's config file with wrong permission.
Product: LibreOffice Reporter: taro yamada <archer_ame>
Component: LibreofficeAssignee: Stephan Bergmann <sbergman>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: sbergman, serval2412
Version: unspecified   
Hardware: All   
OS: Linux (All)   
Whiteboard: target:4.4.0
i915 platform: i915 features:

Description taro yamada 2014-09-05 13:27:56 UTC
-----Details-----
When I am menber of the group "root", LibreOffice generates some config file with root group's ownership on initial startup.

$ find /home/myuser/.config/libreoffice/ -group root
/home/username/.config/libreoffice/4/user/config/standard.soe
/home/username/.config/libreoffice/4/user/config/standard.soc
/home/username/.config/libreoffice/4/user/config/modern.sog
/home/username/.config/libreoffice/4/user/config/standard.sod
/home/username/.config/libreoffice/4/user/config/gallery.soc
/home/username/.config/libreoffice/4/user/config/classic.sog
/home/username/.config/libreoffice/4/user/config/html.soc
/home/username/.config/libreoffice/4/user/config/styles.sod
/home/username/.config/libreoffice/4/user/config/palette.soc
/home/username/.config/libreoffice/4/user/config/tango.soc
/home/username/.config/libreoffice/4/user/config/autotbl.fmt
/home/username/.config/libreoffice/4/user/config/hatching.soh
/home/username/.config/libreoffice/4/user/config/arrowhd.soe
/home/username/.config/libreoffice/4/user/config/cmyk.soc
/home/username/.config/libreoffice/4/user/config/standard.soh
/home/username/.config/libreoffice/4/user/config/web.soc
/home/username/.config/libreoffice/4/user/config/scribus.soc
/home/username/.config/libreoffice/4/user/config/standard.sog
/home/username/.config/libreoffice/4/user/config/standard.sob
/home/username/.config/libreoffice/4/user/config/libreoffice.soc
/home/username/.config/libreoffice/4/user/autotext/mytexts.bau
/home/username/.config/libreoffice/4/user/basic/script.xlc
/home/username/.config/libreoffice/4/user/basic/dialog.xlc
/home/username/.config/libreoffice/4/user/basic/Standard/script.xlb
/home/username/.config/libreoffice/4/user/basic/Standard/dialog.xlb
/home/username/.config/libreoffice/4/user/basic/Standard/Module1.xba
/home/username/.config/libreoffice/4/user/database/biblio.odb
/home/username/.config/libreoffice/4/user/database/evolocal.odb
/home/username/.config/libreoffice/4/user/database/biblio/biblio.dbf
/home/username/.config/libreoffice/4/user/database/biblio/biblio.dbt
/home/username/.config/libreoffice/4/user/gallery/sg30.sdv
/home/username/.config/libreoffice/4/user/gallery/sg30.thm

The function "oslChangeFileModes" in sal/osl/unx/file_misc.cxx changes only uid.
//---------
if ( nUID != getuid() )
    {
        nUID=getuid();
    }
//---------

And I suppose it should change gid too.
//---------
if ( nUID != getuid() )
    {
        nUID=getuid();
    }
if ( nGID != getgid() )
    {
        nGID=getgid();
    }
//---------

-----Steps to reproduce-----
1. Add user to group "root".
2. Remove ~/.config/libreoffice/
3. Start any LibreOffice application.

-----Expected result-----
All files in ~/.config/libreoffice/ should be owned by "myuser:myusergroup".

-----Actual result-----
Some files  are owned by "myuser:root".


I'm sorry if my English is hard to understand. 
Please ask if you would like me to explain something again.
Comment 1 Julien Nabet 2014-09-05 13:55:58 UTC
Thank you for this detailed report!

Stephan: I don't know this part but rem's comment about the quick fix proposed sounds right, any thoughts?
Comment 2 Commit Notification 2014-11-20 09:54:04 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f12e8ff594f177f22ffb3d1849bf768ab08023bf

fdo#83529: Only preserve metadata of moved, not copied files

It will be available in 4.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.