Commit Graph

439 Commits

Author SHA1 Message Date
sjg 2ff6888cf4 Do not throw a usage message for -i followed by -t
since 'cpio -itv' is a valid command.
2010-08-25 21:36:02 +00:00
wiz 9b010439be Use Fl Fl for long options. Remove unnecessary Bk/Ek. 2010-06-19 11:16:31 +00:00
christos 0ac48c3baa add --use-compress-program to pax, requested by mrg. 2010-06-19 00:43:57 +00:00
joerg 22c838d332 Add MKBSDTAR, defaulting to no. It switching cpio and tar to the
libarchive based frontends.
2010-04-23 19:41:02 +00:00
joerg f95fad15ff \\ -> \e 2010-04-05 21:16:21 +00:00
joerg 00e74a9bf1 \\ -> \e 2010-04-05 16:16:53 +00:00
dholland 1021e8e12c bump date for previous 2010-03-23 18:09:16 +00:00
dholland bf1e7b508d The -X option of tar names a file containing exception globs, not
exception filenames, same as in gtar. PR 41168 from Perry.
2010-03-23 17:21:40 +00:00
christos 7b9eb38d5c Remove unnecessary casts. 2009-12-21 12:44:48 +00:00
wiz 8bdb893510 Free pt in another error case.
Found by Henning Petersen using cppcheck, in PR 42488.
2009-12-21 09:17:37 +00:00
dholland c1bd5c1780 Don't use NOGLOB_MTCH for pax, only for tar. Fixes fix for PR 41167 and
closes PR 42301. Since the 41167 fix was pulled up to -5, this needs to
be too.
2009-12-14 05:04:48 +00:00
christos e5882afd65 too many dots. noted by anon-ymous 2009-09-06 13:38:50 +00:00
roy 7027866a09 Rename internal getline() function to get_line() so it does
conflict with the soon to be added getline(3) libc function.
2009-07-13 19:05:39 +00:00
perry a992ea7967 Fixes from christos for pr-41167
XXX -X is still broken, but that wasn't part of this PR.
2009-04-07 19:52:35 +00:00
lukem 990d25a96c fix -Wsign-compare issues 2009-02-14 08:02:04 +00:00
dbj 5ae3d13a2f do not require sys/mtio.h for a tools build of pax 2009-02-03 05:22:40 +00:00
dholland afde5a17cd Don't pass strings from argv[] to free(). Fixes PR 39992. 2008-11-23 10:08:50 +00:00
dholland 23ba00db99 "compatibility", not "compatability". 2008-11-23 09:51:10 +00:00
lukem 2fe2731d3f Remove the \n and tabs from the __COPYRIGHT() strings. 2008-07-20 00:52:39 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
joerg 932c7ae27a Kill pre-4.4BSD compat code. 2008-02-24 20:42:46 +00:00
simonb 9b21141213 Set "ftent" to NULL in in ftree_arg() after we call fts_close(), so that
it isn't used later on in ftree_sel() after it's been free'd.

OK christos@ (and for the interesting test case).
2008-02-18 15:54:48 +00:00
tls cfdef6ecba Teach set_ftime about symbolic links, because it has to know: on some
Linux systems, when we build as a tool we think we have lutimes but it
doesn't work on some filesystems at runtime.  A bit ugly but effective
and without use of AC_TRY_RUN in the tool build.  Tidier (than mine)
set_ftime reorganization from christos.
2008-01-10 04:24:51 +00:00
wiz 861900d761 Fix typo in comment. 2007-12-02 21:36:44 +00:00
wiz 73f0c10536 Minimally sort options; use Dq; new sentence, new line. 2007-12-02 21:14:49 +00:00
wiz 2da3ed1c7d Minimally sort options; use Dq. 2007-12-02 21:13:23 +00:00
hira 5952a904ed - Add -0 and -V to pax_usage().
- Add -k to tar_usage().
2007-10-26 16:38:12 +00:00
hira 82c330f342 Remove extra space from -T option in SYNOPSIS. 2007-10-26 16:35:59 +00:00
lukem db822d2217 Convert to using raise_default_signal(3). 2007-10-05 07:22:23 +00:00
lukem b7fac28c5b In sig_cleanup(), attempt to reset the signal handler to the default
and raise the appropriate signal, so the correct wait status is
returned to the parent.
2007-07-03 10:20:09 +00:00
christos 206f418235 PR/36275: john at iastate dot edu: tar -s modifies symlink targets
- This is explained in a comment in pat_rep.c inside mod_name(). I did not
  want to change the default behavior, so I added another modifier "s" which
  when set, the pattern will not modify the symlink destination.
- While here I fixed another bug that was introduced before by the fix in
  PR/35257 where the renaming was happening twice since we called rep_name
  twice.
- Finally if we are renaming hard of soft-link targets print the renames for
  those too.
2007-05-04 21:19:36 +00:00
msaitoh 8ce1f4fff2 fix typos 2007-04-29 20:23:34 +00:00
christos 135e711f26 bump date. 2007-04-23 18:41:11 +00:00
christos 702d1ca548 PR/36194: Greg A. Woods: add a '-V' flag to pax for verbose summary without
listing (and other minor fixes)
2007-04-23 18:40:22 +00:00
rillig bbe065310a EROFS is not a critical error in a "mkdir -p". 2007-03-08 17:01:30 +00:00
cbiere e977a74585 Fix for PR bin/35432:
* The flags "crtux" are mutually exclusive for tar.
 * The flags "ipt" and "oA" are mutually exclusive for cpio.
2007-01-16 19:06:41 +00:00
bouyer 3697550e70 Don't depend on lubutil if we're building host tools. Fix tools build on
non-NetBSD hosts.
2006-12-16 12:59:16 +00:00
christos d9cd708017 PR/35257: Andreas Gustafsson: tar(1) opens excluded files
Apply the file modification function in the input files so that we can
de-select matched patterns.
2006-12-14 23:18:11 +00:00
he 0a97c3f688 Complete the move of string_to_flags() and flags_to_string() from the
bin/ls sources to libutil:
 o Bump libutil minor version number
 o Fix uses to include <util.h> to pick up the function definitions
 o Fix most uses of flags_to_string() to release the now-malloc()ed result
2006-12-14 20:09:35 +00:00
christos 3d98aa3f4b fix spelling of accidentally; from Zapher 2006-11-24 19:37:02 +00:00
christos 573bd5e5dd add missing inititializer 2006-10-16 00:11:22 +00:00
elad ed23b39f46 PR/34265: dieter roelants: pax truncates archive when appending fails.
Patch applied, thanks!
2006-10-07 09:53:20 +00:00
christos 06cdcd1106 PR/34255: dieter roelants: Remove mention of -p f. 2006-08-22 17:42:19 +00:00
snj a640fe8c43 It's "its." 2006-04-24 19:00:29 +00:00
christos c5d25686e0 PR/22995: Sergey Svishchev: If we are cd'ing around and we have directories
with relative paths, convert the directories to absolute paths, so that
restoring timestamps does not fail.
2006-04-16 16:20:21 +00:00
christos 6236eeb27a Don't free str; it is used in pat_add. Noted by: Kouichirou Hiratsuka 2006-04-14 16:57:01 +00:00
christos a8846ec5ac Coverity CID 2734, 2731: Use after free; resource leak 2006-03-19 19:06:39 +00:00
christos ee17e957e3 Coverity CID 343: Rework code so that we don't write after the end of the
array. The end effect is the same though.
2006-03-18 05:43:47 +00:00
christos 2ed09657c9 Coverity CID 345: Add missing free's. 2006-03-18 05:40:28 +00:00
dsl b419a25464 Ensure we exit with an error if we don't actually do anything.
There are a lot of tty_warn(0,...) and syswarn(0,...) which probably ought
to be tty_warn/syswarn(1,...) to force an error exit.  However some are
used in interactive parts (eg opening a continuation archive) where there
is a separate retry loop.
So we just pass a failure code out to main() - how quaint!
This should now cause the NetBSD build to fail when gzip tries to write
to a non-existant directory.
(I suspect there are still many errors that don't get reported correctly.)
2006-02-11 11:04:57 +00:00
dsl cdec4ac10c Change all the 'return(x)' to 'return c'.
Makes some other searches I want to do a bit easier.
2006-02-11 10:43:17 +00:00
dsl 885e558785 Actually exit with error if we cannot open("."), make it more obvious that
we exit with error on signals.
2006-02-11 10:35:19 +00:00
christos ef3fea8531 Solaris mkdir on an automounted component returns ENOSYS. Go figure.
Good choices whould have been EROFS, EEXIST, EACCES, EISDIR...
2006-01-31 19:25:20 +00:00
yamt d2169f9f6e obey umask as it used to be before the "mkstemp and then rename" change. 2006-01-04 22:02:11 +00:00
christos d0d28f16f5 If we get EACCES from mkdir, try to stat() it, and if it is ok, we keep going.
Fixes problem with IRIX.
2005-12-06 19:11:15 +00:00
christos c952ef6b81 PR/31923: Sergey Svishchev: pax-as-tar ignores -k, overwrites existing files
Fix from Onno van der Linden
2005-11-01 23:43:27 +00:00
dsl 469d38dbae Don't leave arcn->org_name pointing to ftent->fts_path, if we being cpio
then ftent is freed just below.  Take a copy of the name and point org_name
at the copy.
Should fix PR/30627 (the fix in the PR will break pax and tar!)
2005-09-24 17:05:21 +00:00
christos 88ee54d8c2 Check for another race reported by chuq. 2005-09-18 12:15:41 +00:00
christos b39d90de0c mkdir(2) can return EISDIR for / 2005-09-17 06:05:04 +00:00
christos 5b36787563 spelling fixes from Joerg Sonnenberger 2005-09-16 17:05:14 +00:00
christos b60b306ef2 Another missing mkdir() race pointed out by chuq. Factor out the mkdir code. 2005-09-16 16:48:18 +00:00
christos 0743a9e845 use stat and not lstat to detect if we have a directory. refactor the mkpath()
code.
2005-09-13 20:09:55 +00:00
christos 929821126f when creating directories, check if the failure occured because someone
else created the directory before we did to avoid races. From chuq.
2005-09-13 15:50:17 +00:00
wiz 49c862f011 Use better section header. Sort sections. From YOMURA Masanori in private mail. 2005-09-11 23:21:17 +00:00
wiz 553e3c8477 Use better section header. From YOMURA Masanori in private mail. 2005-09-11 23:13:03 +00:00
christos d7df71ba0e Don't compile in cpio usage, if we are SMALL. 2005-06-29 02:21:27 +00:00
christos 6310b59691 sprinkle a little const, and now everything compiles with WARNS=3 2005-06-26 19:10:48 +00:00
chs 7bbdd188e1 appease gcc -Wuninitialized on hp700. 2005-06-05 19:08:28 +00:00
lukem aab85a0fd4 appease gcc -Wuninitialized 2005-06-01 15:25:51 +00:00
wiz 6599ec1bca Bump date for -no-recursion. 2005-05-24 00:05:01 +00:00
christos 4e0ae89b44 Don't even declare fdochroot() if we are in tool mode. 2005-05-22 17:41:50 +00:00
christos a1484a9949 be more lenient on the comparison to argv[0] to determine our personality. 2005-05-15 02:04:30 +00:00
christos 398a081644 Allow writing symlinks that point outside our tree, but not traversing
them to write other files.
2005-05-14 18:49:51 +00:00
christos 8dcba5679e PR/30167: J.T. Conklin: NetBSD tar does not support GNU tar --no-recursion flag 2005-05-07 22:27:33 +00:00
jmc 6ae4f78197 Wrap call to fchroot in CONFIG tests so this doesn't blow up on cross-tools 2005-05-06 16:49:25 +00:00
christos 0a6f2d385f PR/30132: Juan RP: tar --chroot refuses to extract files.
fchroot() changes the effective path, so we need to call updatepath().
2005-05-05 14:54:49 +00:00
christos 33cefcde7e PR/29005: Jesse Off: nbpax requires sys/mtio.h which doesn't exist on Interix
I added an ifdef called HAVE_MTIO_H and fixed the code to use it. It is
always defined now, but you can change this for Interix.
2005-05-01 02:59:28 +00:00
christos 13d863367b Pax longopts were not empty element terminated. 2005-04-24 03:39:26 +00:00
christos 14f615efd9 If we cannot resolve a path, that probably means that we have not created
directories for that path yet. So, do the check for each component recursively
and succeed if none of the components fall outside our current working
directory.
2005-04-24 03:36:54 +00:00
christos bc5cd54e43 PR/20228: Simon Burge: pax has problems reading a particular cpio archive
The problem here is that the archive is too short (< 512 bytes). The
buffer routines, try to read at least 512 bytes, even when we try to determine
what format file we have, which is wrong.
2005-04-24 03:26:03 +00:00
christos 15ea30eb09 PR/18759: FUKAUMI Naoki: pax/tar dot-dot handling broken
PR/18840: Frederick Bruckman:  Fix for PR/18663 incomplete pax symlink handling

This patch makes ``--insecure'' do something. Now if ``--insecure''
is not set (the default) we do a realpath(3) in all the pathnames
that we are trying to create and if either realpath fails, or the
path is outside our working directory, we print a warning and die.
This maybe too strict and might fail on valid archives that create
symlinks and directories in the wrong order.
2005-04-24 01:45:03 +00:00
christos 06a1f6e7f2 For clarity instead of using -1 and -2 use the negative of the archive type. 2005-04-24 01:24:57 +00:00
christos 71c0f67846 PR/20071: Perry Metzger: --extract handling is broken. This patch fixes
Perry's example.
2005-04-24 01:23:21 +00:00
christos 128abffcbe The quagga-0.98.2 tar archive is busted. It was created with an old tar
program, and then someone appended to it a ustar record. Detect this and
warn, but don't treat it as an error.
2005-02-20 07:35:47 +00:00
jmc 4dca8bd51e Fix from PR#29290. Properly terminate the cpio_longopts struct so an unknown
option doesn't run off the end and core dump
2005-02-10 17:48:33 +00:00
matt f57592cd95 Don't write hardlinked file contents in sv4cpio mode. 2005-02-04 00:38:15 +00:00
jmc 94eaa31771 Apply user supplied patterns first before applying actions for -A. This way pax
behavior WRT to patterns lines up with the example in the documentation
and how other implementations do it as well since -A is a non-standard
option/behavior. Fixes items noted in PR#23776
2005-01-23 06:19:03 +00:00
dsl 3b8851c887 Check for *ptr == 0, not ptr == NULL twice when validating -s xxxxx in tar mode.
Fixes PR bin/29040
Also actually report an error to the tty if NET2_REGEX is defined.
2005-01-21 20:23:44 +00:00
tron addf1a0f97 Fix broken cpio(1) option handling:
- "cpio -i -t" should list the contents of a file, not extract it.
- Don't extract a file when only option "-d" is given.
Patch supplied by Paul Ripke in PR bin/26513.
2004-10-26 16:11:49 +00:00
jmc 79308267d4 For HOSTTOOL builds, just exclude the chroot support as it's not needed and
avoids having to platform check for fchroot(). Fixes PR#27336
2004-10-22 21:00:18 +00:00
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