pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/archivers/pax Update pax to 20051108. The previous ve...
details: https://anonhg.NetBSD.org/pkgsrc/rev/d8eea1f18dd8
branches: trunk
changeset: 503828:d8eea1f18dd8
user: minskim <minskim%pkgsrc.org@localhost>
date: Thu Dec 01 03:00:01 2005 +0000
description:
Update pax to 20051108. The previous version failed to handle the -X
option, which is used in print/teTeX3-texmf. The only difference from
the pax in src is that tar does not support the --chroot option if
fchroot(2) is not available.
Major changes and bug fixes since 20040802:
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.
PR/31923: Sergey Svishchev: pax-as-tar ignores -k, overwrites existing files
Fix from Onno van der Linden
PR/30132: Juan RP: tar --chroot refuses to extract files.
fchroot() changes the effective path, so we need to call updatepath().
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
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.
PR/27213: Greg A. Woods: pax doesn't honour SIGPIPE when listing
But always exit, not just on SIGPIPE.
Properly handle "cpio" archives where the last hardlink includes the
data of a file. This fixes PR bin/26514.
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.
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!)
PR/30167: J.T. Conklin: NetBSD tar does not support GNU tar --no-recursion flag
Fix from PR#29290. Properly terminate the cpio_longopts struct so an unknown
option doesn't run off the end and core dump
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.
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.
PR/19490: Julio Merino: Teach tar about --sparse, -S option.
Do it for cpio too.
PR/27208: Greg A. Woods: pax must call options() before using syswarn()
or tty_warn()
PR/20071: Perry Metzger: --extract handling is broken. This patch fixes
Perry's example.
diffstat:
archivers/pax/Makefile | 4 +-
archivers/pax/files/Makefile.in | 6 +-
archivers/pax/files/ar_io.c | 53 ++++----
archivers/pax/files/ar_subs.c | 217 ++++++++++++++++++++++++++++++++------
archivers/pax/files/buf_subs.c | 11 +-
archivers/pax/files/config.h.in | 3 +
archivers/pax/files/configure | 3 +-
archivers/pax/files/configure.ac | 2 +-
archivers/pax/files/cpio.1 | 9 +-
archivers/pax/files/cpio.c | 7 +-
archivers/pax/files/extern.h | 18 ++-
archivers/pax/files/file_subs.c | 97 ++++++++++++----
archivers/pax/files/ftree.c | 7 +-
archivers/pax/files/getoldopt.c | 5 +-
archivers/pax/files/options.c | 122 ++++++++++++++++-----
archivers/pax/files/pat_rep.c | 79 +++++++------
archivers/pax/files/pax.1 | 92 ++++++++--------
archivers/pax/files/pax.c | 26 ++-
archivers/pax/files/pax.h | 3 +-
archivers/pax/files/tables.c | 8 +-
archivers/pax/files/tables.h | 4 +-
archivers/pax/files/tar.1 | 27 +++-
archivers/pax/files/tar.c | 93 ++++++++++-----
archivers/pax/files/tty_subs.c | 8 +-
24 files changed, 607 insertions(+), 297 deletions(-)
diffs (truncated from 2129 to 300 lines):
diff -r 8cde420e4f5e -r d8eea1f18dd8 archivers/pax/Makefile
--- a/archivers/pax/Makefile Thu Dec 01 01:45:54 2005 +0000
+++ b/archivers/pax/Makefile Thu Dec 01 03:00:01 2005 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.20 2005/05/31 21:39:29 rillig Exp $
+# $NetBSD: Makefile,v 1.21 2005/12/01 03:00:01 minskim Exp $
#
-DISTNAME= pax-20040802
+DISTNAME= pax-20051108
CATEGORIES= archivers pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
diff -r 8cde420e4f5e -r d8eea1f18dd8 archivers/pax/files/Makefile.in
--- a/archivers/pax/files/Makefile.in Thu Dec 01 01:45:54 2005 +0000
+++ b/archivers/pax/files/Makefile.in Thu Dec 01 03:00:01 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.in,v 1.8 2004/08/21 06:33:39 jlam Exp $
+# $NetBSD: Makefile.in,v 1.9 2005/12/01 03:00:01 minskim Exp $
srcdir= @srcdir@
@@ -22,10 +22,10 @@
PROG= pax
-OBJS= ar_io.o ar_subs.o buf_subs.o cpio.o file_subs.o ftree.o \
+OBJS= ar_io.o ar_subs.o buf_subs.o file_subs.o ftree.o \
gen_subs.o getoldopt.o options.o pat_rep.o pax.o sel_subs.o tables.o \
tar.o tty_subs.o \
- getid.o spec.o misc.o stat_flags.o pack_dev.o
+ getid.o spec.o misc.o stat_flags.o pack_dev.o cpio.o
all: $(PROG)
diff -r 8cde420e4f5e -r d8eea1f18dd8 archivers/pax/files/ar_io.c
--- a/archivers/pax/files/ar_io.c Thu Dec 01 01:45:54 2005 +0000
+++ b/archivers/pax/files/ar_io.c Thu Dec 01 03:00:01 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ar_io.c,v 1.8 2004/08/21 03:28:56 jlam Exp $ */
+/* $NetBSD: ar_io.c,v 1.9 2005/12/01 03:00:01 minskim Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -48,13 +48,16 @@
#if 0
static char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94";
#else
-__RCSID("$NetBSD: ar_io.c,v 1.8 2004/08/21 03:28:56 jlam Exp $");
+__RCSID("$NetBSD: ar_io.c,v 1.9 2005/12/01 03:00:01 minskim Exp $");
#endif
#endif /* not lint */
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -71,9 +74,6 @@
#if HAVE_SYS_MTIO_H
#include <sys/mtio.h>
#endif
-#if HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
@@ -238,10 +238,8 @@
return(-1);
if (chdname != NULL)
- if (chdir(chdname) != 0) {
- syswarn(1, errno, "Failed chdir to %s", chdname);
+ if (dochdir(chdname) == -1)
return(-1);
- }
/*
* set up is based on device type
*/
@@ -261,13 +259,14 @@
return(-1);
}
- if (S_ISCHR(arsb.st_mode))
+ if (S_ISCHR(arsb.st_mode)) {
#ifdef SUPPORT_TAPE
artyp = ioctl(arfd, MTIOCGET, &mb) ? ISCHR : ISTAPE;
#else
- artyp = ISCHR;
+ tty_warn(1, "System does not have tape support");
+ artyp = ISREG;
#endif /* SUPPORT_TAPE */
- else if (S_ISBLK(arsb.st_mode))
+ } else if (S_ISBLK(arsb.st_mode))
artyp = ISBLK;
else if ((lseek(arfd, (off_t)0L, SEEK_CUR) == -1) && (errno == ESPIPE))
artyp = ISPIPE;
@@ -1025,8 +1024,8 @@
#ifdef SUPPORT_RMT
case ISRMT:
#endif /* SUPPORT_RMT */
+ case ISTAPE:
#ifdef SUPPORT_TAPE
- case ISTAPE:
/*
* if the last i/o was a successful data transfer, we assume
* the fault is just a bad record on the tape that we are now
@@ -1054,8 +1053,10 @@
}
#endif /* SUPPORT_RMT */
lstrval = 1;
+#else
+ tty_warn(1, "System does not have tape support");
+#endif /* SUPPORT_TAPE */
break;
-#endif /* SUPPORT_TAPE */
case ISREG:
case ISCHR:
case ISBLK:
@@ -1172,9 +1173,9 @@
{
off_t cpos;
#ifdef SUPPORT_TAPE
+ int phyblk;
struct mtop mb;
#endif /* SUPPORT_TAPE */
- int phyblk;
/*
* make sure we do not have try to reverse on a flawed archive
@@ -1238,11 +1239,11 @@
return(-1);
}
break;
-#ifdef SUPPORT_TAPE
case ISTAPE:
#ifdef SUPPORT_RMT
case ISRMT:
#endif /* SUPPORT_RMT */
+#ifdef SUPPORT_TAPE
/*
* Calculate and move the proper number of PHYSICAL tape
* blocks. If the sksz is not an even multiple of the physical
@@ -1295,8 +1296,10 @@
lstrval = -1;
return(-1);
}
+#else
+ tty_warn(1, "System does not have tape support");
+#endif /* SUPPORT_TAPE */
break;
-#endif /* SUPPORT_TAPE */
}
lstrval = 1;
return(0);
@@ -1781,16 +1784,12 @@
*/
int
-ar_dochdir(char *name)
+ar_dochdir(const char *name)
{
- /* First fchdir() back... */
- if (fchdir(cwdfd) < 0) {
- syswarn(1, errno, "Can't fchdir to starting directory");
- return(-1);
- }
- if (chdir(name) < 0) {
- syswarn(1, errno, "Can't chdir to %s", name);
- return(-1);
- }
- return (0);
+ /* First fdochdir() back... */
+ if (fdochdir(cwdfd) == -1)
+ return -1;
+ if (dochdir(name) == -1)
+ return -1;
+ return 0;
}
diff -r 8cde420e4f5e -r d8eea1f18dd8 archivers/pax/files/ar_subs.c
--- a/archivers/pax/files/ar_subs.c Thu Dec 01 01:45:54 2005 +0000
+++ b/archivers/pax/files/ar_subs.c Thu Dec 01 03:00:01 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ar_subs.c,v 1.7 2004/08/21 03:28:56 jlam Exp $ */
+/* $NetBSD: ar_subs.c,v 1.8 2005/12/01 03:00:01 minskim Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -48,7 +48,7 @@
#if 0
static char sccsid[] = "@(#)ar_subs.c 8.2 (Berkeley) 4/18/94";
#else
-__RCSID("$NetBSD: ar_subs.c,v 1.7 2004/08/21 03:28:56 jlam Exp $");
+__RCSID("$NetBSD: ar_subs.c,v 1.8 2005/12/01 03:00:01 minskim Exp $");
#endif
#endif /* not lint */
@@ -94,9 +94,15 @@
#include "pax.h"
#include "extern.h"
+static int path_check(ARCHD *, int);
static void wr_archive(ARCHD *, int is_app);
static int get_arc(void);
static int next_head(ARCHD *);
+#if !HAVE_NBTOOL_CONFIG_H
+#ifdef HAVE_FCHROOT
+static int fdochroot(int);
+#endif /* HAVE_FCHROOT */
+#endif
extern sigset_t s_mask;
/*
@@ -108,6 +114,110 @@
u_long flcnt; /* number of files processed */
ARCHD archd;
+static char cwdpath[MAXPATHLEN]; /* current working directory path */
+static size_t cwdpathlen; /* current working directory path len */
+
+int
+updatepath(void)
+{
+ if (getcwd(cwdpath, sizeof(cwdpath)) == NULL) {
+ syswarn(1, errno, "Cannot get working directory");
+ return -1;
+ }
+ cwdpathlen = strlen(cwdpath);
+ return 0;
+}
+
+int
+fdochdir(int fcwd)
+{
+ if (fchdir(fcwd) == -1) {
+ syswarn(1, errno, "Cannot chdir to `.'");
+ return -1;
+ }
+ return updatepath();
+}
+
+int
+dochdir(const char *name)
+{
+ if (chdir(name) == -1)
+ syswarn(1, errno, "Cannot chdir to `%s'", name);
+ return updatepath();
+}
+
+#if !HAVE_NBTOOL_CONFIG_H
+#ifdef HAVE_FCHROOT
+static int
+fdochroot(int fcwd)
+{
+ if (fchroot(fcwd) != 0) {
+ syswarn(1, errno, "Can't fchroot to \".\"");
+ return -1;
+ }
+ return updatepath();
+}
+#endif /* HAVE_FCHROOT */
+#endif
+
+/*
+ * mkdir(), but if we failed, check if someone else made it for us
+ * already and don't error out.
+ */
+int
+domkdir(const char *fname, mode_t mode)
+{
+ int error;
+ struct stat sb;
+
+ if ((error = mkdir(fname, mode)) != -1)
+ return error;
+
+ switch (errno) {
+ case EISDIR:
+ return 0;
+ case EEXIST:
+ error = errno;
+ if (stat(fname, &sb) != -1 && S_ISDIR(sb.st_mode))
+ return 0;
+ errno = error;
+ /*FALLTHROUGH*/
+ default:
+ return -1;
+ }
+}
+
+static int
+path_check(ARCHD *arcn, int level)
+{
+ char buf[MAXPATHLEN];
+ char *p;
Home |
Main Index |
Thread Index |
Old Index