pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/archivers/pax/files sync pax with src/ from 20040620, ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/65fa504fb378
branches: trunk
changeset: 476691:65fa504fb378
user: grant <grant%pkgsrc.org@localhost>
date: Sun Jun 20 10:11:02 2004 +0000
description:
sync pax with src/ from 20040620, includes many bug fixes including
properly handling broken archives.
diffstat:
archivers/pax/files/ar_io.c | 23 +++--
archivers/pax/files/ar_subs.c | 8 +-
archivers/pax/files/buf_subs.c | 6 +-
archivers/pax/files/cpio.1 | 6 +-
archivers/pax/files/cpio.cat1 | 4 +-
archivers/pax/files/extern.h | 6 +-
archivers/pax/files/file_subs.c | 123 +++++++++++++++++++++-----------
archivers/pax/files/ftree.c | 27 ++++--
archivers/pax/files/options.c | 36 +++++----
archivers/pax/files/options.h | 4 +-
archivers/pax/files/pax.1 | 13 ++-
archivers/pax/files/pax.c | 15 ++-
archivers/pax/files/pax.cat1 | 15 ++-
archivers/pax/files/pax.h | 5 +-
archivers/pax/files/tar.1 | 10 +-
archivers/pax/files/tar.c | 149 +++++++++++++++++++++++++--------------
archivers/pax/files/tar.cat1 | 6 +-
archivers/pax/files/tar.h | 14 +-
18 files changed, 291 insertions(+), 179 deletions(-)
diffs (truncated from 1225 to 300 lines):
diff -r 3889209e79f5 -r 65fa504fb378 archivers/pax/files/ar_io.c
--- a/archivers/pax/files/ar_io.c Sun Jun 20 02:52:56 2004 +0000
+++ b/archivers/pax/files/ar_io.c Sun Jun 20 10:11:02 2004 +0000
@@ -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 @@
#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 @@
/*
* arfd not used in COPY mode
*/
- arcname = "<NONE>";
+ arcname = NONE;
lstrval = 1;
return(0);
}
@@ -1464,7 +1465,7 @@
ar_next(void)
{
char buf[PAXPATHLEN+2];
- static int freeit = 0;
+ static char *arcfree = NULL;
sigset_t o_mask;
/*
@@ -1596,17 +1597,17 @@
* 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 -r 3889209e79f5 -r 65fa504fb378 archivers/pax/files/ar_subs.c
--- a/archivers/pax/files/ar_subs.c Sun Jun 20 02:52:56 2004 +0000
+++ b/archivers/pax/files/ar_subs.c Sun Jun 20 10:11:02 2004 +0000
@@ -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 @@
*/
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 @@
* 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 -r 3889209e79f5 -r 65fa504fb378 archivers/pax/files/buf_subs.c
--- a/archivers/pax/files/buf_subs.c Sun Jun 20 02:52:56 2004 +0000
+++ b/archivers/pax/files/buf_subs.c Sun Jun 20 10:11:02 2004 +0000
@@ -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 @@
* 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 -r 3889209e79f5 -r 65fa504fb378 archivers/pax/files/cpio.1
--- a/archivers/pax/files/cpio.1 Sun Jun 20 02:52:56 2004 +0000
+++ b/archivers/pax/files/cpio.1 Sun Jun 20 10:11:02 2004 +0000
@@ -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 @@
.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 -r 3889209e79f5 -r 65fa504fb378 archivers/pax/files/cpio.cat1
--- a/archivers/pax/files/cpio.cat1 Sun Jun 20 02:52:56 2004 +0000
+++ b/archivers/pax/files/cpio.cat1 Sun Jun 20 10:11:02 2004 +0000
@@ -85,7 +85,7 @@
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 @@
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 -r 3889209e79f5 -r 65fa504fb378 archivers/pax/files/extern.h
--- a/archivers/pax/files/extern.h Sun Jun 20 02:52:56 2004 +0000
+++ b/archivers/pax/files/extern.h Sun Jun 20 10:11:02 2004 +0000
@@ -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 @@
* 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 @@
*/
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 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 -r 3889209e79f5 -r 65fa504fb378 archivers/pax/files/file_subs.c
--- a/archivers/pax/files/file_subs.c Sun Jun 20 02:52:56 2004 +0000
+++ b/archivers/pax/files/file_subs.c Sun Jun 20 10:11:02 2004 +0000
@@ -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 @@
#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 @@
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
Home |
Main Index |
Thread Index |
Old Index