Skip to content

Commit

Permalink
bee-install: fix a tar-1.23 -> tar 1.26 default behavior
Browse files Browse the repository at this point in the history
-h / --dereference is needed to let tar >1.23 keep symlinks to directories

this fixes a problem where the /lib64 -> /lib symlink of tc-binutils_pass1
was overwritten by the /lib64 tc-gcc_pass1 directory in the bee-lfs proof
of concept project.

adding -h to tar just restores the default behavior of tar <= 1.23 for now.

the desired behavior for bee is not discussed yet and may change in the future.

if package A adds a symlink aaa to some directory and package B adds a directory aaa
there is a unresolvable conflict in those packages. So these packages need to be fixed.

may be we should decide to not define any bahavior of bee at all if this happens.

so for now: expected result is undefined if a package tries to replace a symlink with a directory.

for the files: the test case: (output from tar 1.26)
   (using tar 1.23 both runs show the same result as the second run of tar 1.26 including -h)

rm -fr xxx yyy && \
mkdir -p xxx yyy && \
touch xxx/aaa && \
touch yyy/bbb && \
tar cf xxx.tar xxx yyy && \
rm -fr xxx yyy && \
mkdir yyy && \
ln -s yyy xxx && \
ln -s ccc yyy/bbb && \
touch yyy/ccc && \
find xxx yyy -ls && \
tar -xf xxx.tar && \
echo "after tar -xf:" && \
find xxx yyy -ls

 46024    0 lrwxrwxrwx   1 root     system          3 Jan 26 13:55 xxx -> yyy
  1229    0 drwxr-xr-x   2 root     system         96 Jan 26 13:55 yyy
136947    0 lrwxrwxrwx   1 root     system          3 Jan 26 13:55 yyy/bbb -> ccc
136949    0 -rw-r--r--   1 root     system          0 Jan 26 13:55 yyy/ccc
after tar -xf:
 46024    0 drwxr-xr-x   2 root     system         72 Jan 26 13:55 xxx
136950    0 -rw-r--r--   1 root     system          0 Jan 26 13:55 xxx/aaa
  1229    0 drwxr-xr-x   2 root     system         96 Jan 26 13:55 yyy
136947    0 -rw-r--r--   1 root     system          0 Jan 26 13:55 yyy/bbb
136949    0 -rw-r--r--   1 root     system          0 Jan 26 13:55 yyy/ccc

rm -fr xxx yyy && \
mkdir -p xxx yyy && \
touch xxx/aaa && \
touch yyy/bbb && \
tar cf xxx.tar xxx yyy && \
rm -fr xxx yyy && \
mkdir yyy && \
ln -s yyy xxx && \
ln -s ccc yyy/bbb && \
touch yyy/ccc && \
find xxx yyy -ls && \
tar -xhf xxx.tar && \
echo "after tar -xhf:" && \
find xxx yyy -ls

 46024    0 lrwxrwxrwx   1 root     system          3 Jan 26 13:56 xxx -> yyy
  1229    0 drwxr-xr-x   2 root     system         96 Jan 26 13:56 yyy
136947    0 lrwxrwxrwx   1 root     system          3 Jan 26 13:56 yyy/bbb -> ccc
136949    0 -rw-r--r--   1 root     system          0 Jan 26 13:56 yyy/ccc
after tar -xhf:
 46024    0 lrwxrwxrwx   1 root     system          3 Jan 26 13:56 xxx -> yyy
  1229    0 drwxr-xr-x   2 root     system        120 Jan 26 13:56 yyy
136950    0 -rw-r--r--   1 root     system          0 Jan 26 13:56 yyy/aaa
136947    0 -rw-r--r--   1 root     system          0 Jan 26 13:56 yyy/bbb
136949    0 -rw-r--r--   1 root     system          0 Jan 26 13:56 yyy/ccc
  • Loading branch information
mariux committed Jan 26, 2012
1 parent 7a3c912 commit 8b12761
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/bee-install.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ do_install() {

echo "installing ${file} .."

start_cmd tar ${taraction} -vvPf ${file} \
start_cmd tar ${taraction} --dereference -vvPf ${file} \
--transform="s,^FILES$,${BEE_METADIR}/${pkg}/FILES," \
--transform="s,^BUILD$,${BEE_METADIR}/${pkg}/${BEE}," \
--transform="s,^META$,${BEE_METADIR}/${pkg}/META," \
Expand Down

0 comments on commit 8b12761

Please sign in to comment.