This behavior also applies to cpio 2.10
On Wed, Mar 04, 2009 at 08:10:18AM +0100, Dietmar Schroeter wrote:
> Unfortunately it is, at least in cpio_2.9.90-3 .
> For your convenience, I append the modified testscript, which
> delivers a definite yes or no as you can see in this example:
>
> $ pwd
> /root/cpio
> $ ./cpio-bug
> 1 block
> 1 block
> drwx------
> bad: bug still present in cpio
> 1 block
> 1 block
> drwx------
> bad: bug still present in /root/cpio/cpio
> 1 block
> 1 block
> drwxr-xr-x
> good: bug not found in /root/cpio/cpio-etch
>
> And here comes the script (does not need root permissions):
>
> #!/bin/sh
> cpio_bugtest()
> {
> typeset cpioprog="$1"
>
> case "$cpioprog" in
> /*) ;;
> "") cpioprog=cpio # the system default
> ;;
> *) echo "please specify an absolute path for cpioprog" >&2
> return 1
> ;;
> esac
> testdir="$(mktemp -d)" || return 11
> trap "rm -rf $testdir" 0
> umask 077
> rm -rf wrongperms newdir
> mkdir -m 755 "$testdir/wrongperms"
> >"$testdir/wrongperms/file"
> mkdir "$testdir/newdir"
> (cd "$testdir" && find wrongperms -depth | "$cpioprog" -oH newc) | (cd
> "$testdir/newdir" && "$cpioprog" -imd)
> #ls -laR "$testdir/wrongperms"
> #ls -laR "$testdir/newdir"
> perms="$(ls -ld "$testdir/newdir/wrongperms")"
> perms="${perms%% *}"
> echo "$perms"
> case "$perms" in
> "drwx------") echo "bad: bug still present in $cpioprog" >&2
> rm -rf "$testdir"
> trap "" 0
> return 1
> ;;
> "drwxr-xr-x") echo "good: bug not found in $cpioprog" >&2
> rm -rf "$testdir"
> trap "" 0
> return 0
> ;;
> *) echo "sorry: unknown state. Please debug
> testscript :-(" >&2
> rm -rf "$testdir"
> trap "" 0
> return 1
> ;;
> esac
> }
> cpio_bugtest
> cpio_bugtest $PWD/cpio
> cpio_bugtest $PWD/cpio-etch
> exit
>
> ### end of script ###
>
> Regards
> Dietmar