Date: Mon, 28 Dec 2009 10:04:47 +0000 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: =?windows-1251?Q?=CA=EE=ED=FC=EA=EE=E2_=C5=E2=E3=E5=ED=E8=E9?= <kes-kes@yandex.ru> Cc: freebsd-questions@freebsd.org Subject: Re: How to force tar to be quiet? Message-ID: <4B3882BF.7060104@infracaninophile.co.uk> In-Reply-To: <1047257846.20091227221031@yandex.ru> References: <1846015154.20091227185106@yandex.ru> <4B37AB6D.3020507@infracaninophile.co.uk> <1047257846.20091227221031@yandex.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigF8B0696EB6432F384063A3AE Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: quoted-printable =CA=EE=ED=FC=EA=EE=E2 =C5=E2=E3=E5=ED=E8=E9 wrote: > =C7=E4=F0=E0=E2=F1=F2=E2=F3=E9=F2=E5, Matthew. >=20 > =C2=FB =EF=E8=F1=E0=EB=E8 27 =E4=E5=EA=E0=E1=F0=FF 2009 =E3., 20:46:05:= >=20 > MS> =CA=EE=ED=FC=EA=EE=E2 =C5=E2=E3=E5=ED=E8=E9 wrote: >>> =C7=E4=F0=E0=E2=F1=F2=E2=F3=E9=F2=E5, 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? >>> >=20 > MS> Don't give the leading '/' in path names. Like so: >=20 > MS> tar -cf file.tar -C / home >=20 > MS> Cheers, >=20 > MS> Matthew =20 >=20 > # tar -cf /home/kes/backup/conf/aaa_etc.tar -C / boot/loader.conf etc/*= usr/local/etc/* usr/local/virtwww/* > tar: No match. Yep. As shown, you don't need '*' here. tar(1) is perfectly capable of = recursing through a directory hierarchy given only the name of the top level direct= ory. [ * is actually expanded by your shell, rather than tar, so it's trying t= o match filenames against your current working directory, and not against the dir= ectory the '-C' switches tar to.]=20 > And next does not work as expected: > # tar -cf /home/kes/backup/conf/aaa_etc.tar -C / boot/loader.conf etc u= sr/local/etc usr/local/virtwww >=20 > I get: > boot > etc > mysite > local > sub > usr > virtwww Hmmm... I can't reproduce this locally. If I run: sudo tar -cf foo.tar -C / etc boot then I get (as expected) a tarball with the contents of /etc and /boot --= not only that, but there's nothing printed to stdout/stderr while the command= runs. Are any of the directories concerned symbolic links on your system? tar(= 1) handles sym-links quite carefully given that it's possible to use them to= generate specially crafted tar archives that you can use to trick an unwa= ry admin into overwriting security sensitive files. As a rule of thumb, whe= n specifying directory trees to back-up, try and avoid having any path comp= onents 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 >=20 > Why I get that wrong result? You'ld need to tell us a lot more detail about your system before anyone = can answer that. We can guess -- the sym-link problems I talk about above ar= e my attempt -- and I can tell you that the command as stated works for me, wh= ere everything is installed in a single UFS2 filesystem and it's all arranged= in the natural directory tree without trying to rearrange chunks of filesystems = using sym-links. If you're doing anything different to that, then please say s= o. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW --------------enigF8B0696EB6432F384063A3AE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEAREIAAYFAks4gsUACgkQ8Mjk52CukIzIiACglT4gJT1KMMfAbpuExLnJvSKf H9IAn2nj16lVumwX9QMTW43B7vljUQO4 =jDhx -----END PGP SIGNATURE----- --------------enigF8B0696EB6432F384063A3AE--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B3882BF.7060104>