Noiselabs Consulting

Noiselabs Consulting


Software Consultancy

Share


Tags


tar: file name is too long (max 99)

I was doing the usual make dist process to launch a tarball for one of my apps when tar died with the following message:

tar: file name is too long (max 99); not dumped
tar: Error exit delayed from previous errors

If you happen to see the same error message it is quite likely that you (and by you I mean Automake) are using the old V7 tar format.

Want to skip details? Then just scroll to the end and check the solution ;-)

V7 and other tar formats

By default Automake is pulling the historical V7 format to generate the tarball with make dist. This tar format supports file names only up to 99 characters and that's why tar is refusing to build the tarball.

Since automake 1.9, the tar format can be chosen with the options tar-v7, tar-ustar and tar-pax.

This is what the Automake manual says about each option:

tar-v7

This is the historical default. This antiquated format is understood by all tar implementations and supports file names with up to 99 characters. When given longer file names some tar implementations will diagnose the problem while other will generate broken tarballs or use non-portable extensions. Furthermore, the V7 format cannot store empty directories.

tar-ustar

(...) format defined by POSIX 1003.1-1988. This format is believed to be old enough to be portable. It fully supports empty directories. It can store file names with up to 256 characters, provided that the file name can be split at directory separator in two parts, first of them being at most 155 bytes long. So, in most cases the maximum file name length will be shorter than 256 characters. However you may run against broken tar implementations that incorrectly handle file names longer than 99 characters.

tar-pax

(...) the new pax interchange format defined by POSIX 1003.1-2001. It does not limit the length of file names. However, this format is very young and should probably be restricted to packages that target only very modern platforms. There are moves to change the pax format in an upward-compatible way, so this option may refer to a more recent version in the future.

How to fix it?

The solution is to pick a newer and better tar implementation like tar-pax. Go to configure.ac or configure.in and change the AM_INIT_AUTOMAKE macro so it specifies the tar format and requires automake version to be 1.9 or better as tar-pax is only supported since 1.9.

Edit configure.ac/configure.in:

AM_INIT_AUTOMAKE([1.9 tar-pax])

Now run make dist again and tar won't bother you anymore (at least with this error :)).

View Comments