Reply to comment

pax substitution and relative symbolic links

When using pax -s to rewrite archived files on the fly, it also rewrites the symlink reference even if these symlinks are relative. This is highly unexpected, not documented and incorrect behavior.

Imagine you the following two files:

bin/test
sbin/test -> ../bin/test

If you would archive this using:

find . | pax -d -w -x ustar -s ',^,foo-1.2/,' >foo-1.2.tar

You end up with the following files in the archive:

foo-1.2/bin/test
foo-1.2/sbin/test -> foo-1.2/../bin/test

Which obviously is _never_ the correct behavior. For a relative path it should not perform any substitution.

A workaround in this case, is making use of the fact that pax will only do one successful substitution:

find . | pax -d -w -x ustar -s ',^\.,\.,' -s ',^,foo-1.2/,' >foo-1.2.tar

So we first match all the stuff we don't want to substitute, and substitute it by itself. (duh!) And then we do the substitution we want for all other cases.

Reply

Please refrain from adding URLs to unrelated or commercial websites. This site is moderated and comments with inappropriate links are rejected. Thank you for your understanding.
The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options