Notes |
|
(0021436)
|
Bill Hoffman
|
2010-07-21 10:30
|
|
I am going to need an example. My guess would be the install command is not working the same. What is in the _CPACK directory for each of these? |
|
|
(0021439)
|
Thomas Themel
|
2010-07-21 11:02
|
|
Okay, here's a very simple example that illustrates the problem:
Again, 2.8.1:
themel@kallisti:~/src/cpack-bug/build$ dpkg-deb -c cpack-bug-0.1-x86_64.deb
drwxr-xr-x themel/themel 0 2010-07-21 16:59 ./usr/
drwxr-xr-x themel/themel 0 2010-07-21 16:59 ./usr/bin/
-rwxr-xr-x themel/themel 7144 2010-07-21 16:59 ./usr/bin/cpack-bug
With 2.8.2:
themel@kallisti:~/src/cpack-bug/build$ dpkg-deb -c cpack-bug-0.1-x86_64.deb
-rwxr-xr-x themel/themel 7144 2010-07-21 16:59 ./usr/bin/cpack-bug
Btw, all this on an am64 Debian Sid, with cmake 2.8.1/2.8.2 compiled from source. |
|
|
(0021440)
|
Bill Hoffman
|
2010-07-21 12:04
|
|
Looks like an issue with the switch to libarchive.... I don't have a ton of time right now, if you could figure out the patch I could get it done quick. Looks like the cmake -E tar command is not keeping the directories anymore. We used to use libtar, and switched for 2.8.2 to libarchive. |
|
|
(0021443)
|
Thomas Themel
|
2010-07-21 16:07
|
|
Mhm, the current cmSystemTools::CreateTar implementation looks exactly like it would produce the current behaviour. I'll look into it. |
|
|
(0021595)
|
simonh
|
2010-08-02 11:46
|
|
I've just encountered a similar bug with 2.8.2. Specifically, there are older versions of tar which choke on the extensions which libarchive is now using.
See e.g. http://unix.derkeiler.com/Mailing-Lists/FreeBSD/stable/2007-05/msg00700.html [^]
My tar outputs:
tar: Ignoring unknown extended header keyword `SCHILY.dev'
tar: Ignoring unknown extended header keyword `SCHILY.ino'
tar: Ignoring unknown extended header keyword `SCHILY.nlink'
tar: Ignoring unknown extended header keyword `LIBARCHIVE.xattr.security.selinux'
... and finally exits with code 2 (instead of just issuing a warning and exiting with 0) |
|
|
(0021597)
|
simonh
|
2010-08-02 12:14
|
|
|
|
(0021602)
|
Brad King
|
2010-08-03 09:19
|
|
The current code came from commit 22fb266d (use different tar format to handle longer file names, 2009-11-14):
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=22fb266d [^]
The commit switched from ustar to pax on purpose.
Here is a simple experiment:
$ mkdir foo
$ touch foo/a
$ tar cf foo.tar foo
$ tar tf foo.tar
foo/
foo/a
$ cmake -E tar tf foo.tar foo
foo/
foo/a
If I use CMake to create the tarball instead:
$ cmake -E tar cf foo.tar foo
$ tar tf foo.tar
foo/a
$ cmake -E tar tf foo.tar foo
foo/a
I tried applying your change to cmSystemTools::CreateTar (pax_restricted -> ustar) but the above experiment produces the same result. |
|
|
(0021603)
|
Brad King
|
2010-08-03 09:47
|
|
Even the example in http://code.google.com/p/libarchive/wiki/ManPageArchiveWrite3 [^] produces just "foo/a" unless one explicitly lists "foo" on the command line.
Looking back at the old libtar-based implementation, it looks like libtar automatically handles directories so CMake's code could just send in those paths. Now the libarchive-based cmSystemTools::CreateTar does its own traversal. It uses a recursive glob search that only returns files and leaves out all their directories. This needs to be corrected to do a proper recursive directory traversal.
|
|
|
(0021604)
|
Brad King
|
2010-08-03 09:50
|
|
It looks like cmCPackGenerator::DoPackage also uses the recursive glob and does not return directories. |
|
|
(0021605)
|
simonh
|
2010-08-03 10:02
(edited on: 2010-08-03 10:04) |
|
How do we solve the problem that pax archives are not readable without error on older GNU tar implementations? Is there an actual bug report that indicates that 255 character filenames are actually needed, bearing in mind that these are always relative to the top-level archive directory (i.e. not whole filesystems)?
I'd always rather make the tar archives as portable as possible by default, and only add additional, more-specific variants (e.g. pax) as required.
BTW, I now realise this is an orthogonal issue? Should I report a separate bug?
|
|
|
(0021606)
|
Brad King
|
2010-08-03 10:36
|
|
Let's just keep the discussion together here.
The old libtar implementation did this:
void th_set_path(TAR *t, char *pathname)
{
if (strlen(pathname)+strlen(suffix) >= T_NAMELEN && (t->options & TAR_GNU))
{ /* GNU-style long name */ }
else if (strlen(pathname)+ strlen(suffix) >= T_NAMELEN)
{ /* POSIX-style prefix field */ }
else
{ /* classic tar format */ }
}
In other words, it dynamically switched the entry type for each path. |
|
|
(0021607)
|
Brad King
|
2010-08-03 10:45
|
|
On the other hand, the libtar-based implementation seems to produce bad archives when there is a very, very deep name. In a simple test with a 400-character long path the file did not extract correctly. It does extract correctly from an archive created with the libarchive-based implementation (with more recent GNU tar). |
|
|
(0021609)
|
Thomas Themel
|
2010-08-03 11:11
(edited on: 2010-08-03 14:45) |
|
I have attached a patch that fixes the (originally reported, not the path name length) issue in cmSystemTools by ensuring that every created file has all the parent directories it needs. Works for me, but please note that it seems that cmCPackArchiveGenerator::CompressFiles will exhibit the same issue for TGZ files and will need to be fixed in a similar way. Maybe it would be better to refactor so as to have a single place that turns a list of files into a tar file?
|
|
|
(0021610)
|
Brad King
|
2010-08-03 11:14
(edited on: 2010-08-03 11:15) |
|
Yes, refactoring would be better. I think it should just be a function that takes the top-level directory by full path, a list of input paths, and a "struct archive*". Then it should load the directories and recurse itself.
|
|
|
(0021611)
|
simonh
|
2010-08-03 12:38
|
|
I'll take a look tomorrow at whether unrestricted pax archives are supported by older GNU tars. Versions 1.14 and above claim to support POSIX.1-2001.
I'll try "archive_write_set_format_pax"... |
|
|
(0021626)
|
simonh
|
2010-08-04 05:04
|
|
Nope, that didn't help. I can't read the generated tar archives without a non-zero exit status from the system-installed "tar" program on the following Linux distributions:
Fedora Core 7
Red Hat Enterprise Linux 5
Some other distros (such as RHEL4) are fine, though... |
|
|
(0021627)
|
Brad King
|
2010-08-04 07:54
|
|
What version of GNU tar (tar --version) are on the systems that do not work? |
|
|
(0021628)
|
simonh
|
2010-08-04 07:58
|
|
|
|
(0021629)
|
simonh
|
2010-08-04 08:14
|
|
|
|
(0021630)
|
simonh
|
2010-08-04 08:23
|
|
Having dug into the Red Hat SRPM, their xattr patch raises an ERROR() macro whenever an unknown extend header keyword is encountered (not a WARN() macro).
They only support:
SCHILY.xattr.security.selinux, SCHILY.xattr.system.posix_acl_access, SCHILY.xattr.system.posix_acl_default, SCHILY.xattr.user,SCHILY.xattr.root for the Schilling extensions. |
|
|
(0021689)
|
Brad King
|
2010-08-06 15:43
|
|
|
|
(0021697)
|
Brad King
|
2010-08-09 10:05
|
|
|
|
(0021977)
|
Brad King
|
2010-08-26 13:40
|
|
simonh: Now that the original bug in this issue has been fixed I decided that your pax v. ustar issue deserves its own issue as you suggested earlier. I've opened 0011176 for discussion on that problem.
Now I'm closing this issue since it is fixed. |
|