When cpio archive is created as "find . -depth |cpio -o" and extracted as "cpio -i --make-directories" under root user, I get all directories owned by UID=0 no matter who was the owner of the directory when acrive was created.
This may be shown as:
$ su - tux ~ # id -u 0 tux ~ # mkdir test; cd test tux test # mkdir in out; mkdir in/dir; touch in/dir/file tux test # chown 1 in/dir tux test # (cd in; find . -depth |cpio -o) | (cd out; cpio -i --make-directories)
1 block 1 block tux test # ls -ln in total 0 drwxr-xr-x 2 1 0 72 Окт 22 08:56 dir tux test # ls -ln out total 0 drwxr-xr-x 2 0 0 72 Окт 22 08:56 dir tux test # cpio --version cpio (GNU cpio)
2.9 tux test #
One can see different owner UID for in/dir and out/dir.
Notice: when cpio -i works, the directory is first created, then populated with files, then set correct pwermissions and owner UID, and finally (when the whole archive is extracted), owner UID is reset back to 0.
The problem was not observed with cpio 2.6. The problem does not emerge with "find |cpio -o" (without -depth).
-- Hope this information was useful, Alexey Stratonnikov