|
From: | mad1ost |
Subject: | Re: [Bug-cpio] The permissions of ./ do not change |
Date: | Tue, 29 Aug 2017 23:40:12 +0300 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
In manual https://www.gnu.org/software/cpio/manual/cpio.html If you wanted to archive an entire directory tree, the find command can provide the file list to cpio:
The -depth option forces ‘find’ to print of the entries in a directory before printing the directory itself. This limits the effects of restrictive directory permissions by printing the directory entries in a directory before the directory name itself. Аs I understand it's in the case when a directory have no write permission for user who extract the archive, because if cpio create first a directory with no permission to write he will not be able to add a new file in this directory from the archive. BUT address@hidden:~/tmp$ cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 8 (jessie)" NAME="Debian GNU/Linux" VERSION_ID="8" VERSION="8 (jessie)" ID=debian HOME_URL="http://www.debian.org/" SUPPORT_URL="http://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" address@hidden:~/tmp$ cpio --version cpio (GNU cpio) 2.11 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Phil Nelson, David MacKenzie, John Oleynick, and Sergey Poznyakoff. address@hidden:~/tmp/orig$ ls -l total 4 drwxr-xr-x 2 user user 4096 Aug 29 23:22 dir address@hidden:~/tmp/orig$ chmod -w dir address@hidden:~/tmp/orig$ ls -ld dir dr-xr-xr-x 2 user user 4096 Aug 29 23:22 dir # no write permission address@hidden:~/tmp/orig$ find . ./dir # dir with no write permission is first ./dir/file2 ./dir/file1 address@hidden:~/tmp/orig$ find -print0 | cpio -0o > ../test.cpio 1 block address@hidden:~/tmp/orig$ cd .. address@hidden:~/tmp$ cpio -tv < test.cpio drwxr-xr-x 3 user user 0 Aug 29 23:26 . dr-xr-xr-x 2 user user 0 Aug 29 23:22 dir # dir with now write permission is first -rw-r--r-- 1 user user 0 Aug 29 23:22 dir/file2 -rw-r--r-- 1 user user 0 Aug 29 23:22 dir/file1 1 block address@hidden:~/tmp$ mkdir copy address@hidden:~/tmp$ cd copy/ address@hidden:~/tmp/copy$ cpio -i < ../test.cpio 1 block address@hidden:~/tmp/copy$ ls -Rl .: total 4 dr-xr-xr-x 2 user user 4096 Aug 29 23:31 dir ./dir: total 0 -rw-r--r-- 1 user user 0 Aug 29 23:31 file1 -rw-r--r-- 1 user user 0 Aug 29 23:31 file2 If dir was create first, why file was create in dir with no permission to write? address@hidden:~/tmp/copy$ touch dir/file3 touch: cannot touch 'dir/file3': Permission denied 29.08.2017 12:25, Sergey Poznyakoff
пишет:
mad1ost <address@hidden> ha escrit:For the second question, should I create a new message with other subject or can I write here?As you wish, Andrey. I'm equally comfortable both ways. Regards, Sergey |
[Prev in Thread] | Current Thread | [Next in Thread] |