MantisBT - CMake
View Issue Details
0008790CMakeCPackpublic2009-03-25 07:422011-05-02 14:46
Thomas Wunschel 
Mathieu Malaterre 
normalminorsometimes
closedfixed 
CMake-2-6 
CMake 2.8.4 
0008790: Generated deb packages sometimes cannot be installed correctly
When using the deb generator, some resulting packages cannot be installed correctly using "dpkg -i <packagename>": Alltough the package contents are listed correctly using "dpkg --contents <packagename>", some files get installed in the root ("/") directory instead of their correct location.

I contacted a dpkg developer regarding that problem. According to him the reason for the problem is because debian packages should be created using the gnu tar format and cpack is currently using it's built-in tar command.

The problem already has been addressed in dpkg (see http://git.debian.org/?p=dpkg/dpkg.git;a=commit;h=53b1f8871fea748e0360bf9183735ab54f7a1f64 [^] for more details) and dpkg built from source now handles the package correctly.

However, as the problem occurs during package installation time, users of deb-based distros will currently not be able to correctly install the package produced by cmake.

The attached patch tries to circumvent the problem by using the system-installed tar command when creating debian packages.
I've uploaded an example of a package showing the described behaviour to http://212.227.78.199/~wuschi/blackray-thirdparty_0.8.0_Linux-i686.deb [^]
No tags attached.
patch cpack_deb_use_system_tar.patch (1,601) 2009-03-25 07:42
https://public.kitware.com/Bug/file/2141/cpack_deb_use_system_tar.patch
gz cpack-deb-bug.tar.gz (552) 2010-06-16 15:53
https://public.kitware.com/Bug/file/3197/cpack-deb-bug.tar.gz
Issue History
2009-03-25 07:42Thomas WunschelNew Issue
2009-03-25 07:42Thomas WunschelFile Added: cpack_deb_use_system_tar.patch
2009-09-14 15:06Bill HoffmanStatusnew => assigned
2009-09-14 15:06Bill HoffmanAssigned To => Mathieu Malaterre
2010-06-16 15:53Di-an JanFile Added: cpack-deb-bug.tar.gz
2010-12-03 07:33Mathieu MalaterreNote Added: 0023692
2010-12-03 07:33Mathieu MalaterreStatusassigned => feedback
2011-01-06 16:36Bill HoffmanNote Added: 0024488
2011-01-07 02:33Eric NOULARDNote Added: 0024503
2011-01-08 19:24Eric NOULARDNote Added: 0024524
2011-01-21 19:01David ColeNote Added: 0025014
2011-01-21 19:01David ColeStatusfeedback => resolved
2011-01-21 19:01David ColeFixed in Version => CMake 2.8.4
2011-01-21 19:01David ColeResolutionopen => fixed
2011-05-02 14:46David ColeNote Added: 0026374
2011-05-02 14:46David ColeStatusresolved => closed

Notes
(0023692)
Mathieu Malaterre   
2010-12-03 07:33   
Hi,

  I perfectly understand the problem. However my initial patch did use BSD-tar in its first implementation. There must have been a regression that now tar is now GNU tar. I believe there should be a better patch for this issue, like using libarchive with the proper flag to generate a BSD-tar compatible archive.

HTH
(0024488)
Bill Hoffman   
2011-01-06 16:36   
Is this still an issue?
(0024503)
Eric NOULARD   
2011-01-07 02:33   
I don't know.
But clearly the patch (against 2.6.3) didn't make it to the source.
The patch proposed to replace "cmake -E tar" with "system tar"
command (if found).

Currently the cmake -E tar command uses cmlibarchive wrapper
(CreateTar in cmSystemTools.cxx uses cmArchiveWrite.h/cxx)
to create a "pax" format tar i.e. "POSIX pax interchange".

As Mathieu noted we may try to replace that with direct
[cm]libarchive call and specify either:

archive_write_set_format_gnutar --> GNU Tar
archive_write_set_format_ar_bsd --> BSD Tar

I may try to check whether if the problem still exist this week-end unless Thomas or Mathieu can do it.

I won't probably be able to propose a patch though.
The probable patch may need to create an extra "cmArchive Type"
TypeGNUTar and/or TypeBSDTar (instead of current TypeTAR) in order
to use the existing libarchive wrapper (see cmArchiveWrite.cxx/h)
not a big deal but need some work + test.

Sidenote: At the same time it would be nice to throw away OpenBSD ar
copy/paste code inside CPack/cmCPackDebGenerator.cxx and use cmlibarchive
with BSD Tar format.
(0024524)
Eric NOULARD   
2011-01-08 19:24   
I did just test using CMake 2.8.3 on Ubuntu 10.04
I have no problem with the installed .deb
(I did use the cpack-deb-bug.tar.gz)

Note that I did try the should-be-buggy "http://212.227.78.199/~wuschi/blackray-thirdparty_0.8.0_Linux-i686.deb" [^]

And I cannot reproduce the problem either.
I think I won't be able to help until being able to reproduce the problem...

As a side note I did have a look at CMake 2.6.3 code and
at that time the -E tar command was implemented by "libtar" there was
not cmlibarchive usage at all.
So there are many difference.

I would suggest to Thomas to try to reproduce the bug with CMake 2.8.3
if it is not possible I suggest closing the bug because it is at best
obsolete w.r.t. the current CMake source code.
(0025014)
David Cole   
2011-01-21 19:01   
Marking as resolved, assuming fixed in CMake 2.8.4 based on the recently added notes.

Please re-open this issue if there is still a problem with CMake 2.8.4 or later.
(0026374)
David Cole   
2011-05-02 14:46   
Closing resolved issues that have not been updated in more than 3 months.