MantisBT - CMake
View Issue Details
0010325CMakeCPackpublic2010-02-23 09:392015-08-25 09:46
Arthur Gautier 
Eric NOULARD 
normaltweakalways
closedfixed 
CMake-2-8 
CMake 2.8.6CMake 2.8.6 
0010325: DEB packaging Set files ownership
Hi there,
it's not possible for now to set uid nor gid for files added to a debian package.

If i build a package as a normal user, all files added to the .deb get my uid and gid by default. This could be solved by changing the ownership of files when compressing data.tgz file.

Like this in the Source/CPack/cmCPackDebGenerator.cxx file (approx line 133) :
cmd += "\" -E tar --group=root --owner=root cfz data.tar.gz ";

This should be for example possible to set ownership with a var like CPACK_DEBIAN_PACKAGE_OWNER and CPACK_DEBIAN_PACKAGE_GROUP.



This should do the job :)

on a second time it may be possible to add per-file ownership in adding a option to the install function.
We then could "append" other files with their own permission to the tar with :
tar --owner=other-user --group=other-group -azf data.tar.gz the file


Thanks :)

No tags attached.
parent of 0013118closed Eric NOULARD CPack DEB generator does not use fakeroot for control.tar.gz 
related to 0012901closed Kitware Robot CPack should be able to set owner of files in the archive 
related to 0012531closed Kitware Robot Lintain failures due to permission issues with pre/post install/remove scripts. 
related to 0013700closed Raffi Enficiaud CPack fails from fakeroot 
patch 0001-CPackDeb-fix-10325-automagically-use-fakeroot-for-DE.patch (1,588) 2011-09-05 16:46
https://public.kitware.com/Bug/file/4044/0001-CPackDeb-fix-10325-automagically-use-fakeroot-for-DE.patch
Issue History
2010-02-23 09:39Arthur GautierNew Issue
2010-12-15 16:37Eric NOULARDNote Added: 0024193
2010-12-15 16:37Eric NOULARDAssigned To => Eric NOULARD
2010-12-15 16:37Eric NOULARDStatusnew => assigned
2010-12-15 16:38Eric NOULARDNote Added: 0024194
2010-12-15 16:38Eric NOULARDStatusassigned => feedback
2011-01-18 11:27David ColeNote Added: 0024868
2011-01-18 17:31Eric NOULARDNote Added: 0024900
2011-07-24 08:51Daniel FrankeNote Added: 0027062
2011-09-05 06:55Kishore JonnalagaddaNote Added: 0027327
2011-09-05 16:30Eric NOULARDNote Added: 0027361
2011-09-05 16:46Eric NOULARDFile Added: 0001-CPackDeb-fix-10325-automagically-use-fakeroot-for-DE.patch
2011-09-05 16:48Eric NOULARDNote Added: 0027362
2011-09-05 23:26Kishore JonnalagaddaNote Added: 0027364
2011-09-05 23:56Kishore JonnalagaddaNote Added: 0027365
2011-09-20 14:26Eric NOULARDNote Added: 0027461
2011-09-20 14:26Eric NOULARDStatusfeedback => resolved
2011-09-20 14:26Eric NOULARDFixed in Version => CMake 2.8.6
2011-09-20 14:26Eric NOULARDResolutionopen => fixed
2011-09-20 14:27Eric NOULARDNote Added: 0027462
2011-09-20 14:27Eric NOULARDStatusresolved => feedback
2011-09-20 14:27Eric NOULARDResolutionfixed => reopened
2011-09-20 14:27Eric NOULARDTarget Version => CMake 2.8.6
2011-09-20 14:27Eric NOULARDNote Added: 0027463
2011-09-20 14:27Eric NOULARDStatusfeedback => resolved
2011-09-20 14:27Eric NOULARDResolutionreopened => fixed
2012-01-20 08:27Eric NOULARDRelationship addedrelated to 0012901
2012-04-16 15:47Eric NOULARDRelationship addedrelated to 0013118
2012-04-17 03:03Eric NOULARDRelationship replacedparent of 0013118
2012-08-12 03:08Eric NOULARDRelationship addedrelated to 0012531
2012-11-18 07:44Eric NOULARDRelationship addedrelated to 0013700
2013-04-17 08:54Robert MaynardNote Added: 0032868
2013-04-17 08:54Robert MaynardStatusresolved => closed

Notes
(0024193)
Eric NOULARD   
2010-12-15 16:37   
Hi Arthur,

Would you be able to propose a patch against 2.8.3 (or master) for that?

Concerning the root/root case did you try using fakeroot ?

Why would you need a per-file ownership?
(0024194)
Eric NOULARD   
2010-12-15 16:38   
I need feedback from the reporter before trying to handle this one.
(0024868)
David Cole   
2011-01-18 11:27   
Arthur,

Can you provide Eric with feedback on this, so he can make progress on this issue...?

Thanks.
(0024900)
Eric NOULARD   
2011-01-18 17:31   
see related thread on the ML:
http://www.cmake.org/pipermail/cmake/2011-January/041820.html [^]
including final remark concerning fakeroot;
http://www.cmake.org/pipermail/cmake/2011-January/041917.html [^]
(0027062)
Daniel Franke   
2011-07-24 08:51   
I see the same problem. It came as a surprise to me when I discovered that binaries installed to /usr/bin are owned by the user account that created them, not by root:root as I'd have expected.

Even before fixing, I'd suggest a big warning sign somewhere in the cmake/cpack documentation to suggest the usage of fakeroot.

Thanks.
(0027327)
Kishore Jonnalagadda   
2011-09-05 06:55   
I am quite sure this worked in cmake 2.8.3 where it would create deb packages giving me file ownership. It still work fine using fakeroot but i want to use "make package".

I am only referring to the DEB generator. I am not sure of the other cases.
(0027361)
Eric NOULARD   
2011-09-05 16:30   
I would be surprised it could have worked with 2.8.3
nevertheless patch are welcome in order to systematically use fakeroot
as a default for deb.

Honestly I did not think on how to do that automagically only for DEB.
One cannot do it globally for make package/cpack because cpack will
call each generator listed in CPACK_GENERATOR during the same run.

Any suggestion are welcome.
(0027362)
Eric NOULARD   
2011-09-05 16:48   
Ok I finally did try something that should work as following:

 - if fakeroot is found then use it for DEB
 - if not proceed as usual.

Patch attached.
Testers are welcomed.
I won't merge that kind of "feature" during an RC cycle so
I think it has to wait for 2.8.7.
(0027364)
Kishore Jonnalagadda   
2011-09-05 23:26   
I checked again with 2.8.3 and you are right. It uses the user's uid and gid. Maybe i was so used to using fakeroot that i took it for granted.

I will check your patch.
(0027365)
Kishore Jonnalagadda   
2011-09-05 23:56   
Your patch appears to work fine.
(0027461)
Eric NOULARD   
2011-09-20 14:26   
Just merged to next.
Merge topic 'CPackDeb-fakeroot' into next
    
    49da3bd CPackDeb fix 0010325 automagically use fakeroot for DEB if fakeroot i
(0027462)
Eric NOULARD   
2011-09-20 14:27   
want to put it on the 2.8.6 roadmap
(0027463)
Eric NOULARD   
2011-09-20 14:27   
Now should appear on the roadmap.
(0032868)
Robert Maynard   
2013-04-17 08:54   
Closing resolved issues that have not been updated in more than 4 months.