summaryrefslogtreecommitdiff
path: root/archivers/pax
diff options
context:
space:
mode:
authorgrant <grant>2004-06-20 10:11:02 +0000
committergrant <grant>2004-06-20 10:11:02 +0000
commit5d8d839fd1773b82acf3d91fbeac32f4182b0e1d (patch)
treef9c858d2de9d00c5081bc44b82732c33a633d50a /archivers/pax
parente3b56a50c884c5ef94c6bfc933b6a480b757c717 (diff)
downloadpkgsrc-5d8d839fd1773b82acf3d91fbeac32f4182b0e1d.tar.gz
sync pax with src/ from 20040620, includes many bug fixes including
properly handling broken archives.
Diffstat (limited to 'archivers/pax')
-rw-r--r--archivers/pax/files/ar_io.c23
-rw-r--r--archivers/pax/files/ar_subs.c8
-rw-r--r--archivers/pax/files/buf_subs.c6
-rw-r--r--archivers/pax/files/cpio.16
-rw-r--r--archivers/pax/files/cpio.cat14
-rw-r--r--archivers/pax/files/extern.h6
-rw-r--r--archivers/pax/files/file_subs.c123
-rw-r--r--archivers/pax/files/ftree.c27
-rw-r--r--archivers/pax/files/options.c36
-rw-r--r--archivers/pax/files/options.h4
-rw-r--r--archivers/pax/files/pax.113
-rw-r--r--archivers/pax/files/pax.c15
-rw-r--r--archivers/pax/files/pax.cat115
-rw-r--r--archivers/pax/files/pax.h5
-rw-r--r--archivers/pax/files/tar.110
-rw-r--r--archivers/pax/files/tar.c149
-rw-r--r--archivers/pax/files/tar.cat16
-rw-r--r--archivers/pax/files/tar.h14
18 files changed, 291 insertions, 179 deletions
diff --git a/archivers/pax/files/ar_io.c b/archivers/pax/files/ar_io.c
index 4655fdc17d1..5fb14032fd4 100644
--- a/archivers/pax/files/ar_io.c
+++ b/archivers/pax/files/ar_io.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ar_io.c,v 1.6 2004/03/11 20:10:29 tv Exp $ */
+/* $NetBSD: ar_io.c,v 1.7 2004/06/20 10:11:02 grant Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -44,7 +44,7 @@
#if 0
static char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94";
#else
-__RCSID("$NetBSD: ar_io.c,v 1.6 2004/03/11 20:10:29 tv Exp $");
+__RCSID("$NetBSD: ar_io.c,v 1.7 2004/06/20 10:11:02 grant Exp $");
#endif
#endif /* not lint */
@@ -115,8 +115,9 @@ __RCSID("$NetBSD: ar_io.c,v 1.6 2004/03/11 20:10:29 tv Exp $");
#define EXT_MODE O_RDONLY /* open mode for list/extract */
#define AR_MODE (O_WRONLY | O_CREAT | O_TRUNC) /* mode for archive */
#define APP_MODE O_RDWR /* mode for append */
-#define STDO "<STDOUT>" /* pseudo name for stdout */
-#define STDN "<STDIN>" /* pseudo name for stdin */
+static char STDO[] = "<STDOUT>"; /* pseudo name for stdout */
+static char STDN[] = "<STDIN>"; /* pseudo name for stdin */
+static char NONE[] = "<NONE>"; /* pseudo name for none */
static int arfd = -1; /* archive file descriptor */
static int artyp = ISREG; /* archive type: file/FIFO/tape */
static int arvol = 1; /* archive volume number */
@@ -225,7 +226,7 @@ ar_open(const char *name)
/*
* arfd not used in COPY mode
*/
- arcname = "<NONE>";
+ arcname = NONE;
lstrval = 1;
return(0);
}
@@ -1464,7 +1465,7 @@ int
ar_next(void)
{
char buf[PAXPATHLEN+2];
- static int freeit = 0;
+ static char *arcfree = NULL;
sigset_t o_mask;
/*
@@ -1596,17 +1597,17 @@ ar_next(void)
* try to open new archive
*/
if (ar_open(buf) >= 0) {
- if (freeit) {
- (void)free((char *)arcname);
- freeit = 0;
+ if (arcfree) {
+ (void)free(arcfree);
+ arcfree = NULL;
}
- if ((arcname = strdup(buf)) == NULL) {
+ if ((arcfree = strdup(buf)) == NULL) {
done = 1;
lstrval = -1;
tty_warn(0, "Cannot save archive name.");
return(-1);
}
- freeit = 1;
+ arcname = arcfree;
break;
}
tty_prnt("Cannot open %s, try again\n", buf);
diff --git a/archivers/pax/files/ar_subs.c b/archivers/pax/files/ar_subs.c
index b23fe219e4f..b9071577b1a 100644
--- a/archivers/pax/files/ar_subs.c
+++ b/archivers/pax/files/ar_subs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ar_subs.c,v 1.5 2003/12/20 04:45:04 grant Exp $ */
+/* $NetBSD: ar_subs.c,v 1.6 2004/06/20 10:11:02 grant Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -44,7 +44,7 @@
#if 0
static char sccsid[] = "@(#)ar_subs.c 8.2 (Berkeley) 4/18/94";
#else
-__RCSID("$NetBSD: ar_subs.c,v 1.5 2003/12/20 04:45:04 grant Exp $");
+__RCSID("$NetBSD: ar_subs.c,v 1.6 2004/06/20 10:11:02 grant Exp $");
#endif
#endif /* not lint */
@@ -141,7 +141,7 @@ list(void)
*/
off_t cnt;
if (!(*frmt->rd_data)(arcn, arcn->type == PAX_GLF
- ? -1 : -2, &cnt));
+ ? -1 : -2, &cnt))
(void)rd_skip(cnt + arcn->pad);
continue;
}
@@ -235,7 +235,7 @@ extract(void)
* we need to read, to get the real filename
*/
if (!(*frmt->rd_data)(arcn, arcn->type == PAX_GLF
- ? -1 : -2, &cnt));
+ ? -1 : -2, &cnt))
(void)rd_skip(cnt + arcn->pad);
continue;
}
diff --git a/archivers/pax/files/buf_subs.c b/archivers/pax/files/buf_subs.c
index 77f9e9812b8..9351637a036 100644
--- a/archivers/pax/files/buf_subs.c
+++ b/archivers/pax/files/buf_subs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: buf_subs.c,v 1.3 2003/12/20 04:45:04 grant Exp $ */
+/* $NetBSD: buf_subs.c,v 1.4 2004/06/20 10:11:02 grant Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -44,7 +44,7 @@
#if 0
static char sccsid[] = "@(#)buf_subs.c 8.2 (Berkeley) 4/18/94";
#else
-__RCSID("$NetBSD: buf_subs.c,v 1.3 2003/12/20 04:45:04 grant Exp $");
+__RCSID("$NetBSD: buf_subs.c,v 1.4 2004/06/20 10:11:02 grant Exp $");
#endif
#endif /* not lint */
@@ -718,7 +718,7 @@ rd_wrfile(ARCHD *arcn, int ofd, off_t *left)
* pass the blocksize of the file being written to the write routine,
* if the size is zero, use the default MINFBSZ
*/
- if (ofd == -1)
+ if (ofd < 0)
sz = PAXPATHLEN+1;
else if (fstat(ofd, &sb) == 0) {
if (sb.st_blksize > 0)
diff --git a/archivers/pax/files/cpio.1 b/archivers/pax/files/cpio.1
index 73a9cbfa7ae..c17e6a5df6c 100644
--- a/archivers/pax/files/cpio.1
+++ b/archivers/pax/files/cpio.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: cpio.1,v 1.1.1.1 2003/06/23 11:46:09 grant Exp $
+.\" $NetBSD: cpio.1,v 1.2 2004/06/20 10:11:02 grant Exp $
.\"
.\" Copyright (c) 1997 SigmaSoft, Th. Lockert
.\" All rights reserved.
@@ -30,7 +30,7 @@
.\"
.\" OpenBSD: cpio.1,v 1.14 2000/11/10 17:52:02 aaron Exp
.\"
-.Dd February 16, 1997
+.Dd February 13, 2004
.Dt CPIO 1
.Os
.Sh NAME
@@ -157,7 +157,7 @@ restore.
.It Fl E Ar file , Fl -pattern-file Ar file
Read list of file name patterns to extract or list from
.Ar file .
-.It Fl f , -nonmathing
+.It Fl f , -nonmatching
Restore all files except those matching the
.Ar patterns
given on the command line.
diff --git a/archivers/pax/files/cpio.cat1 b/archivers/pax/files/cpio.cat1
index 4300cf5f04a..e0e1e2fafe6 100644
--- a/archivers/pax/files/cpio.cat1
+++ b/archivers/pax/files/cpio.cat1
@@ -85,7 +85,7 @@ DDEESSCCRRIIPPTTIIOONN
Read list of file name patterns to extract or list from
_f_i_l_e.
- --ff, ----nnoonnmmaatthhiinngg
+ --ff, ----nnoonnmmaattcchhiinngg
Restore all files except those matching the _p_a_t_t_e_r_n_s
given on the command line.
@@ -203,4 +203,4 @@ AAUUTTHHOORRSS
BBUUGGSS
The --ss and --SS options are currently not implemented.
-NetBSD 1.6 February 16, 1997 NetBSD 1.6
+NetBSD 2.0 February 13, 2004 NetBSD 2.0
diff --git a/archivers/pax/files/extern.h b/archivers/pax/files/extern.h
index c3e476ea662..66fb75a8742 100644
--- a/archivers/pax/files/extern.h
+++ b/archivers/pax/files/extern.h
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.4 2003/12/20 04:45:04 grant Exp $ */
+/* $NetBSD: extern.h,v 1.5 2004/06/20 10:11:02 grant Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -151,6 +151,7 @@ int bcpio_wr(ARCHD *);
* file_subs.c
*/
extern char *gnu_name_string, *gnu_link_string;
+extern char *xtmp_name;
int file_creat(ARCHD *);
void file_close(ARCHD *, int);
int lnk_creat(ARCHD *);
@@ -202,6 +203,7 @@ int getoldopt(int, char **, const char *, struct option *, int *);
*/
extern FSUB fsub[];
extern int ford[];
+extern int sep;
void options(int, char **);
OPLIST * opt_next(void);
int opt_add(const char *);
@@ -258,7 +260,7 @@ extern int docrc;
extern int to_stdout;
extern char *dirptr;
extern char *ltmfrmt;
-extern char *argv0;
+extern const char *argv0;
extern FILE *listf;
extern char *tempfile;
extern char *tempbase;
diff --git a/archivers/pax/files/file_subs.c b/archivers/pax/files/file_subs.c
index e5012a588a3..f321ae76ae4 100644
--- a/archivers/pax/files/file_subs.c
+++ b/archivers/pax/files/file_subs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: file_subs.c,v 1.4 2003/12/20 04:45:04 grant Exp $ */
+/* $NetBSD: file_subs.c,v 1.5 2004/06/20 10:11:02 grant Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -44,7 +44,7 @@
#if 0
static char sccsid[] = "@(#)file_subs.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: file_subs.c,v 1.4 2003/12/20 04:45:04 grant Exp $");
+__RCSID("$NetBSD: file_subs.c,v 1.5 2004/06/20 10:11:02 grant Exp $");
#endif
#endif /* not lint */
@@ -88,17 +88,27 @@ __RCSID("$NetBSD: file_subs.c,v 1.4 2003/12/20 04:45:04 grant Exp $");
#include "extern.h"
#include "options.h"
+char *xtmp_name;
+
static int
mk_link(char *,struct stat *,char *, int);
+static int warn_broken;
+
/*
* routines that deal with file operations such as: creating, removing;
* and setting access modes, uid/gid and times of files
*/
+#define SET_BITS (S_ISUID | S_ISGID)
+#define FILE_BITS (S_IRWXU | S_IRWXG | S_IRWXO)
+#define A_BITS (FILE_BITS | SET_BITS | S_ISVTX)
-#define FILEBITS (S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
-#define SETBITS (S_ISUID | S_ISGID)
-#define ABITS (FILEBITS | SETBITS)
+/*
+ * The S_ISVTX (sticky bit) can be set by non-superuser on directories
+ * but not other kinds of files.
+ */
+#define FILEBITS(dir) ((dir) ? (FILE_BITS | S_ISVTX) : FILE_BITS)
+#define SETBITS(dir) ((dir) ? SET_BITS : (SET_BITS | S_ISVTX))
/*
* file_creat()
@@ -111,46 +121,55 @@ int
file_creat(ARCHD *arcn)
{
int fd = -1;
- mode_t file_mode;
int oerrno;
/*
- * assume file doesn't exist, so just try to create it, most times this
- * works. We have to take special handling when the file does exist. To
- * detect this, we use O_EXCL. For example when trying to create a
- * file and a character device or fifo exists with the same name, we
- * can accidently open the device by mistake (or block waiting to open)
- * If we find that the open has failed, then spend the effort to
- * figure out why. This strategy was found to have better average
- * performance in common use than checking the file (and the path)
- * first with lstat.
+ * Some horribly busted tar implementations, have directory nodes
+ * that end in a /, but they mark as files. Compensate for that
+ * by not creating a directory node at this point, but a file node,
+ * and not creating the temp file.
*/
- file_mode = arcn->sb.st_mode & FILEBITS;
- if ((fd = open(arcn->name, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL,
- file_mode)) >= 0)
- return(fd);
-
+ if (arcn->nlen != 0 && arcn->name[arcn->nlen - 1] == '/') {
+ if (!warn_broken) {
+ tty_warn(0, "Archive was created with a broken tar;"
+ " file `%s' is a directory, but marked as plain.",
+ arcn->name);
+ warn_broken = 1;
+ }
+ return -1;
+ }
/*
- * the file seems to exist. First we try to get rid of it (found to be
- * the second most common failure when traced). If this fails, only
- * then we go to the expense to check and create the path to the file
+ * Create a temporary file name so that the file doesn't have partial
+ * contents while restoring.
*/
- if (unlnk_exist(arcn->name, arcn->type) != 0)
+ arcn->tmp_name = malloc(arcn->nlen + 8);
+ if (arcn->tmp_name == NULL) {
+ syswarn(1, errno, "Cannot malloc %d bytes", arcn->nlen + 8);
return(-1);
+ }
+ if (xtmp_name)
+ abort();
+ xtmp_name = arcn->tmp_name;
for (;;) {
/*
- * try to open it again, if this fails, check all the nodes in
- * the path and give it a final try. if chk_path() finds that
- * it cannot fix anything, we will skip the last attempt
+ * try to create the temporary file we use to restore the
+ * contents info. if this fails, keep checking all the nodes
+ * in the path until chk_path() finds that it cannot fix
+ * anything further. if that happens we just give up.
*/
- if ((fd = open(arcn->name, O_WRONLY | O_CREAT | O_TRUNC,
- file_mode)) >= 0)
+ (void)snprintf(arcn->tmp_name, arcn->nlen + 8, "%s.XXXXXX",
+ arcn->name);
+ fd = mkstemp(arcn->tmp_name);
+ if (fd >= 0)
break;
oerrno = errno;
if (nodirs || chk_path(arcn->name,arcn->sb.st_uid,arcn->sb.st_gid) < 0) {
(void)fflush(listf);
- syswarn(1, oerrno, "Cannot create %s", arcn->name);
+ syswarn(1, oerrno, "Cannot create %s", arcn->tmp_name);
+ xtmp_name = NULL;
+ free(arcn->tmp_name);
+ arcn->tmp_name = NULL;
return(-1);
}
}
@@ -174,7 +193,7 @@ file_close(ARCHD *arcn, int fd)
return;
if (close(fd) < 0)
syswarn(0, errno, "Cannot close file descriptor on %s",
- arcn->name);
+ arcn->tmp_name);
/*
* set owner/groups first as this may strip off mode bits we want
@@ -182,23 +201,39 @@ file_close(ARCHD *arcn, int fd)
* modification times.
*/
if (pids)
- res = set_ids(arcn->name, arcn->sb.st_uid, arcn->sb.st_gid);
+ res = set_ids(arcn->tmp_name, arcn->sb.st_uid, arcn->sb.st_gid);
/*
* IMPORTANT SECURITY NOTE:
* if not preserving mode or we cannot set uid/gid, then PROHIBIT
- * set uid/gid bits
+ * set uid/gid bits but restore the file modes (since mkstemp doesn't).
*/
if (!pmode || res)
- arcn->sb.st_mode &= ~(SETBITS);
+ arcn->sb.st_mode &= ~SETBITS(0);
if (pmode)
- set_pmode(arcn->name, arcn->sb.st_mode);
+ set_pmode(arcn->tmp_name, arcn->sb.st_mode);
+ else
+ set_pmode(arcn->tmp_name, arcn->sb.st_mode & FILEBITS(0));
if (patime || pmtime)
- set_ftime(arcn->name, arcn->sb.st_mtime, arcn->sb.st_atime, 0);
+ set_ftime(arcn->tmp_name, arcn->sb.st_mtime, arcn->sb.st_atime, 0);
+ /*
+ * Finally, now the temp file is fully instantiated rename it to
+ * the desired file name.
+ */
+ if (rename(arcn->tmp_name, arcn->name) < 0) {
+ syswarn(0, errno, "Cannot rename %s to %s",
+ arcn->tmp_name, arcn->name);
+ (void)unlink(arcn->tmp_name);
+ }
+
#if HAVE_STRUCT_STAT_ST_FLAGS
if (pfflags && arcn->type != PAX_SLK)
set_chflags(arcn->name, arcn->sb.st_flags);
#endif
+
+ free(arcn->tmp_name);
+ arcn->tmp_name = NULL;
+ xtmp_name = NULL;
}
/*
@@ -395,7 +430,7 @@ node_creat(ARCHD *arcn)
* file and link creation routines, this method seems to exhibit the
* best performance in general use workloads.
*/
- file_mode = arcn->sb.st_mode & FILEBITS;
+ file_mode = arcn->sb.st_mode & FILEBITS(arcn->type == PAX_DIR);
for (;;) {
switch(arcn->type) {
@@ -500,7 +535,7 @@ badlink:
* set uid/gid bits
*/
if (!pmode || res)
- arcn->sb.st_mode &= ~(SETBITS);
+ arcn->sb.st_mode &= ~SETBITS(arcn->type == PAX_DIR);
if (pmode)
set_pmode(arcn->name, arcn->sb.st_mode);
@@ -526,8 +561,9 @@ badlink:
* restored AS CREATED and not as stored if
* pmode is not set.
*/
- set_pmode(nm,
- ((sb.st_mode & FILEBITS) | S_IRWXU));
+ set_pmode(nm, ((sb.st_mode &
+ FILEBITS(arcn->type == PAX_DIR)) |
+ S_IRWXU));
if (!pmode)
arcn->sb.st_mode = sb.st_mode;
}
@@ -620,7 +656,7 @@ unlnk_exist(char *name, int type)
*/
int
-chk_path( char *name, uid_t st_uid, gid_t st_gid)
+chk_path(char *name, uid_t st_uid, gid_t st_gid)
{
char *spt = name;
struct stat sb;
@@ -683,7 +719,8 @@ chk_path( char *name, uid_t st_uid, gid_t st_gid)
*/
if ((access(name, R_OK | W_OK | X_OK) < 0) &&
(lstat(name, &sb) == 0)) {
- set_pmode(name, ((sb.st_mode & FILEBITS) | S_IRWXU));
+ set_pmode(name, ((sb.st_mode & FILEBITS(0)) |
+ S_IRWXU));
add_dir(name, spt - name, &sb, 1);
}
*(spt++) = '/';
@@ -776,7 +813,7 @@ set_ids(char *fnm, uid_t uid, gid_t gid)
void
set_pmode(char *fnm, mode_t mode)
{
- mode &= ABITS;
+ mode &= A_BITS;
if (lchmod(fnm, mode)) {
(void)fflush(listf);
syswarn(1, errno, "Cannot set permissions on %s", fnm);
diff --git a/archivers/pax/files/ftree.c b/archivers/pax/files/ftree.c
index 86f5cb3bfa4..4ebb0232507 100644
--- a/archivers/pax/files/ftree.c
+++ b/archivers/pax/files/ftree.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ftree.c,v 1.5 2003/12/20 04:45:04 grant Exp $ */
+/* $NetBSD: ftree.c,v 1.6 2004/06/20 10:11:02 grant Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -80,7 +80,7 @@
#if 0
static char sccsid[] = "@(#)ftree.c 8.2 (Berkeley) 4/18/94";
#else
-__RCSID("$NetBSD: ftree.c,v 1.5 2003/12/20 04:45:04 grant Exp $");
+__RCSID("$NetBSD: ftree.c,v 1.6 2004/06/20 10:11:02 grant Exp $");
#endif
#endif /* not lint */
@@ -170,7 +170,7 @@ static int ftree_arg(void);
*/
int
-ftree_start(void)
+ftree_start()
{
#ifndef SMALL
@@ -366,8 +366,6 @@ ftree_chk(void)
static int
ftree_arg(void)
{
- char *pt;
-
/*
* close off the current file tree
*/
@@ -382,14 +380,25 @@ ftree_arg(void)
*/
for(;;) {
if (fthead == NULL) {
+ int i, c = EOF;
/*
* the user didn't supply any args, get the file trees
* to process from stdin;
*/
- if (fgets(farray[0], PAXPATHLEN+1, stdin) == NULL)
- return(-1);
- if ((pt = strchr(farray[0], '\n')) != NULL)
- *pt = '\0';
+ for (i = 0; i < PAXPATHLEN + 2; i++) {
+ c = getchar();
+ if (c == EOF)
+ break;
+ else if (c == sep) {
+ if (i != 0)
+ break;
+ } else
+ farray[0][i] = c;
+ }
+ if (i == 0)
+ return -1;
+ farray[0][i] = '\0';
+ fprintf(stderr, ">%s<\n", farray[0]);
} else {
/*
* the user supplied the file args as arguements to pax
diff --git a/archivers/pax/files/options.c b/archivers/pax/files/options.c
index 327509937e3..aa39a4ca8a3 100644
--- a/archivers/pax/files/options.c
+++ b/archivers/pax/files/options.c
@@ -1,4 +1,4 @@
-/* $NetBSD: options.c,v 1.5 2003/12/20 04:45:04 grant Exp $ */
+/* $NetBSD: options.c,v 1.6 2004/06/20 10:11:02 grant Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -44,7 +44,7 @@
#if 0
static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94";
#else
-__RCSID("$NetBSD: options.c,v 1.5 2003/12/20 04:45:04 grant Exp $");
+__RCSID("$NetBSD: options.c,v 1.6 2004/06/20 10:11:02 grant Exp $");
#endif
#endif /* not lint */
@@ -104,7 +104,7 @@ __RCSID("$NetBSD: options.c,v 1.5 2003/12/20 04:45:04 grant Exp $");
*/
static int nopids; /* tar mode: suppress "pids" for -p option */
-static char *flgch = FLGCH; /* list of all possible flags (pax) */
+static char flgch[] = FLGCH; /* list of all possible flags (pax) */
static OPLIST *ophead = NULL; /* head for format specific options -x */
static OPLIST *optail = NULL; /* option tail */
@@ -205,6 +205,11 @@ FSUB fsub[] = {
int ford[] = {F_USTAR, F_TAR, F_SV4CRC, F_SV4CPIO, F_CPIO, F_BCPIO, -1};
/*
+ * filename record separator
+ */
+int sep = '\n';
+
+/*
* options()
* figure out if we are pax, tar or cpio. Call the appropriate options
* parser
@@ -259,9 +264,12 @@ pax_options(int argc, char **argv)
* process option flags
*/
while ((c = getopt_long(argc, argv,
- "ab:cdf:ijklno:p:rs:tuvwx:zAB:DE:G:HLMN:OPT:U:XYZ",
+ "0ab:cdf:ijklno:p:rs:tuvwx:zAB:DE:G:HLMN:OPT:U:XYZ",
pax_longopts, NULL)) != -1) {
switch (c) {
+ case '0':
+ sep = '\0';
+ break;
case 'a':
/*
* append
@@ -501,10 +509,10 @@ pax_options(int argc, char **argv)
/*
* non-standard limit on read faults
* 0 indicates stop after first error, values
- * indicate a limit, "NONE" try forever
+ * indicate a limit, "none" try forever
*/
flg |= CEF;
- if (strcmp(NONE, optarg) == 0)
+ if (strcmp(none, optarg) == 0)
maxflt = -1;
else if ((maxflt = atoi(optarg)) < 0) {
tty_warn(1,
@@ -827,7 +835,7 @@ tar_options(int argc, char **argv)
* process option flags
*/
while ((c = getoldopt(argc, argv,
- "+b:cef:hjlmopqrstuvwxzBC:HI:OPT:X:Z014578",
+ "+b:cef:hjklmopqrs:tuvwxzBC:HI:OPT:X:Z014578",
tar_longopts, NULL))
!= -1) {
switch(c) {
@@ -1727,13 +1735,11 @@ static void
printflg(unsigned int flg)
{
int nxt;
- int pos = 0;
(void)fprintf(stderr,"%s: Invalid combination of options:", argv0);
while ((nxt = ffs(flg)) != 0) {
- flg = flg >> nxt;
- pos += nxt;
- (void)fprintf(stderr, " -%c", flgch[pos-1]);
+ flg &= ~(1 << (nxt - 1));
+ (void)fprintf(stderr, " -%c", flgch[nxt - 1]);
}
(void)putc('\n', stderr);
}
@@ -1747,7 +1753,7 @@ printflg(unsigned int flg)
static int
c_frmt(const void *a, const void *b)
{
- return(strcmp(((FSUB *)a)->name, ((FSUB *)b)->name));
+ return(strcmp(((const FSUB *)a)->name, ((const FSUB *)b)->name));
}
/*
@@ -1978,7 +1984,7 @@ void
pax_usage(void)
{
fprintf(stderr,
-"Usage: pax [-cdjnvzO] [-E limit] [-f archive] [-N dbdir] [-s replstr] ...\n"
+"usage: pax [-cdjnvzO] [-E limit] [-f archive] [-N dbdir] [-s replstr] ...\n"
" [-U user] ... [-G group] ... [-T [from_date][,to_date]] ...\n"
" [pattern ...]\n");
fprintf(stderr,
@@ -2006,7 +2012,7 @@ pax_usage(void)
void
tar_usage(void)
{
- (void)fputs("Usage: tar [-]{crtux}[-befhjlmopqvwzHLOPXZ014578] [archive] "
+ (void)fputs("usage: tar [-]{crtux}[-befhjlmopqvwzHLOPXZ014578] [archive] "
"[blocksize]\n"
" [-C directory] [-T file] [-s replstr] "
"[file ...]\n", stderr);
@@ -2023,7 +2029,7 @@ void
cpio_usage(void)
{
- (void)fputs("Usage: cpio -o [-aABcLvzZ] [-C bytes] [-F archive] "
+ (void)fputs("usage: cpio -o [-aABcLvzZ] [-C bytes] [-F archive] "
"[-H format] [-O archive]\n"
" < name-list [> archive]\n"
" cpio -i [-bBcdfmrsStuvzZ6] [-C bytes] [-E file] "
diff --git a/archivers/pax/files/options.h b/archivers/pax/files/options.h
index 432d54cf791..425801742b8 100644
--- a/archivers/pax/files/options.h
+++ b/archivers/pax/files/options.h
@@ -1,4 +1,4 @@
-/* $NetBSD: options.h,v 1.3 2003/12/20 04:45:04 grant Exp $ */
+/* $NetBSD: options.h,v 1.4 2004/06/20 10:11:02 grant Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -48,7 +48,7 @@
* operation mode of pax, a set of illegal flags is defined. If any one of
* those illegal flags are found set, we scream and exit
*/
-#define NONE "none"
+#define none "none"
/*
* flags (one for each option).
diff --git a/archivers/pax/files/pax.1 b/archivers/pax/files/pax.1
index 5d3dbedcf7e..77a9a77ac4a 100644
--- a/archivers/pax/files/pax.1
+++ b/archivers/pax/files/pax.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pax.1,v 1.3 2003/12/20 04:45:04 grant Exp $
+.\" $NetBSD: pax.1,v 1.4 2004/06/20 10:11:02 grant Exp $
.\"
.\" Copyright (c) 1992 Keith Muller.
.\" Copyright (c) 1992, 1993
@@ -33,7 +33,7 @@
.\"
.\" @(#)pax.1 8.4 (Berkeley) 4/18/94
.\"
-.Dd March 31, 2003
+.Dd June 18, 2004
.Dt PAX 1
.Os
.Sh NAME
@@ -41,7 +41,7 @@
.Nd read and write file archives and copy directory hierarchies
.Sh SYNOPSIS
.Nm
-.Op Fl cdjnvzO
+.Op Fl 0cdjnvzO
.Bk -words
.Op Fl E Ar limit
.Ek
@@ -780,8 +780,8 @@ files,
.Em hard links , soft links ,
and
.Em directories
-will be archived (other file system types are not supported).
-For backwards compatibility with even older tar formats, a
+will be archived (other file types are not supported).
+For backward compatibility with even older tar formats, a
.Fl o
option can be used when writing an archive to omit the storage of directories.
This option takes the form:
@@ -1078,6 +1078,9 @@ This option is the same as the
.Fl u
option, except that the modification time is checked using the
pathname created after all the file name modifications have completed.
+.It Fl 0
+Use the nul character instead of \en as the file separator when reading
+files from standard input.
.It Fl -force-local
Do not interpret filenames that contain a `:' as remote files.
.It Fl -insecure
diff --git a/archivers/pax/files/pax.c b/archivers/pax/files/pax.c
index 3638c7a5bab..a9b141ed533 100644
--- a/archivers/pax/files/pax.c
+++ b/archivers/pax/files/pax.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pax.c,v 1.5 2003/12/20 04:45:04 grant Exp $ */
+/* $NetBSD: pax.c,v 1.6 2004/06/20 10:11:02 grant Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -49,7 +49,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
#if 0
static char sccsid[] = "@(#)pax.c 8.2 (Berkeley) 4/18/94";
#else
-__RCSID("$NetBSD: pax.c,v 1.5 2003/12/20 04:45:04 grant Exp $");
+__RCSID("$NetBSD: pax.c,v 1.6 2004/06/20 10:11:02 grant Exp $");
#endif
#endif /* not lint */
@@ -138,7 +138,7 @@ int docrc; /* check/create file crc */
int to_stdout; /* extract to stdout */
char *dirptr; /* destination dir in a copy */
char *ltmfrmt; /* -v locale time format (if any) */
-char *argv0; /* root of argv[0] */
+const char *argv0; /* root of argv[0] */
sigset_t s_mask; /* signal mask for cleanup critical sect */
FILE *listf; /* file pointer to print file list to */
char *tempfile; /* tempfile to use for mkstemp(3) */
@@ -271,7 +271,7 @@ int secure = 1; /* don't extract names that contain .. */
int
main(int argc, char **argv)
{
- char *tmpdir;
+ const char *tmpdir;
size_t tdlen;
setprogname(argv[0]);
@@ -369,10 +369,13 @@ sig_cleanup(int which_sig)
*/
vflag = vfpart = 1;
if (which_sig == SIGXCPU)
- tty_warn(0, "Cpu time limit reached, cleaning up.");
+ tty_warn(0, "CPU time limit reached, cleaning up.");
else
tty_warn(0, "Signal caught, cleaning up.");
+ /* delete any open temporary file */
+ if (xtmp_name)
+ (void)unlink(xtmp_name);
ar_close();
proc_dir();
if (tflag)
@@ -439,7 +442,7 @@ gen_init(void)
/*
* signal handling to reset stored directory times and modes. Since
* we deal with broken pipes via failed writes we ignore it. We also
- * deal with any file size limit thorugh failed writes. Cpu time
+ * deal with any file size limit thorugh failed writes. CPU time
* limits are caught and a cleanup is forced.
*/
if ((sigemptyset(&s_mask) < 0) || (sigaddset(&s_mask, SIGTERM) < 0) ||
diff --git a/archivers/pax/files/pax.cat1 b/archivers/pax/files/pax.cat1
index 0eb162f6451..69a194216eb 100644
--- a/archivers/pax/files/pax.cat1
+++ b/archivers/pax/files/pax.cat1
@@ -4,7 +4,7 @@ NNAAMMEE
ppaaxx - read and write file archives and copy directory hierarchies
SSYYNNOOPPSSIISS
- ppaaxx [--ccddjjnnvvzzOO] [--EE _l_i_m_i_t] [--ff _a_r_c_h_i_v_e] [--NN _d_b_d_i_r] [--ss _r_e_p_l_s_t_r] _._._.
+ ppaaxx [--00ccddjjnnvvzzOO] [--EE _l_i_m_i_t] [--ff _a_r_c_h_i_v_e] [--NN _d_b_d_i_r] [--ss _r_e_p_l_s_t_r] _._._.
[--UU _u_s_e_r] _._._. [--GG _g_r_o_u_p] _._._. [--TT [_f_r_o_m___d_a_t_e] [,_t_o___d_a_t_e]] _._._.
[_p_a_t_t_e_r_n _._._.]
ppaaxx --rr [--ccddiijjkknnuuvvzzAADDOOYYZZ] [--EE _l_i_m_i_t] [--ff _a_r_c_h_i_v_e] [--NN _d_b_d_i_r] [--oo _o_p_t_i_o_n_s]
@@ -319,10 +319,10 @@ OOPPTTIIOONNSS
blocksize for this format is 10240 bytes. Pathnames
stored by this format must be 100 characters or less in
length. Only _r_e_g_u_l_a_r files, _h_a_r_d _l_i_n_k_s, _s_o_f_t _l_i_n_k_s, and
- _d_i_r_e_c_t_o_r_i_e_s will be archived (other file system types are
- not supported). For backwards compatibility with even
- older tar formats, a --oo option can be used when writing an
- archive to omit the storage of directories. This option
+ _d_i_r_e_c_t_o_r_i_e_s will be archived (other file types are not
+ supported). For backward compatibility with even older
+ tar formats, a --oo option can be used when writing an ar-
+ chive to omit the storage of directories. This option
takes the form:
--oo wwrriittee__oopptt==nnooddiirr
@@ -482,6 +482,9 @@ OOPPTTIIOONNSS
tion time is checked using the pathname created after all the file
name modifications have completed.
+ --00 Use the nul character instead of \n as the file separator when
+ reading files from standard input.
+
----ffoorrccee--llooccaall
Do not interpret filenames that contain a `:' as remote files.
@@ -598,4 +601,4 @@ AAUUTTHHOORRSS
Keith Muller at the University of California, San Diego. Luke Mewburn
implemented --MM.
-NetBSD 1.6 March 31, 2003 NetBSD 1.6
+NetBSD 2.0 June 18, 2004 NetBSD 2.0
diff --git a/archivers/pax/files/pax.h b/archivers/pax/files/pax.h
index d1bb46eac5e..843d91f066b 100644
--- a/archivers/pax/files/pax.h
+++ b/archivers/pax/files/pax.h
@@ -1,4 +1,4 @@
-/* $NetBSD: pax.h,v 1.6 2004/04/12 12:34:16 heinz Exp $ */
+/* $NetBSD: pax.h,v 1.7 2004/06/20 10:11:02 grant Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -120,6 +120,7 @@ typedef struct {
int ln_nlen; /* link name length */
char ln_name[PAXPATHLEN+1]; /* name to link to (if any) */
char *org_name; /* orig name in file system */
+ char *tmp_name; /* tmp name used to restore */
PATTERN *pat; /* ptr to pattern match (if any) */
struct stat sb; /* stat buffer see stat(2) */
off_t pad; /* bytes of padding after file xfer */
@@ -154,7 +155,7 @@ typedef struct {
* dependent routines pass pointers to ARCHD structure (described below).
*/
typedef struct {
- char *name; /* name of format, this is the name the user */
+ const char *name; /* name of format, this is the name the user */
/* gives to -x option to select it. */
int bsz; /* default block size. used when the user */
/* does not specify a blocksize for writing */
diff --git a/archivers/pax/files/tar.1 b/archivers/pax/files/tar.1
index e805ca1cec3..618874f35d0 100644
--- a/archivers/pax/files/tar.1
+++ b/archivers/pax/files/tar.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: tar.1,v 1.3 2003/07/09 14:42:43 wiz Exp $
+.\" $NetBSD: tar.1,v 1.4 2004/06/20 10:11:02 grant Exp $
.\"
.\" Copyright (c) 1996 SigmaSoft, Th. Lockert
.\" All rights reserved.
@@ -30,7 +30,7 @@
.\"
.\" OpenBSD: tar.1,v 1.28 2000/11/09 23:58:56 aaron Exp
.\"
-.Dd July 8, 2003
+.Dd May 4, 2004
.Dt TAR 1
.Os
.Sh NAME
@@ -237,7 +237,11 @@ Do not enable GNU tar extensions such as long filenames and long link names.
.It Fl -atime-preserve
Preserve file access times.
.It Fl -unlink
-Remove files before creating them.
+Ignored, only accepted for compatibility with other
+.Nm
+implementations.
+.Nm
+always unlinks files before creating them.
.It Fl -use-compress-program Ar program
Use the named program as the program to decompress the input.
.It Fl -force-local
diff --git a/archivers/pax/files/tar.c b/archivers/pax/files/tar.c
index 321de0146f1..75f18f3a3c8 100644
--- a/archivers/pax/files/tar.c
+++ b/archivers/pax/files/tar.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tar.c,v 1.7 2003/12/20 04:46:27 grant Exp $ */
+/* $NetBSD: tar.c,v 1.8 2004/06/20 10:11:02 grant Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -44,7 +44,7 @@
#if 0
static char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94";
#else
-__RCSID("$NetBSD: tar.c,v 1.7 2003/12/20 04:46:27 grant Exp $");
+__RCSID("$NetBSD: tar.c,v 1.8 2004/06/20 10:11:02 grant Exp $");
#endif
#endif /* not lint */
@@ -95,7 +95,7 @@ __RCSID("$NetBSD: tar.c,v 1.7 2003/12/20 04:46:27 grant Exp $");
*/
static int expandname(char *, size_t, char **, const char *, size_t);
-static void longlink(ARCHD *);
+static void longlink(ARCHD *, int);
static u_long tar_chksm(char *, int);
static char *name_split(char *, int);
static int ul_oct(u_long, char *, int, int);
@@ -119,6 +119,18 @@ static char *gnu_hack_string; /* ././@LongLink hackery */
static int gnu_hack_len; /* len of gnu_hack_string */
char *gnu_name_string; /* ././@LongLink hackery name */
char *gnu_link_string; /* ././@LongLink hackery link */
+static int gnu_short_trailer; /* gnu short trailer */
+
+static const char LONG_LINK[] = "././@LongLink";
+
+#ifdef _PAX_
+char DEV_0[] = "/dev/rst0";
+char DEV_1[] = "/dev/rst1";
+char DEV_4[] = "/dev/rst4";
+char DEV_5[] = "/dev/rst5";
+char DEV_7[] = "/dev/rst7";
+char DEV_8[] = "/dev/rst8";
+#endif
static int
check_sum(char *hd, size_t hdlen, char *bl, size_t bllen, int quiet)
@@ -148,20 +160,20 @@ check_sum(char *hd, size_t hdlen, char *bl, size_t bllen, int quiet)
int
tar_endwr(void)
{
- return(wr_skip((off_t)(NULLCNT*BLKMULT)));
+ return(wr_skip((off_t)(NULLCNT * BLKMULT)));
}
/*
* tar_endrd()
* no cleanup needed here, just return size of trailer (for append)
* Return:
- * size of trailer (2 * BLKMULT)
+ * size of trailer BLKMULT
*/
off_t
tar_endrd(void)
{
- return((off_t)(NULLCNT*BLKMULT));
+ return((off_t)((gnu_short_trailer ? 1 : NULLCNT) * BLKMULT));
}
/*
@@ -180,6 +192,7 @@ tar_trail(char *buf, int in_resync, int *cnt)
{
int i;
+ gnu_short_trailer = 0;
/*
* look for all zero, trailer is two consecutive blocks of zero
*/
@@ -208,8 +221,10 @@ tar_trail(char *buf, int in_resync, int *cnt)
* old GNU tar (up through 1.13) only writes one block of
* trailers, so we pretend we got another
*/
- if (is_gnutar)
+ if (is_gnutar) {
+ gnu_short_trailer = 1;
++*cnt;
+ }
if (*cnt >= NULLCNT)
return(0);
}
@@ -513,8 +528,6 @@ tar_rd(ARCHD *arcn, char *buf)
arcn->sb.st_mode |= S_IFREG;
break;
case LONGLINKTYPE:
- arcn->type = PAX_GLL;
- /* FALLTHROUGH */
case LONGNAMETYPE:
/*
* GNU long link/file; we tag these here and let the
@@ -522,6 +535,8 @@ tar_rd(ARCHD *arcn, char *buf)
*/
if (hd->linkflag != LONGLINKTYPE)
arcn->type = PAX_GLF;
+ else
+ arcn->type = PAX_GLL;
arcn->pad = TAR_PAD(arcn->sb.st_size);
arcn->skip = arcn->sb.st_size;
break;
@@ -837,9 +852,10 @@ ustar_rd(ARCHD *arcn, char *buf)
if (hd->typeflag != LONGLINKTYPE && hd->typeflag != LONGNAMETYPE) {
arcn->nlen = expandname(dest, sizeof(arcn->name) - cnt,
- &gnu_name_string, hd->name, sizeof(hd->name));
- arcn->ln_nlen = expandname(arcn->ln_name, sizeof(arcn->ln_name),
- &gnu_link_string, hd->linkname, sizeof(hd->linkname));
+ &gnu_name_string, hd->name, sizeof(hd->name)) + cnt;
+ arcn->ln_nlen = expandname(arcn->ln_name,
+ sizeof(arcn->ln_name), &gnu_link_string, hd->linkname,
+ sizeof(hd->linkname));
}
/*
@@ -924,9 +940,6 @@ ustar_rd(ARCHD *arcn, char *buf)
}
break;
case LONGLINKTYPE:
- if (is_gnutar)
- arcn->type = PAX_GLL;
- /* FALLTHROUGH */
case LONGNAMETYPE:
if (is_gnutar) {
/*
@@ -935,6 +948,8 @@ ustar_rd(ARCHD *arcn, char *buf)
*/
if (hd->typeflag != LONGLINKTYPE)
arcn->type = PAX_GLF;
+ else
+ arcn->type = PAX_GLL;
arcn->pad = TAR_PAD(arcn->sb.st_size);
arcn->skip = arcn->sb.st_size;
} else {
@@ -976,29 +991,28 @@ expandname(char *buf, size_t len, char **gnu_name, const char *name,
}
static void
-longlink(ARCHD *arcn)
+longlink(ARCHD *arcn, int type)
{
ARCHD larc;
- memset(&larc, 0, sizeof(larc));
+ (void)memset(&larc, 0, sizeof(larc));
- switch (arcn->type) {
- case PAX_SLK:
- case PAX_HRG:
- case PAX_HLK:
- larc.type = PAX_GLL;
- larc.ln_nlen = strlcpy(larc.ln_name, "././@LongLink",
- sizeof(larc.ln_name));
+ larc.type = type;
+ larc.nlen = strlcpy(larc.name, LONG_LINK, sizeof(larc.name));
+
+ switch (type) {
+ case PAX_GLL:
gnu_hack_string = arcn->ln_name;
gnu_hack_len = arcn->ln_nlen + 1;
break;
- default:
- larc.nlen = strlcpy(larc.name, "././@LongLink",
- sizeof(larc.name));
+ case PAX_GLF:
gnu_hack_string = arcn->name;
gnu_hack_len = arcn->nlen + 1;
- larc.type = PAX_GLF;
+ break;
+ default:
+ errx(1, "Invalid type in GNU longlink %d\n", type);
}
+
/*
* We need a longlink now.
*/
@@ -1025,29 +1039,34 @@ ustar_wr(ARCHD *arcn)
char hdblk[sizeof(HD_USTAR)];
const char *user, *group;
- /*
- * check for those file system types ustar cannot store
- */
- if (arcn->type == PAX_SCK) {
+ switch (arcn->type) {
+ case PAX_SCK:
+ /*
+ * check for those file system types ustar cannot store
+ */
if (!is_gnutar)
tty_warn(1, "Ustar cannot archive a socket %s",
arcn->org_name);
return(1);
- }
- /*
- * check the length of the linkname
- */
- if (((arcn->type == PAX_SLK) || (arcn->type == PAX_HLK) ||
- (arcn->type == PAX_HRG)) &&
- (arcn->ln_nlen >= sizeof(hd->linkname))){
- if (is_gnutar) {
- longlink(arcn);
- } else {
- tty_warn(1, "Link name too long for ustar %s",
- arcn->ln_name);
- return(1);
+ case PAX_SLK:
+ case PAX_HLK:
+ case PAX_HRG:
+ /*
+ * check the length of the linkname
+ */
+ if (arcn->ln_nlen >= sizeof(hd->linkname)) {
+ if (is_gnutar) {
+ longlink(arcn, PAX_GLL);
+ } else {
+ tty_warn(1, "Link name too long for ustar %s",
+ arcn->ln_name);
+ return(1);
+ }
}
+ break;
+ default:
+ break;
}
/*
@@ -1056,7 +1075,7 @@ ustar_wr(ARCHD *arcn)
*/
if ((pt = name_split(arcn->name, arcn->nlen)) == NULL) {
if (is_gnutar) {
- longlink(arcn);
+ longlink(arcn, PAX_GLF);
pt = arcn->name;
} else {
tty_warn(1, "File name too long for ustar %s",
@@ -1279,16 +1298,28 @@ name_split(char *name, int len)
return(start);
}
-/* convert a glob into a RE, and add it to the list */
+/*
+ * convert a glob into a RE, and add it to the list. we convert to
+ * four different RE's (because we're using BRE's and can't use |
+ * alternation :-() with this padding:
+ * .*\/ and $
+ * .*\/ and \/.*
+ * ^ and $
+ * ^ and \/.*
+ */
static int
tar_gnutar_exclude_one(const char *line, size_t len)
{
- char sbuf[MAXPATHLEN * 2 + 1 + 5];
+ /* 2 * buffer len + nul */
+ char sbuf[MAXPATHLEN * 2 + 1];
+ /* + / + // + .*""/\/ + \/.* */
+ char rabuf[MAXPATHLEN * 2 + 1 + 1 + 2 + 4 + 4];
int i, j;
if (line[len - 1] == '\n')
len--;
- for (i = 0, j = 2; i < len; i++) {
+ strncpy(sbuf, ".*" "\\/", j = 4);
+ for (i = 0; i < len; i++) {
/*
* convert glob to regexp, escaping everything
*/
@@ -1301,11 +1332,21 @@ tar_gnutar_exclude_one(const char *line, size_t len)
sbuf[j++] = '\\';
sbuf[j++] = line[i];
}
- sbuf[0] = sbuf[j + 1] = sbuf[j + 2] = '/';
- sbuf[1] = '^';
- sbuf[j] = '$';
- sbuf[j + 3] = '\0';
- if (rep_add(sbuf) < 0)
+ /* don't need the .*\/ ones if we start with /, i guess */
+ if (line[0] != '/') {
+ (void)snprintf(rabuf, sizeof rabuf, "/.*\\/%s$//", sbuf);
+ if (rep_add(rabuf) < 0)
+ return (-1);
+ (void)snprintf(rabuf, sizeof rabuf, "/.*\\/%s\\/.*//", sbuf);
+ if (rep_add(rabuf) < 0)
+ return (-1);
+ }
+
+ (void)snprintf(rabuf, sizeof rabuf, "/^%s$//", sbuf);
+ if (rep_add(rabuf) < 0)
+ return (-1);
+ (void)snprintf(rabuf, sizeof rabuf, "/^%s\\/.*//", sbuf);
+ if (rep_add(rabuf) < 0)
return (-1);
return (0);
diff --git a/archivers/pax/files/tar.cat1 b/archivers/pax/files/tar.cat1
index 18b58a2e566..4398286b9bb 100644
--- a/archivers/pax/files/tar.cat1
+++ b/archivers/pax/files/tar.cat1
@@ -161,7 +161,9 @@ DDEESSCCRRIIPPTTIIOONN
----aattiimmee--pprreesseerrvvee
Preserve file access times.
- ----uunnlliinnkk Remove files before creating them.
+ ----uunnlliinnkk Ignored, only accepted for compatibility with other ttaarr
+ implementations. ttaarr always unlinks files before creating
+ them.
----uussee--ccoommpprreessss--pprrooggrraamm _p_r_o_g_r_a_m
Use the named program as the program to decompress the
@@ -215,4 +217,4 @@ HHIISSTTOORRYY
AAUUTTHHOORRSS
Keith Muller at the University of California, San Diego.
-NetBSD 1.6 July 8, 2003 NetBSD 1.6
+NetBSD 2.0 May 4, 2004 NetBSD 2.0
diff --git a/archivers/pax/files/tar.h b/archivers/pax/files/tar.h
index 52f365c3e33..c56a82b91c1 100644
--- a/archivers/pax/files/tar.h
+++ b/archivers/pax/files/tar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: tar.h,v 1.3 2003/12/20 04:45:04 grant Exp $ */
+/* $NetBSD: tar.h,v 1.4 2004/06/20 10:11:02 grant Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -115,12 +115,12 @@ typedef struct {
/*
* default device names
*/
-#define DEV_0 "/dev/rst0"
-#define DEV_1 "/dev/rst1"
-#define DEV_4 "/dev/rst4"
-#define DEV_5 "/dev/rst5"
-#define DEV_7 "/dev/rst7"
-#define DEV_8 "/dev/rst8"
+extern char DEV_0[];
+extern char DEV_1[];
+extern char DEV_4[];
+extern char DEV_5[];
+extern char DEV_7[];
+extern char DEV_8[];
#endif /* _PAX_ */
/*