#12 make tar POSIX-capable

open
nobody
None
5
2007-04-05
2007-04-05
Silverstein
No

We found that untarring a tar set created on an IRIX system does not place the resulting files in the expected location in some cases. These are cases where the path+file name of the file in the archive is more than 255 characters (excluding NULL).

In our case we were NOT using the -O option.

The IRIX tar man page says:

If the O option is specified the maximum pathlength--including the
filename itself-- is 99 characters (NAMSIZ) not including the string-
terminating NULL character, and any archives created with non-POSIX

standard versions of tar will also obey this length rule. Otherwise,
(the [default] POSIX format), pathnames are limited to 255 total
characters (not including the NULL), subject to several caveats
necessitated by the requirement of total backward compatibility with
previous versions of tar. Referring to /usr/include/tar.h, there are two
storage fields for filenames name, (100 chars) and prefix (156 chars).
If the entire pathname is 100 characters or less including the NULL, it
will be stored in the name field. Otherwise the pathname is split
between the two fields, with the restriction that an implicit (i.e.,
unstored) '/' character separates the prefix and name fields. Upon
extraction, the full pathname is constructed by concatenating these
fields with the added '/'. Because of this requirement, files whose
actual names (not including the leading path) exceed 99 characters cannot
be archived. If the split field is used, and the tape is read on older,
non-POSIX capable tar, the file will be extracted in the current
directory, since no leading pathname information is located in the older
location in the header; this at least allows the file to be extracted on
older systems, but if multiple files with the same final component are
extracted, the earlier will be overwritten by the later file(s).

Example tar file is attached. The last two files
phase_score_hypotheses_run2_small_prj_results/phase_score_hypotheses_run2_small_prj_02366_hypothesis.tab
phase_score_hypotheses_run2_small_prj_results/phase_score_hypotheses_run2_small_prj_02366_scores.out

end up as the following when extracted with unxutils tar:

phase_score_hypotheses_run2_small_prj_02366_hypothesis.tab
phase_score_hypotheses_run2_small_prj_02366_scores.out

Discussion

  • Silverstein

    Silverstein - 2007-04-05

    tar file created on IRIX

     
  • Silverstein

    Silverstein - 2007-04-05

    Logged In: YES
    user_id=808799
    Originator: YES

    Had to gzip the tar file to get it small enough to attach.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks