Commit Graph

349 Commits

Author SHA1 Message Date
wiz
7faf3dc435 English improvement (remove "be"). 2004-10-20 23:48:01 +00:00
dsl
74db501288 Update date - before wiz complains 2004-10-17 18:53:59 +00:00
dsl
7404af49b7 Improve error reporting for invalid tar archives. 2004-10-17 18:51:29 +00:00
dsl
8317fe1276 Add an option --chroot to tar. Causes it to chroot(".") before doing
an extract.  With -h this will cause existing absolute symlinks to be treated
as relative to the current directory.
Helps sysinst handle existing symlinks in the target system.
Remove 'L' from the usage (got spilt into 'h' and 'H' many moons ago)
Add 'S' to usage, and put into correct place in options list.
2004-10-17 18:49:55 +00:00
christos
4fbd9df224 PR/27212: Greg A. Woods: Accept "-C <dirname>" inside filelists in addition
to "-C\n<dirname>".
But we are not making it the default output option as the patch suggests.
2004-10-10 22:05:26 +00:00
christos
1faaf9a7c2 PR/27213: Greg A. Woods: pax doesn't honour SIGPIPE when listing
But always exit, not just on SIGPIPE.
2004-10-10 22:03:08 +00:00
christos
d8cc5bab94 PR/27209: Greg A. Woods: typo in comment in pax/tty_subs.c 2004-10-10 21:54:24 +00:00
christos
37fed2119d PR/27208: Greg A. Woods: pax must call options() before using syswarn()
or tty_warn()
2004-10-10 21:53:23 +00:00
wiz
5107d92cf0 Bump date for -S support. 2004-09-27 07:41:54 +00:00
christos
60cf19985c PR/19490: Julio Merino: Teach tar about --sparse, -S option.
Do it for cpio too.
2004-09-26 23:46:00 +00:00
christos
6885f6ba28 In GNU-tar mode, don't split filenames to prefix+name because GNU tar does
not honor it.
2004-09-26 22:49:05 +00:00
christos
d980bf3418 Keep track of the length of the gnu long name/link hack, so that
we can append to it. Modify the code so that file_write is re-entrant,
even in the gnu long name/link hack.

The old code assumed that the buffer already contained the necessary
blocks to satisfy the read file request that contained the long
filename. This is not always the case, specially when we are dealing
with pipes which do shorter reads, thus having more probability
that a long file name will fall across a buffer boundary.

To reproduce, create a tar archive with a lot of gnu-long-names
(pkgsrc/devel/libsigc++2 is a good example), do a tar -tf to get
a list of filenames, compress it and do a tar -tzf to get another
list of the filenames. Notice that the two lists differ.
2004-09-22 15:03:18 +00:00
christos
d6bc453dfc update the comment that documents the fields initialized in the array below. 2004-09-22 14:52:00 +00:00
christos
448fdb0c85 fd can be -1 or -2 for the gnu long name/link hack. So check for >= 0
instead of -1 if we need to flush.
2004-09-22 14:51:12 +00:00
hubertf
2fa09966de Change copyright to 2-clause BSD-copyright.
Changed with explicit permission of Thorsten Lockert (tholo sigmasoft com)
2004-09-15 19:45:17 +00:00
tron
ed868bc7f4 Propery handle "cpio" archives where the last hardlink includes the
data of a file. This fixes PR bin/26514.
2004-08-22 16:46:18 +00:00
yamt
401d92a0c0 indent fix for the previous (ar_io.c rev.1.43) 2004-08-02 10:20:48 +00:00
yamt
42ad308b8b for copy mode, show more meaningful infomation on SIGINFO. 2004-07-18 20:58:36 +00:00
christos
71f73d1673 - Grr! unterminated buffer string in exclude destination buffer
- fix isfoo() ctype macros to take unsigned char.
2004-07-14 12:41:36 +00:00
christos
0dd4809fb6 remove stray debugging left from last commit. 2004-07-02 16:26:53 +00:00
enami
467ca7e2c8 Salvage the `create parent directories and try again' path which is
removed by the previous commit.
2004-07-02 07:17:17 +00:00
grant
b0cddc5f0d break out of the loop and avoid the infinite loop if attempts to
create, unlink and create all fail.
2004-06-26 13:28:09 +00:00
grant
e069813aa1 don't attempt to remove the current directory. 2004-06-26 12:39:06 +00:00
christos
6b1f699323 don't keep going if -C failed to chdir(); from OpenBSD 2004-06-21 13:38:51 +00:00
jmc
b2f782612f Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
2004-06-20 22:20:14 +00:00
christos
08df9f4cb1 add -0 argument to handle nul separated file lists. 2004-06-19 02:27:00 +00:00
christos
b5370dc2f5 A small standalone program to dump ustar headers, used for debugging. 2004-06-16 14:28:21 +00:00
christos
0deda9612a PR/25934: Dieter Baron: hard links with long names still fail.
As mentioned in the previous commit, the switch statement in the longlink()
needed simplification and it was a bit incorrect. Only depend on the passed
type to determine what kind of gnu longlink to produce. Don't try to deduce
it from the archive file type.
2004-06-16 14:26:24 +00:00
christos
393b592b72 PR/25934: Dieter Baron: tar and hardlinks with long filenames don't work.
- always put the @LongLink tag on the name, not the long-link name.
- pass in what type of long name record we want to create; one for long-name
  or long-link name.
XXX: We should get rid of the switch too.
2004-06-15 21:52:00 +00:00
christos
44eb0cca7b Restructure the code to make it more readable. No functional changes. 2004-06-15 21:49:36 +00:00
christos
24aca7f677 do the special symlink treatment with all negative fd's. 2004-06-15 21:44:55 +00:00
christos
5820cbfaf6 Welcome to WARNS=3 2004-05-11 17:12:26 +00:00
grant
4fc8c484c7 - remove an extraneous word
- it's "backward compatibility" not "backwards compatibility"
2004-05-04 13:20:46 +00:00
grant
dced68e86f --unlink is the default, the argument is ignored and only accepted for
compatibility with other tar(1) implementations.
2004-05-04 13:13:01 +00:00
christos
69c89ea8a0 Don't exit with 1 on broken archives that mark directories as files for
the benefit of pkgsrc. I would have prefered that people fixed their
archivers instead.
2004-05-03 02:22:54 +00:00
matt
5864f65684 Set the chflags *after* the rename, not before. 2004-04-30 05:14:23 +00:00
christos
78b5033e6d PR/25350: Alan Barrett: Treat the sticky bit specially as non-superusers
cannot set it on non-directories (elvis-2.2_0 extraction failed)
2004-04-27 13:45:45 +00:00
christos
04d1f5de72 PR/25188: Thomas Klausner: pax-as-tar problem with trailing slashes
The problem is with the program that generates the tar file:
-rwxrwxrwx  1 root     wheel          0 Feb  8 16:46 faad2/aacDECdrop/
It creates directory nodes without the 'd' bit set, so that pax thinks
they are files and does the temporary name and dance with them. Added
code to detect this condition, warn about it, and work around it.
2004-04-25 16:20:24 +00:00
christos
57c1f1cfd7 PR/25299: grant beattie: 1.5.3/i386 kernel set archives confuse -current pax
PR/25310: Juan RP: tar can't unpack MS-DOS gzip files correctly
2004-04-25 15:52:30 +00:00
christos
af4f4c568a PR/25207: Hubert Feyrer: tar cores on certain archive contents
Don't forget to cleanup xtmp_name when we fail to create the temporary file.
2004-04-20 20:00:37 +00:00
christos
1f747cc909 PR/25207: Hubert Feyrer: tar cores on certain archive contents
- On ustar archives with a specified prefix directory, arcn->nlen was not
computed properly.
- While I am here cast some snprintf's() to void.
2004-04-20 19:59:54 +00:00
christos
7fb1726a27 remove misplaced semi-colons. 2004-04-16 22:46:28 +00:00
christos
25afd895c0 PR/25200: Alan Barrett: bug in pax append mode. This problem was introduced
while trying to fix the tar append mode. Restore the correct 2 null blocks
at the end of file, and disable the old bug compatible mode for gnutar.
2004-04-16 22:45:56 +00:00
mrg
fa97f05587 fix bugs in the previous. use snprintf(). fixes the problem reported
in PR#25131.
2004-04-12 14:41:09 +00:00
keihan
27b3f59c96 Revert last, revision 1.46. 2004-04-02 12:53:05 +00:00
keihan
6898598891 ".../newdir" --> "../newdir" 2004-04-02 11:14:24 +00:00
mrg
0ade019d3f redo GNU tar --exclude emulation to actually work the same. unfortunately,
because alternation (|) isn't available in "pax -s" RE's, we have to pass
four (yes 4!) different patterns:
	.*\/<pattern>$
	.*\/<pattern>\/.*
	^<pattern>$
	^<pattern>\/.*
instead of the more elegant
	(^|.*\/)<pattern>($|\/.*)

fixes a problem reported by simonb.
2004-04-01 14:54:39 +00:00
uebayasi
d59e9104ff Tar(1)'s -s option needs an argument. Correct option string (s -> s:).
Reported and tested by Tomoaki Imamura.
2004-02-20 05:16:54 +00:00
snj
4aff9cba1e s/nonmathing/nonmatching/ 2004-02-13 23:25:01 +00:00
matt
8fbcc555cf When pax catches a signal and cleans up, make sure to remove any temporary
file that was being extracted to.  This will prevent pax from leaving
droppings when you hit ^C.
2004-02-13 23:10:14 +00:00
wiz
d20841bb64 Uppercase CPU, plural is CPUs. 2004-02-13 11:36:08 +00:00
matt
1106d0b028 Nuke extra mkstemp. Use name, not tmp_name with chk_path. 2004-02-13 08:27:12 +00:00
matt
b2e2f282bd Back out last change. Since the name is the entire path, prefixing it
with a '.' will not have the desired effect.
2004-02-13 00:11:30 +00:00
matt
272d78cb06 When creating the temporary file, prefix the name with a '.' 2004-02-13 00:07:55 +00:00
matt
99b5d86a5f When restoring files from an archive, initially restore to a temp-file and
once it has been instantiated correctly, rename it to desired name.  This
prevents the problem of partially created files being accessed before they
are complete.  If said file is a shared library, that can cause ramdon core
dumps.
2004-02-12 22:19:18 +00:00
christos
e7827bbe92 recognize -k [--keep-old-files] short option. From hubertf. 2004-02-06 18:59:14 +00:00
christos
92ffc695bf While the comment is not correct anymore, this fixes the problem of tar -rf
where tar would skip backwards too much, corrupting the current tar archive
on append.
2004-01-30 20:46:12 +00:00
jmmv
b635f565e7 Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
2004-01-05 23:23:32 +00:00
jmmv
b9173dc41c Rewrite the loop in printflg(): if passing -Z to pax with syntax errors
(like executing "pax -Z" by itself), this caused a shr of 32 bits, which is
undefined behavior (C99) if the variable is 32 bits wide, too.  Also solves
a problem where the flgch array could be indexed out of bounds.

Thanks to uwe@ and lha@ for their suggestions... I just found the bug :p
2004-01-05 17:27:46 +00:00
matt
2d72f72583 Don't emit any warnings when tar is trying to figure out if the file is
really tar format.  valid CPIO files should not trigger a warning from tar.c
2003-11-24 23:48:47 +00:00
lukem
171d653219 Overhaul how `build.sh tools' are used:
*	Rename "config.h" to "nbtool_config.h" and
	HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
	This makes in more obvious in the source when we're using
	tools/compat/config.h versus "standard autoconf" config.h

    *	Consistently move the inclusion of nbtool_config.h to before
    	<sys/cdefs.h> so that the former can provide __RCSID() (et al),
    	and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
	#if HAVE_NBTOOL_CONFIG_H
	#include "nbtool_config.h"
	#endif
to the top of the source files (for the general case).
2003-10-27 00:12:41 +00:00
fvdl
cf96462927 Don't pass an integer as NULL. 2003-10-21 02:08:14 +00:00
agc
ed6ed8e698 Move Keith Muller's code from a 4-clause to a 3-clause licence by removing
the advertising clause. Diffs provided in PR 22397 by Joel Baker, confirmed
to the board by Keith Muller.
2003-10-13 07:41:22 +00:00
grant
0faf575771 wait for compression program to finish before exiting.
fix races condition resulting in a zero length archive after pax
exits.

patch from OpenBSD, provided by Joerg Sonnenberger in PR bin/22740.
2003-09-18 09:18:24 +00:00
agc
b5b2954259 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
2003-08-07 09:05:01 +00:00
mrg
2512e501f0 note -z is an extention. 2003-07-19 05:43:54 +00:00
lukem
82541d904a doc2html works here now, so remove NOHTML=
(not that it worked here, because NOHTML= was provided *after* <bsd.own.mk>...)
2003-07-18 02:18:49 +00:00
wiz
b65146bf4a Bump date for -O change. 2003-07-09 14:42:16 +00:00
simonb
1301238ab7 Add support for gnutar's -O "extract to stdout" option. 2003-07-08 06:00:48 +00:00
christos
d1a05abed1 Revert previous change, and fix the -T problem differently: When the options
of the second argument are exhausted, call the appropriate getopt() routine
to process the rest of the arguments instead of finishing option processing.
Fixes:
	tar cf - -T foo
2003-06-24 16:23:31 +00:00
grant
a47ed375c9 backout previous; it was a missing prototype elsewhere.
noted by mrg.
2003-06-24 08:27:30 +00:00
grant
8560ab3c2b add cast to fix an integer -> pointer warning. 2003-06-24 06:41:51 +00:00
grant
d884498b98 no need for HAVE_LCHOWN and HAVE_LCHMOD anymore. 2003-06-23 13:33:15 +00:00
christos
051ff2c46c Simplify the way we deal with old argument style. Old way was broken when
tar cf - -T dir
2003-06-23 13:15:15 +00:00
christos
6ebfa08f43 spelling 2003-06-23 13:14:43 +00:00
grant
9432809ee1 consistently use "cannot" instead of "can not". 2003-06-23 13:06:53 +00:00
lukem
826a14607a Now that <bsd.prog.mk> DTRT if HOSTPROG is defined (i.e, it is a no-op),
there's no need to special-case .include-ing it.
2003-05-18 07:57:31 +00:00
lukem
17887a5d2c #ifdef HOSTPROG then explicitly use {major,minor,makedev}_netbsd
macros from pack_dev.h instead of the native versions.
Fixes [toolchain/20051] by Valeriy E. Ushakov.
2003-05-09 01:09:13 +00:00
itojun
f703f13276 use sizeof for safety 2003-05-09 00:56:56 +00:00
wiz
dcc13ddb7d Some grammar and punctuation fixes from jmc@openbsd. 2003-05-01 13:50:58 +00:00
christos
d0fa76e947 PR/21253: Manuel Bouyer: cpio should never descend on a directory; even on
the first one.
2003-04-21 22:10:10 +00:00
christos
c59371a05d PR/6195: Matt Watson: Pax fails for paths of exactly 100 characters.
make sure that we don't strlcpy more than the source buffer.
2003-04-20 21:41:52 +00:00
wiz
99193808f4 Bump date for last. 2003-04-16 12:41:36 +00:00
grant
900b115e8d some mdoc fixes. 2003-04-10 06:07:40 +00:00
christos
c8921f6410 PR/21064: Perry Metzger: Re-add -k to tar (--keep-old-files) 2003-04-08 15:13:10 +00:00
wiz
6457ab4776 Remove sentence describing pax's -X option. From Jim Bernard in PR 21009. 2003-04-04 19:19:43 +00:00
christos
051306e25d PR/18959: Xavier HUMBERT: Don't pay attention to sockets in gnu-tar mode. 2003-03-31 20:30:28 +00:00
christos
00e1c042e9 Detect and report end of archive properly ala' gnu tar. 2003-03-31 20:24:52 +00:00
christos
a0dbdefc9c PR/20495: Soren Jacobsen: Add -j [bzip2] compression to tar. 2003-03-31 20:10:08 +00:00
christos
2cdcd6cab2 RP/8227: Peter Seeback: Emulate old gnu tar better. 2003-03-31 20:06:33 +00:00
christos
b399e96d11 No other program prints errors inside angle brackets! 2003-03-04 19:19:25 +00:00
grant
8a22d7d46d call setprogname() 2003-03-03 11:42:36 +00:00
wiz
e04df3a3d6 Add support for '-j' to create (and extract, but -z already did that)
bzip2 compressed tar files, for GNU tar compatibility.
Patch from Soren Jacobsen in PR 19467, okayed by christos.
Sync usage with options while here.
2003-02-25 13:36:59 +00:00
wiz
43c2fa4e77 New sentence, new line. 2003-02-25 13:30:07 +00:00
wiz
990562bfef .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
2003-02-25 10:34:36 +00:00
lukem
68df873854 When writing (-w) or copying (-rw), and using -M (stdin file list is
mtree(8) specfile), compare the "post write/copy" mtime against the
actual "pre write/copy" mtime instead of the mtime from the specfile.

This prevents warnings such as:
	pax: File ./foo was modified during copy to archive
if the file's mtime in the file system is different to what's in the specfile.
(The resultant file will still get the specfile mtime ...)
2003-02-21 01:25:11 +00:00
grant
021cc73e29 add missing braces.
from HIRATSUKA Kouichirou in PR bin/20276.
2003-02-10 07:49:57 +00:00
grant
d1391f9f9d cosmetic error condition improvements.
- sprinkle some fflush() to print filenames correctly.
- print a \n to stdout to fix formatting.
- English, consistently use "Cannot" in error messages.

some whitespace cleanup.
2003-02-09 18:27:10 +00:00
wiz
3ac7ce187d Fix various spelling, grammar, and punctuation problems in comments, from Sergey Svishchev in PR 20164. 2003-02-02 10:21:13 +00:00
simonb
276fd1665c The Double-Semi-Colon Police. 2003-01-20 05:29:53 +00:00