(POSIX 1003.1 USTAR)

From SciNet Users Documentation
Jump to: navigation, search


From the htar manual:

When specifying path names that are greater than 100 characters for a file (POSIX 1003.1 USTAR) format, remember that the path name is composed of a prefix buffer, a / (slash), and a name buffer.

The prefix buffer can be a maximum of 155 bytes and the name buffer can hold a maximum of 100 bytes. Since some implementations of TAR require the prefix and name buffers to terminate with a null (? ?) character, HTAR enforces the restriction that the effective prefix buffer length is 154 characters (+ trailing zero byte), and the name buffer length is 99 bytes (+ trailing zero byte).

If the path name cannot be split into these two parts by a slash, it cannot be archived. This limitation is due to the structure of the tar archive headers, and must be maintained for compliance with standards and backwards compatibility. In addition, the length of a destination for a hard or symbolic link (the link name) cannot exceed 100 bytes (99 characters + zero-byte terminator).

In the example below the file will be skipped with a false positive "HTAR: HTAR SUCCESSFUL" message, however HTAR lists all the files omitted, and exit code 70.

htar -cpf /archive/$(id -gn)/$(whoami)/fromScratch/test.tar very_long_pathname/aaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbb/cccccccccccccccccc/ddddddddddddddddddddd/eeeeeeeeeeeeeeeeeeee/ffffffffffffffffffff/gggggggggggggggggg/hhhhhhhhhhhhhhhhhh/iiiiiiiiiiiiiiiii/jjjjjjjjjjjjjjjj/kkkkkkkkkkkkkkkkkkk/lllllllllllllllll/file

Warning: name too long for tar archive- file omitted

HTAR: HTAR SUCCESSFUL                      
###WARNING  htar returned non-zero exit status.
            70 = /var/hpss/hsi/bin/htar.exe -cpf test.tar very_long_pathname/aaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbb/cccccccccccccccccc/ddddddddddddddddddddd/eeeeeeeeeeeeeeeeeeee/ffffffffffffffffffff/gggggggggggggggggg/hhhhhhhhhhhhhhhhhh/iiiiiiiiiiiiiiiii/jjjjjjjjjjjjjjjj/kkkkkkkkkkkkkkkkkkk/lllllllllllllllll/file

NOTE: gnu tar has gone away from the standard and can use larger file names, with -o option required to obtain standard results:

tar -ocf a.tar 
aaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbb/cccccccccccccccccc/ddddddddddddddddddddd/eeeeeeeeeeeeeeeeeeee/ffffffffffffffffffff/gggggggggggggggggg/hhhhhhhhhhhhhhhhhh/iiiiiiiiiiiiiiiii/jjjjjjjjjjjjjjjj/kkkkkkkkkkkkkkkkkkk/lllllllllllllllll/: file name is too long (max 99); not 
tar: Error exit delayed from previous errors

Many people are entirely unaware of any .tar limit. HTAR however follows the standard.