Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/pkg_install Don't prepend directories if the plist ...



details:   https://anonhg.NetBSD.org/src/rev/d8b0ca798191
branches:  trunk
changeset: 473339:d8b0ca798191
user:      christos <christos%NetBSD.org@localhost>
date:      Sat May 29 20:44:20 1999 +0000

description:
Don't prepend directories if the plist files are absolute.

diffstat:

 usr.sbin/pkg_install/add/extract.c |  22 ++++++++++++++++------
 usr.sbin/pkg_install/admin/main.c  |  14 ++++++++++----
 usr.sbin/pkg_install/create/pl.c   |  11 ++++++++---
 usr.sbin/pkg_install/info/show.c   |   9 ++++++---
 usr.sbin/pkg_install/lib/plist.c   |   9 ++++++---
 5 files changed, 46 insertions(+), 19 deletions(-)

diffs (183 lines):

diff -r daf8568785fb -r d8b0ca798191 usr.sbin/pkg_install/add/extract.c
--- a/usr.sbin/pkg_install/add/extract.c        Sat May 29 19:13:04 1999 +0000
+++ b/usr.sbin/pkg_install/add/extract.c        Sat May 29 20:44:20 1999 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: extract.c,v 1.16 1999/03/12 17:32:20 tron Exp $        */
+/*     $NetBSD: extract.c,v 1.17 1999/05/29 20:44:20 christos Exp $    */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "FreeBSD - Id: extract.c,v 1.17 1997/10/08 07:45:35 charnier Exp";
 #else
-__RCSID("$NetBSD: extract.c,v 1.16 1999/03/12 17:32:20 tron Exp $");
+__RCSID("$NetBSD: extract.c,v 1.17 1999/05/29 20:44:20 christos Exp $");
 #endif
 #endif
 
@@ -69,7 +69,10 @@
     dir = home;
     for (q = start; q != stop; q = q->next) {
        if (q->type == PLIST_FILE) {
-           snprintf(try, FILENAME_MAX, "%s/%s", dir, q->name);
+           if (q->name[0] == '/')
+               snprintf(try, FILENAME_MAX, "%s", q->name);
+           else
+               snprintf(try, FILENAME_MAX, "%s/%s", dir, q->name);
            if (make_preserve_name(bup, FILENAME_MAX, name, try) && fexists(bup)) {
                (void)chflags(try, 0);
                (void)unlink(try);
@@ -140,8 +143,12 @@
 
        case PLIST_FILE:
            last_file = p->name;
-           if (Verbose)
-               printf("extract: %s/%s\n", Directory, p->name);
+           if (Verbose) {
+               if (p->name[0] == '/')
+                   printf("extract: %s\n", p->name);
+               else
+                   printf("extract: %s/%s\n", Directory, p->name);
+           }
            if (!Fake) {
                char try[FILENAME_MAX];
 
@@ -151,7 +158,10 @@
                }
                
                /* first try to rename it into place */
-               snprintf(try, FILENAME_MAX, "%s/%s", Directory, p->name);
+               if (p->name[0] == '/')
+                   snprintf(try, FILENAME_MAX, "%s", p->name);
+               else
+                   snprintf(try, FILENAME_MAX, "%s/%s", Directory, p->name);
                if (fexists(try)) {
                    (void)chflags(try, 0);      /* XXX hack - if truly immutable, rename fails */
                    if (preserve && PkgName) {
diff -r daf8568785fb -r d8b0ca798191 usr.sbin/pkg_install/admin/main.c
--- a/usr.sbin/pkg_install/admin/main.c Sat May 29 19:13:04 1999 +0000
+++ b/usr.sbin/pkg_install/admin/main.c Sat May 29 20:44:20 1999 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: main.c,v 1.3 1999/03/22 05:02:40 hubertf Exp $ */
+/*     $NetBSD: main.c,v 1.4 1999/05/29 20:44:21 christos Exp $        */
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.3 1999/03/22 05:02:40 hubertf Exp $");
+__RCSID("$NetBSD: main.c,v 1.4 1999/05/29 20:44:21 christos Exp $");
 #endif
 
 /*
@@ -84,7 +84,10 @@
                abort();
            }
                
-           snprintf(file, FILENAME_MAX, "%s/%s", dirp, p->name);
+           if (p->name[0] == '/')
+               snprintf(file, FILENAME_MAX, "%s", p->name);
+           else
+               snprintf(file, FILENAME_MAX, "%s/%s", dirp, p->name);
 
            if (!isfile(file))
                warnx("%s: File %s is in %s but not on filesystem!", PkgName, file, CONTENTS_FNAME);
@@ -208,7 +211,10 @@
                    abort();
                }
                
-               snprintf(file, FILENAME_MAX, "%s/%s", dirp, p->name);
+               if (p->name[0] == '/')
+                   snprintf(file, FILENAME_MAX, "%s", p->name);
+               else
+                   snprintf(file, FILENAME_MAX, "%s/%s", dirp, p->name);
 
                if (!isfile(file))
                    warnx("%s: File %s is in %s but not on filesystem!",
diff -r daf8568785fb -r d8b0ca798191 usr.sbin/pkg_install/create/pl.c
--- a/usr.sbin/pkg_install/create/pl.c  Sat May 29 19:13:04 1999 +0000
+++ b/usr.sbin/pkg_install/create/pl.c  Sat May 29 20:44:20 1999 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: pl.c,v 1.11 1999/03/02 10:32:23 agc Exp $      */
+/*     $NetBSD: pl.c,v 1.12 1999/05/29 20:44:21 christos Exp $ */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: pl.c,v 1.11 1997/10/08 07:46:35 charnier Exp";
 #else
-__RCSID("$NetBSD: pl.c,v 1.11 1999/03/02 10:32:23 agc Exp $");
+__RCSID("$NetBSD: pl.c,v 1.12 1999/05/29 20:44:21 christos Exp $");
 #endif
 #endif
 
@@ -163,7 +163,12 @@
                            }
                        }
 
-                       (void) snprintf(name, sizeof(name), "%s/%s", srcdir ? srcdir : cwd, p->name);
+                       if (p->name[0] == '/')
+                               (void) snprintf(name, sizeof(name), "%s",
+                                   p->name);
+                       else
+                               (void) snprintf(name, sizeof(name), "%s/%s",
+                                   srcdir ? srcdir : cwd, p->name);
                        if (lstat(name, &st) < 0) {
                                warnx("can't stat `%s'", name);
                                continue;
diff -r daf8568785fb -r d8b0ca798191 usr.sbin/pkg_install/info/show.c
--- a/usr.sbin/pkg_install/info/show.c  Sat May 29 19:13:04 1999 +0000
+++ b/usr.sbin/pkg_install/info/show.c  Sat May 29 20:44:20 1999 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: show.c,v 1.13 1999/05/15 03:27:50 hubertf Exp $        */
+/*     $NetBSD: show.c,v 1.14 1999/05/29 20:44:22 christos Exp $       */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: show.c,v 1.11 1997/10/08 07:47:38 charnier Exp";
 #else
-__RCSID("$NetBSD: show.c,v 1.13 1999/05/15 03:27:50 hubertf Exp $");
+__RCSID("$NetBSD: show.c,v 1.14 1999/05/29 20:44:22 christos Exp $");
 #endif
 #endif
 
@@ -213,7 +213,10 @@
                switch(p->type) {
                case PLIST_FILE:
                        if (!ign) {
-                               printf("%s/%s\n", dir, p->name);
+                               if (p->name[0] == '/')
+                                       printf("%s\n", p->name);
+                               else
+                                       printf("%s/%s\n", dir, p->name);
                        }
                        ign = FALSE;
                        break;
diff -r daf8568785fb -r d8b0ca798191 usr.sbin/pkg_install/lib/plist.c
--- a/usr.sbin/pkg_install/lib/plist.c  Sat May 29 19:13:04 1999 +0000
+++ b/usr.sbin/pkg_install/lib/plist.c  Sat May 29 20:44:20 1999 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: plist.c,v 1.18 1999/03/15 08:57:12 christos Exp $      */
+/*     $NetBSD: plist.c,v 1.19 1999/05/29 20:44:22 christos Exp $      */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: plist.c,v 1.24 1997/10/08 07:48:15 charnier Exp";
 #else
-__RCSID("$NetBSD: plist.c,v 1.18 1999/03/15 08:57:12 christos Exp $");
+__RCSID("$NetBSD: plist.c,v 1.19 1999/05/29 20:44:22 christos Exp $");
 #endif
 #endif
 
@@ -339,7 +339,10 @@
 
        case PLIST_FILE:
            last_file = p->name;
-           (void) snprintf(tmp, sizeof(tmp), "%s/%s", Where, p->name);
+           if (p->name[0] == '/')
+               (void) snprintf(tmp, sizeof(tmp), p->name);
+           else
+               (void) snprintf(tmp, sizeof(tmp), "%s/%s", Where, p->name);
            if (isdir(tmp)) {
                warnx("attempting to delete directory `%s' as a file\n"
           "this packing list is incorrect - ignoring delete request", tmp);



Home | Main Index | Thread Index | Old Index