pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc Merge a fix from NetBSD's src/bin/pax by tls:
details: https://anonhg.NetBSD.org/pkgsrc/rev/67e468aea1f3
branches: trunk
changeset: 538426:67e468aea1f3
user: joerg <joerg%pkgsrc.org@localhost>
date: Thu Feb 07 22:27:53 2008 +0000
description:
Merge a fix from NetBSD's src/bin/pax by tls:
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.
Bump version to 20080110.
diffstat:
archivers/pax/Makefile | 3 +--
archivers/pax/Makefile.common | 4 ++--
archivers/pax/files/extern.h | 4 ++--
archivers/pax/files/file_subs.c | 39 ++++++++++++++++++++++++---------------
archivers/pax/files/ftree.c | 8 ++++----
archivers/pax/files/tables.c | 10 +++++-----
pkgtools/pax/Makefile | 3 +--
7 files changed, 39 insertions(+), 32 deletions(-)
diffs (244 lines):
diff -r 067b2b0f1b31 -r 67e468aea1f3 archivers/pax/Makefile
--- a/archivers/pax/Makefile Thu Feb 07 21:36:13 2008 +0000
+++ b/archivers/pax/Makefile Thu Feb 07 22:27:53 2008 +0000
@@ -1,11 +1,10 @@
-# $NetBSD: Makefile,v 1.33 2007/11/11 16:51:27 joerg Exp $
+# $NetBSD: Makefile,v 1.34 2008/02/07 22:27:53 joerg Exp $
USE_FEATURES= nbcompat
.include "Makefile.common"
CATEGORIES= archivers
-PKGREVISION= 3
# pax installs "tar" and "cpio"
.if defined(GNU_PROGRAM_PREFIX) && ${GNU_PROGRAM_PREFIX} == ""
diff -r 067b2b0f1b31 -r 67e468aea1f3 archivers/pax/Makefile.common
--- a/archivers/pax/Makefile.common Thu Feb 07 21:36:13 2008 +0000
+++ b/archivers/pax/Makefile.common Thu Feb 07 22:27:53 2008 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.common,v 1.3 2006/07/14 20:11:10 jlam Exp $
+# $NetBSD: Makefile.common,v 1.4 2008/02/07 22:27:53 joerg Exp $
#
# This Makefile fragment is included by:
#
@@ -6,7 +6,7 @@
# pkgsrc/pkgtools/pax/Makefile
#
-DISTNAME= pax-20060202
+DISTNAME= pax-20080110
MASTER_SITES= # empty
DISTFILES= # empty
diff -r 067b2b0f1b31 -r 67e468aea1f3 archivers/pax/files/extern.h
--- a/archivers/pax/files/extern.h Thu Feb 07 21:36:13 2008 +0000
+++ b/archivers/pax/files/extern.h Thu Feb 07 22:27:53 2008 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.6 2005/12/01 03:00:01 minskim Exp $ */
+/* $NetBSD: extern.h,v 1.7 2008/02/07 22:27:53 joerg Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -165,7 +165,7 @@
int node_creat(ARCHD *);
int unlnk_exist(char *, int);
int chk_path(char *, uid_t, gid_t);
-void set_ftime(char *fnm, time_t mtime, time_t atime, int frc);
+void set_ftime(char *fnm, time_t mtime, time_t atime, int frc, int slk);
int set_ids(char *, uid_t, gid_t);
void set_pmode(char *, mode_t);
void set_chflags(char *fnm, u_int32_t flags);
diff -r 067b2b0f1b31 -r 67e468aea1f3 archivers/pax/files/file_subs.c
--- a/archivers/pax/files/file_subs.c Thu Feb 07 21:36:13 2008 +0000
+++ b/archivers/pax/files/file_subs.c Thu Feb 07 22:27:53 2008 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: file_subs.c,v 1.12 2007/03/08 17:18:18 rillig Exp $ */
+/* $NetBSD: file_subs.c,v 1.13 2008/02/07 22:27:53 joerg Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -48,7 +48,7 @@
#if 0
static char sccsid[] = "@(#)file_subs.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: file_subs.c,v 1.12 2007/03/08 17:18:18 rillig Exp $");
+__RCSID("$NetBSD: file_subs.c,v 1.13 2008/02/07 22:27:53 joerg Exp $");
#endif
#endif /* not lint */
@@ -238,7 +238,8 @@
else
set_pmode(tmp_name, arcn->sb.st_mode & FILEBITS(0));
if (patime || pmtime)
- set_ftime(tmp_name, arcn->sb.st_mtime, arcn->sb.st_atime, 0);
+ set_ftime(tmp_name, arcn->sb.st_mtime,
+ arcn->sb.st_atime, 0, 0);
/* Did we write directly to the target file? */
if (arcn->tmp_name == NULL)
@@ -625,12 +626,9 @@
add_dir(nm, arcn->nlen, &(arcn->sb), 0);
}
-#if HAVE_LUTIMES
if (patime || pmtime)
-#else
- if ((patime || pmtime) && arcn->type != PAX_SLK)
-#endif
- set_ftime(arcn->name, arcn->sb.st_mtime, arcn->sb.st_atime, 0);
+ set_ftime(arcn->name, arcn->sb.st_mtime,
+ arcn->sb.st_atime, 0, (arcn->type == PAX_SLK) ? 1 : 0);
#if HAVE_FILE_FLAGS
if (pfflags && arcn->type != PAX_SLK)
@@ -799,10 +797,16 @@
* other ones are left alone. We do not assume the un-documented feature
* of many utimes() implementations that consider a 0 time value as a do
* not set request.
+ *
+ * Unfortunately, there are systems where lutimes() is present but does
+ * not work on some filesystem types, which cannot be detected at
+ * compile time. This requires passing down symlink knowledge into
+ * this function to obtain correct operation. Linux with XFS is one
+ * example of such a system.
*/
void
-set_ftime(char *fnm, time_t mtime, time_t atime, int frc)
+set_ftime(char *fnm, time_t mtime, time_t atime, int frc, int slk)
{
struct timeval tv[2];
struct stat sb;
@@ -836,13 +840,18 @@
* set the times
*/
#if HAVE_LUTIMES
- if (lutimes(fnm, tv))
-#else
- if (utimes(fnm, tv))
+ if (lutimes(fnm, tv) == 0)
+ return;
+ if (errno != ENOSYS) /* XXX linux: lutimes is per-FS */
+ goto bad;
#endif
- syswarn(1, errno, "Access/modification time set failed on: %s",
- fnm);
+ if (slk)
+ return;
+ if (utimes(fnm, tv) == -1)
+ goto bad;
return;
+bad:
+ syswarn(1, errno, "Access/modification time set failed on: %s", fnm);
}
/*
@@ -1100,7 +1109,7 @@
/*
* user wants last access time reset
*/
- set_ftime(arcn->org_name, arcn->sb.st_mtime, arcn->sb.st_atime, 1);
+ set_ftime(arcn->org_name, arcn->sb.st_mtime, arcn->sb.st_atime, 1, 0);
return;
}
diff -r 067b2b0f1b31 -r 67e468aea1f3 archivers/pax/files/ftree.c
--- a/archivers/pax/files/ftree.c Thu Feb 07 21:36:13 2008 +0000
+++ b/archivers/pax/files/ftree.c Thu Feb 07 22:27:53 2008 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ftree.c,v 1.10 2007/03/08 17:18:18 rillig Exp $ */
+/* $NetBSD: ftree.c,v 1.11 2008/02/07 22:27:53 joerg Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -84,7 +84,7 @@
#if 0
static char sccsid[] = "@(#)ftree.c 8.2 (Berkeley) 4/18/94";
#else
-__RCSID("$NetBSD: ftree.c,v 1.10 2007/03/08 17:18:18 rillig Exp $");
+__RCSID("$NetBSD: ftree.c,v 1.11 2008/02/07 22:27:53 joerg Exp $");
#endif
#endif /* not lint */
@@ -577,7 +577,7 @@
(get_atdir(MFTENT_DUMMY_DEV, ftnode->lineno,
&mtime, &atime) == 0)) {
set_ftime(ftent->fts_path,
- mtime, atime, 1);
+ mtime, atime, 1, 0);
}
ftnode = ftnode->parent;
if (ftnode->parent == ftnode)
@@ -655,7 +655,7 @@
#endif
&mtime, &atime) < 0))
continue;
- set_ftime(ftent->fts_path, mtime, atime, 1);
+ set_ftime(ftent->fts_path, mtime, atime, 1, 0);
continue;
case FTS_DC:
/*
diff -r 067b2b0f1b31 -r 67e468aea1f3 archivers/pax/files/tables.c
--- a/archivers/pax/files/tables.c Thu Feb 07 21:36:13 2008 +0000
+++ b/archivers/pax/files/tables.c Thu Feb 07 22:27:53 2008 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tables.c,v 1.7 2007/03/08 17:18:18 rillig Exp $ */
+/* $NetBSD: tables.c,v 1.8 2008/02/07 22:27:53 joerg Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -48,7 +48,7 @@
#if 0
static char sccsid[] = "@(#)tables.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: tables.c,v 1.7 2007/03/08 17:18:18 rillig Exp $");
+__RCSID("$NetBSD: tables.c,v 1.8 2008/02/07 22:27:53 joerg Exp $");
#endif
#endif /* not lint */
@@ -982,7 +982,7 @@
* not read by pax. Read time reset is controlled by -t.
*/
for (; pt != NULL; pt = pt->fow)
- set_ftime(pt->name, pt->mtime, pt->atime, 1);
+ set_ftime(pt->name, pt->mtime, pt->atime, 1, 0);
}
}
@@ -1280,7 +1280,7 @@
if (pmode || dblk.frc_mode)
set_pmode(name, dblk.mode);
if (patime || pmtime)
- set_ftime(name, dblk.mtime, dblk.atime, 0);
+ set_ftime(name, dblk.mtime, dblk.atime, 0, 0);
if (pfflags)
set_chflags(name, dblk.fflags);
}
@@ -1304,7 +1304,7 @@
if (pmode || dblk->frc_mode)
set_pmode(dblk->name, dblk->mode);
if (patime || pmtime)
- set_ftime(dblk->name, dblk->mtime, dblk->atime, 0);
+ set_ftime(dblk->name, dblk->mtime, dblk->atime, 0, 0);
if (pfflags)
set_chflags(dblk->name, dblk->fflags);
diff -r 067b2b0f1b31 -r 67e468aea1f3 pkgtools/pax/Makefile
--- a/pkgtools/pax/Makefile Thu Feb 07 21:36:13 2008 +0000
+++ b/pkgtools/pax/Makefile Thu Feb 07 22:27:53 2008 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.17 2007/10/27 11:19:34 grant Exp $
+# $NetBSD: Makefile,v 1.18 2008/02/07 22:27:53 joerg Exp $
#
# This version of pax installs into ${PKG_TOOLS_BIN}.
#
@@ -7,7 +7,6 @@
.include "../../archivers/pax/Makefile.common"
-PKGREVISION= 2
CATEGORIES= pkgtools
NO_PKGTOOLS_REQD_CHECK= yes
Home |
Main Index |
Thread Index |
Old Index