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 Remove support for absolutes pathnames ...



details:   https://anonhg.NetBSD.org/src/rev/efe7d68698b8
branches:  trunk
changeset: 473349:efe7d68698b8
user:      tron <tron%NetBSD.org@localhost>
date:      Sun May 30 16:08:23 1999 +0000

description:
Remove support for absolutes pathnames completely. This can't work with
binary packages like we support them now.

diffstat:

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

diffs (224 lines):

diff -r 376211e53f88 -r efe7d68698b8 usr.sbin/pkg_install/add/extract.c
--- a/usr.sbin/pkg_install/add/extract.c        Sun May 30 07:36:28 1999 +0000
+++ b/usr.sbin/pkg_install/add/extract.c        Sun May 30 16:08:23 1999 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: extract.c,v 1.17 1999/05/29 20:44:20 christos Exp $    */
+/*     $NetBSD: extract.c,v 1.18 1999/05/30 16:08:23 tron 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.17 1999/05/29 20:44:20 christos Exp $");
+__RCSID("$NetBSD: extract.c,v 1.18 1999/05/30 16:08:23 tron Exp $");
 #endif
 #endif
 
@@ -69,10 +69,7 @@
     dir = home;
     for (q = start; q != stop; q = q->next) {
        if (q->type == PLIST_FILE) {
-           if (q->name[0] == '/')
-               snprintf(try, FILENAME_MAX, "%s", q->name);
-           else
-               snprintf(try, FILENAME_MAX, "%s/%s", dir, q->name);
+           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);
@@ -143,12 +140,8 @@
 
        case PLIST_FILE:
            last_file = p->name;
-           if (Verbose) {
-               if (p->name[0] == '/')
-                   printf("extract: %s\n", p->name);
-               else
-                   printf("extract: %s/%s\n", Directory, p->name);
-           }
+           if (Verbose)
+               printf("extract: %s/%s\n", Directory, p->name);
            if (!Fake) {
                char try[FILENAME_MAX];
 
@@ -158,10 +151,7 @@
                }
                
                /* first try to rename it into place */
-               if (p->name[0] == '/')
-                   snprintf(try, FILENAME_MAX, "%s", p->name);
-               else
-                   snprintf(try, FILENAME_MAX, "%s/%s", Directory, p->name);
+               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) {
@@ -181,17 +171,12 @@
                if (rename(p->name, try) == 0) {
                    /* note in pkgdb */
                    {
-                       char *s, t[FILENAME_MAX], *u;
+                       char *s, t[FILENAME_MAX];
                        int rc;
                        
-                       if (p->name[0] == '/')
-                           u=p->name;
-                       else {
-                           snprintf(t, FILENAME_MAX, "%s/%s", Directory, p->name);
-                           u=t;
-                       }
+                       snprintf(t, FILENAME_MAX, "%s/%s", Directory, p->name);
                        
-                       s=pkgdb_retrieve(u);
+                       s=pkgdb_retrieve(t);
 #ifdef PKGDB_DEBUG
  printf("pkgdb_retrieve(\"%s\")=\"%s\"\n", t, s); /* pkgdb-debug - HF */
 #endif
diff -r 376211e53f88 -r efe7d68698b8 usr.sbin/pkg_install/admin/main.c
--- a/usr.sbin/pkg_install/admin/main.c Sun May 30 07:36:28 1999 +0000
+++ b/usr.sbin/pkg_install/admin/main.c Sun May 30 16:08:23 1999 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: main.c,v 1.4 1999/05/29 20:44:21 christos Exp $        */
+/*     $NetBSD: main.c,v 1.5 1999/05/30 16:08:24 tron Exp $    */
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.4 1999/05/29 20:44:21 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.5 1999/05/30 16:08:24 tron Exp $");
 #endif
 
 /*
@@ -84,10 +84,7 @@
                abort();
            }
                
-           if (p->name[0] == '/')
-               snprintf(file, FILENAME_MAX, "%s", p->name);
-           else
-               snprintf(file, FILENAME_MAX, "%s/%s", dirp, p->name);
+           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);
@@ -211,10 +208,7 @@
                    abort();
                }
                
-               if (p->name[0] == '/')
-                   snprintf(file, FILENAME_MAX, "%s", p->name);
-               else
-                   snprintf(file, FILENAME_MAX, "%s/%s", dirp, p->name);
+               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 376211e53f88 -r efe7d68698b8 usr.sbin/pkg_install/create/pl.c
--- a/usr.sbin/pkg_install/create/pl.c  Sun May 30 07:36:28 1999 +0000
+++ b/usr.sbin/pkg_install/create/pl.c  Sun May 30 16:08:23 1999 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: pl.c,v 1.12 1999/05/29 20:44:21 christos Exp $ */
+/*     $NetBSD: pl.c,v 1.13 1999/05/30 16:08:25 tron 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.12 1999/05/29 20:44:21 christos Exp $");
+__RCSID("$NetBSD: pl.c,v 1.13 1999/05/30 16:08:25 tron Exp $");
 #endif
 #endif
 
@@ -139,16 +139,11 @@
                         * starts, it's ok to do this somewhere here 
                         */
                        {
-                           char *s, t[FILENAME_MAX], *u;
+                           char *s, t[FILENAME_MAX];
                            
-                           if (p->name[0] == '/')
-                               u=p->name;
-                           else {
-                               snprintf(t, FILENAME_MAX, "%s/%s", cwd, p->name);
-                               u=t;
-                           }
+                           snprintf(t, FILENAME_MAX, "%s/%s", cwd, p->name);
                            
-                           s=pkgdb_retrieve(u);
+                           s=pkgdb_retrieve(t);
 #ifdef PKGDB_DEBUG
  fprintf(stderr, "pkgdb_retrieve(\"%s\")=\"%s\"\n", t, s); /* pkgdb-debug - HF */
 #endif
@@ -163,12 +158,7 @@
                            }
                        }
 
-                       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);
+                       (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 376211e53f88 -r efe7d68698b8 usr.sbin/pkg_install/info/show.c
--- a/usr.sbin/pkg_install/info/show.c  Sun May 30 07:36:28 1999 +0000
+++ b/usr.sbin/pkg_install/info/show.c  Sun May 30 16:08:23 1999 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: show.c,v 1.14 1999/05/29 20:44:22 christos Exp $       */
+/*     $NetBSD: show.c,v 1.15 1999/05/30 16:08:25 tron 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.14 1999/05/29 20:44:22 christos Exp $");
+__RCSID("$NetBSD: show.c,v 1.15 1999/05/30 16:08:25 tron Exp $");
 #endif
 #endif
 
@@ -213,10 +213,7 @@
                switch(p->type) {
                case PLIST_FILE:
                        if (!ign) {
-                               if (p->name[0] == '/')
-                                       printf("%s\n", p->name);
-                               else
-                                       printf("%s/%s\n", dir, p->name);
+                               printf("%s/%s\n", dir, p->name);
                        }
                        ign = FALSE;
                        break;
diff -r 376211e53f88 -r efe7d68698b8 usr.sbin/pkg_install/lib/plist.c
--- a/usr.sbin/pkg_install/lib/plist.c  Sun May 30 07:36:28 1999 +0000
+++ b/usr.sbin/pkg_install/lib/plist.c  Sun May 30 16:08:23 1999 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: plist.c,v 1.19 1999/05/29 20:44:22 christos Exp $      */
+/*     $NetBSD: plist.c,v 1.20 1999/05/30 16:08:26 tron 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.19 1999/05/29 20:44:22 christos Exp $");
+__RCSID("$NetBSD: plist.c,v 1.20 1999/05/30 16:08:26 tron Exp $");
 #endif
 #endif
 
@@ -339,10 +339,7 @@
 
        case PLIST_FILE:
            last_file = p->name;
-           if (p->name[0] == '/')
-               (void) snprintf(tmp, sizeof(tmp), p->name);
-           else
-               (void) snprintf(tmp, sizeof(tmp), "%s/%s", Where, p->name);
+           (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