Field Commander Wieers - paxhttp://dag.wiee.rs/blog/taxonomy/term/357/0
enpax substitution and relative symbolic linkshttp://dag.wiee.rs/blog/pax-substitution-and-relative-symbolic-links
<p>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.</p>
<p>Imagine you the following two files:</p>
<p><code></code></p>
<pre>bin/test
sbin/test -> ../bin/test
</pre><p></p>
<p>If you would archive this using:</p>
<p><code></code></p>
<pre>find . | pax -d -w -x ustar -s ',^,foo-1.2/,' >foo-1.2.tar
</pre><p></p>
<p>You end up with the following files in the archive:</p>
<p><code></code></p>
<pre>foo-1.2/bin/test
foo-1.2/sbin/test -> foo-1.2/../bin/test
</pre><p></p>
<p>Which obviously is _never_ the correct behavior. For a relative path it should not perform any substitution.</p>
<p>A workaround in this case, is making use of the fact that pax will only do one successful substitution:</p>
<p><code></code></p>
<pre>find . | pax -d -w -x ustar -s ',^\.,\.,' -s ',^,foo-1.2/,' >foo-1.2.tar
</pre><p></p>
<p>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.</p>
http://dag.wiee.rs/blog/pax-substitution-and-relative-symbolic-links#commentspaxrewritesubstitutesylinkssymbolic linksFri, 08 Jun 2012 18:46:56 +0000dag241 at http://dag.wiee.rs/blog