From owner-freebsd-questions@FreeBSD.ORG Mon Dec 28 15:16:19 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5343B1065693 for ; Mon, 28 Dec 2009 15:16:19 +0000 (UTC) (envelope-from kes-kes@yandex.ru) Received: from forward10.mail.yandex.net (forward10.mail.yandex.net [77.88.61.49]) by mx1.freebsd.org (Postfix) with ESMTP id C41AB8FC2A for ; Mon, 28 Dec 2009 15:16:18 +0000 (UTC) Received: from smtp10.mail.yandex.net (smtp10.mail.yandex.net [77.88.61.36]) by forward10.mail.yandex.net (Yandex) with ESMTP id 9060B13202D3; Mon, 28 Dec 2009 18:16:16 +0300 (MSK) Received: from HOMEUSER (unknown [77.93.42.18]) by smtp10.mail.yandex.net (Yandex) with ESMTPA id 8B4A710900DA; Mon, 28 Dec 2009 18:16:15 +0300 (MSK) X-Nat-Received: from [192.168.2.13]:4317 [ident-empty] by SPAM FILTER: with TPROXY id 1262013615.97052 abuse-to kes-kes@yandex.ru Date: Mon, 28 Dec 2009 17:16:16 +0200 From: =?windows-1251?B?yu7t/Oru4iDF4uPl7ejp?= X-Mailer: The Bat! (v4.0.24) Professional Organization: =?windows-1251?B?188gyu7t/Oru4iwgRnJlZUxpbmU=?= X-Priority: 3 (Normal) Message-ID: <308399180.20091228171616@yandex.ru> To: Matthew Seaman In-Reply-To: <4B3882BF.7060104@infracaninophile.co.uk> References: <1846015154.20091227185106@yandex.ru> <4B37AB6D.3020507@infracaninophile.co.uk> <1047257846.20091227221031@yandex.ru> <4B3882BF.7060104@infracaninophile.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1251 Content-Transfer-Encoding: 8bit X-Yandex-TimeMark: 1262013375 X-Yandex-Spam: 1 X-Yandex-Front: smtp10.mail.yandex.net Cc: freebsd-questions@freebsd.org Subject: Re[2]: How to force tar to be quiet? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: =?windows-1251?B?yu7t/Oru4iDF4uPl7ejp?= List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 15:16:19 -0000 Здравствуйте, Matthew. Вы писали 28 декабря 2009 г., 12:04:47: #cd / # ls -l total 5111 -rw-r--r-- 2 root wheel 786 7 сен 2008 .cshrc -rw-r--r-- 2 root wheel 253 7 сен 2008 .profile drwxrwxr-x 2 root operator 512 8 окт 2008 .snap -r--r--r-- 1 root wheel 6188 7 сен 2008 COPYRIGHT drwxr-xr-x 2 root wheel 1024 21 ноя 2008 bin drwxr-xr-x 8 root wheel 512 16 июн 2009 boot lrwxr-xr-x 1 root wheel 10 8 окт 2008 compat -> usr/compat dr-xr-xr-x 4 root wheel 512 15 дек 18:41 dev lrwxr-xr-x 1 root wheel 14 23 ноя 2008 e -> /usr/local/etc -rw------- 1 root wheel 4096 9 ноя 01:02 entropy drwxr-xr-x 21 root wheel 2560 25 дек 22:43 etc lrwxr-xr-x 1 root wheel 8 8 окт 2008 home -> usr/home drwxr-xr-x 3 root wheel 1536 21 ноя 2008 lib drwxr-xr-x 2 root wheel 512 21 ноя 2008 libexec lrwxr-xr-x 1 root wheel 36 13 янв 2009 m -> /usr/local/lib/perl5/site_perl/5.8.8 drwxr-xr-x 2 root wheel 512 7 сен 2008 media drwxr-xr-x 2 root wheel 512 7 сен 2008 mnt lrwxr-xr-x 1 root wheel 19 14 дек 2008 p -> /home/kes/projects/ dr-xr-xr-x 1 root wheel 0 28 дек 17:14 proc lrwxr-xr-x 1 root wheel 19 23 ноя 2008 r -> /usr/local/etc/rc.d -rw-r--r-- 1 root wheel 4787 15 дек 18:42 razor-agent.log drwxr-xr-x 2 root wheel 2560 21 ноя 2008 rescue drwxr-xr-x 7 root wheel 512 3 ноя 20:53 root lrwxr-xr-x 1 root wheel 21 5 дек 2008 s -> /usr/local/sharedzone drwxr-xr-x 2 root wheel 2560 21 ноя 2008 sbin lrwxr-xr-x 1 root wheel 11 21 ноя 2008 sys -> usr/src/sys -rw-rw-rw- 1 root wheel 1854498 28 дек 07:40 test drwxrwxrwt 12 root wheel 520192 28 дек 15:34 tmp drwxr-xr-x 17 root wheel 512 3 янв 2009 usr lrwxr-xr-x 1 root wheel 18 4 дек 2008 v -> /usr/local/virtwww drwxr-xr-x 29 root wheel 512 15 дек 18:41 var -rw------- 1 root wheel 2727936 11 дек 10:56 verlihub.core # uname -a FreeBSD kes.net.ua 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Sat Jan 3 01:15:39 EET 2009 kes@kes.net.ua:/usr/obj/usr/src/sys/KES_KERN_v7 i386 # df -h Filesystem Size Used Avail Capacity Mounted on /dev/ad1s1a 496M 267M 189M 59% / devfs 1.0K 1.0K 0B 100% /dev /dev/ad1s1f 496M 116M 340M 26% /tmp /dev/ad1s1g 38G 21G 14G 61% /usr /dev/ad1s1e 7.7G 6.1G 1.0G 86% /var /dev/ad1s1d 23G 8.0K 21G 0% /usr/local/squid procfs 4.0K 4.0K 0B 100% /proc devfs 1.0K 1.0K 0B 100% /var/named/dev Shell I use: /bin/sh To reproduce try next: NOTICE i have more than two (as in your example) directories to tar I have two of them with same begin path: usr/local usr/local/etc usr/local/virtwww MS> Коньков Евгений wrote: >> Здравствуйте, Matthew. >> >> Вы писали 27 декабря 2009 г., 20:46:05: >> >> MS> Коньков Евгений wrote: >>>> Здравствуйте, Freebsd-questions. >>>> >>>> when >>>> tar -cf file.tar /home/* >>>> It always says: >>>> tar: Removing leading '/' from member names >>>> >>>> man tar >>>> -P Preserve pathnames... >>>> But I do not need to preserve. I want to tar without that warning. >>>> >>>> How to force tar to be quiet? >>>> >> >> MS> Don't give the leading '/' in path names. Like so: >> >> MS> tar -cf file.tar -C / home >> >> MS> Cheers, >> >> MS> Matthew >> >> # tar -cf /home/kes/backup/conf/aaa_etc.tar -C / boot/loader.conf etc/* usr/local/etc/* usr/local/virtwww/* >> tar: No match. MS> Yep. As shown, you don't need '*' here. tar(1) is perfectly capable of recursing MS> through a directory hierarchy given only the name of the top level directory. MS> [ * is actually expanded by your shell, rather than tar, so it's trying to match MS> filenames against your current working directory, and not against the directory MS> the '-C' switches tar to.] >> And next does not work as expected: >> # tar -cf /home/kes/backup/conf/aaa_etc.tar -C / boot/loader.conf etc usr/local/etc usr/local/virtwww >> >> I get: >> boot >> etc >> mysite >> local >> sub >> usr >> virtwww MS> Hmmm... I can't reproduce this locally. If I run: MS> sudo tar -cf foo.tar -C / etc boot MS> then I get (as expected) a tarball with the contents of /etc and /boot -- not MS> only that, but there's nothing printed to stdout/stderr while the command runs. MS> Are any of the directories concerned symbolic links on your system? tar(1) MS> handles sym-links quite carefully given that it's possible to use them to MS> generate specially crafted tar archives that you can use to trick an unwary MS> admin into overwriting security sensitive files. As a rule of thumb, when MS> specifying directory trees to back-up, try and avoid having any path components MS> being symbolic links. >> Why local, sub, mysite, virtwww are in ROOT or tar??? >> 'local' must be under 'usr' >> 'virtwww' must be under 'local' >> 'mysite' must be under 'virtwww' >> but not in root >> >> Why I get that wrong result? MS> You'ld need to tell us a lot more detail about your system before anyone can MS> answer that. We can guess -- the sym-link problems I talk about above are my MS> attempt -- and I can tell you that the command as stated works for me, where MS> everything is installed in a single UFS2 filesystem and it's all arranged in the MS> natural directory tree without trying to rearrange chunks of filesystems using MS> sym-links. If you're doing anything different to that, then please say so. -- С уважением, Коньков mailto:kes-kes@yandex.ru