pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files Pull in portability changes...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/47321778c133
branches:  trunk
changeset: 486540:47321778c133
user:      agc <agc%pkgsrc.org@localhost>
date:      Wed Dec 29 12:16:56 2004 +0000

description:
Pull in portability changes from src, and bump version to 20041226:

        Introduce a new abstraction in the C code, called MaxPathSize.  All
        previous occurrences of MAXPATHLEN and FILENAME_MAX have been changed
        to use MaxPathSize instead.

        If MAXPATHLEN is not defined, then assume a default value of 1024
        (this is primarily for use on the Hurd).

        The reason for this is that some older platforms define FILENAME_MAX
        to be 14, although MAXPATHLEN is 1024. On BSD-derived systems,
        FILENAME_MAX And MAXPATHLEN are both 1024.

        Bump pkg_install version to 20041226.

        These modifications have been tested so far on a NetBSD-current bulk
        build.

diffstat:

 pkgtools/pkg_install/files/add/extract.c    |  16 +++++-----
 pkgtools/pkg_install/files/add/main.c       |   6 ++--
 pkgtools/pkg_install/files/add/perform.c    |  42 ++++++++++++++--------------
 pkgtools/pkg_install/files/add/verify.c     |   6 ++--
 pkgtools/pkg_install/files/admin/main.c     |  32 +++++++++++-----------
 pkgtools/pkg_install/files/create/main.c    |   6 ++--
 pkgtools/pkg_install/files/create/perform.c |   8 ++--
 pkgtools/pkg_install/files/create/pl.c      |  14 ++++----
 pkgtools/pkg_install/files/delete/main.c    |   6 ++--
 pkgtools/pkg_install/files/delete/perform.c |  34 +++++++++++-----------
 pkgtools/pkg_install/files/info/main.c      |   6 ++--
 pkgtools/pkg_install/files/info/perform.c   |  28 +++++++++---------
 pkgtools/pkg_install/files/lib/file.c       |  28 +++++++++---------
 pkgtools/pkg_install/files/lib/ftpio.c      |  40 +++++++++++++-------------
 pkgtools/pkg_install/files/lib/lib.h        |  13 +++++++-
 pkgtools/pkg_install/files/lib/path.c       |   6 ++--
 pkgtools/pkg_install/files/lib/pen.c        |  10 +++---
 pkgtools/pkg_install/files/lib/pkgdb.c      |  14 ++++----
 pkgtools/pkg_install/files/lib/plist.c      |  18 ++++++------
 pkgtools/pkg_install/files/lib/str.c        |  18 ++++++------
 pkgtools/pkg_install/files/lib/version.h    |   4 +-
 21 files changed, 182 insertions(+), 173 deletions(-)

diffs (truncated from 1354 to 300 lines):

diff -r feb10fe7a1fa -r 47321778c133 pkgtools/pkg_install/files/add/extract.c
--- a/pkgtools/pkg_install/files/add/extract.c  Wed Dec 29 11:52:43 2004 +0000
+++ b/pkgtools/pkg_install/files/add/extract.c  Wed Dec 29 12:16:56 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extract.c,v 1.9 2004/08/20 20:09:53 jlam Exp $ */
+/*     $NetBSD: extract.c,v 1.10 2004/12/29 12:16:56 agc Exp $ */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -11,7 +11,7 @@
 #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.9 2004/08/20 20:09:53 jlam Exp $");
+__RCSID("$NetBSD: extract.c,v 1.10 2004/12/29 12:16:56 agc Exp $");
 #endif
 #endif
 
@@ -81,7 +81,7 @@
 rollback(char *name, char *home, plist_t *start, plist_t *stop)
 {
        plist_t *q;
-       char    try[FILENAME_MAX], bup[FILENAME_MAX], *dir;
+       char    try[MaxPathSize], bup[MaxPathSize], *dir;
 
        dir = home;
        for (q = start; q != stop; q = q->next) {
@@ -159,7 +159,7 @@
        }
        /* Do it */
        while (p) {
-               char    cmd[FILENAME_MAX];
+               char    cmd[MaxPathSize];
 
                switch (p->type) {
                case PLIST_NAME:
@@ -173,7 +173,7 @@
                        if (Verbose)
                                printf("extract: %s/%s\n", Directory, p->name);
                        if (!Fake) {
-                               char    try[FILENAME_MAX];
+                               char    try[MaxPathSize];
 
                                if (strrchr(p->name, '\'')) {
                                        cleanup(0);
@@ -187,7 +187,7 @@
                                        (void) chflags(try, 0); /* XXX hack - if truly immutable, rename fails */
 #endif
                                        if (preserve && PkgName) {
-                                               char    pf[FILENAME_MAX];
+                                               char    pf[MaxPathSize];
 
                                                if (make_preserve_name(pf, sizeof(pf), PkgName, try)) {
                                                        if (rename(try, pf)) {
@@ -205,7 +205,7 @@
                                if (rename(p->name, try) == 0) {
                                        /* note in pkgdb */
                                        {
-                                               char   *s, t[FILENAME_MAX];
+                                               char   *s, t[MaxPathSize];
                                                int     rc;
 
                                                (void) snprintf(t, sizeof(t), "%s/%s", Directory, p->name);
@@ -266,7 +266,7 @@
                                         * that would probably affect too much code I prefer
                                         * not to touch - HF */
                                        {
-                                               char   *s, t[FILENAME_MAX], *u;
+                                               char   *s, t[MaxPathSize], *u;
                                                int     rc;
 
                                                if (p->name[0] == '/')
diff -r feb10fe7a1fa -r 47321778c133 pkgtools/pkg_install/files/add/main.c
--- a/pkgtools/pkg_install/files/add/main.c     Wed Dec 29 11:52:43 2004 +0000
+++ b/pkgtools/pkg_install/files/add/main.c     Wed Dec 29 12:16:56 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.7 2004/12/09 20:10:34 erh Exp $     */
+/*     $NetBSD: main.c,v 1.8 2004/12/29 12:16:56 agc Exp $     */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -11,7 +11,7 @@
 #if 0
 static char *rcsid = "from FreeBSD Id: main.c,v 1.16 1997/10/08 07:45:43 charnier Exp";
 #else
-__RCSID("$NetBSD: main.c,v 1.7 2004/12/09 20:10:34 erh Exp $");
+__RCSID("$NetBSD: main.c,v 1.8 2004/12/29 12:16:56 agc Exp $");
 #endif
 #endif
 
@@ -63,7 +63,7 @@
 char   *Group = NULL;
 char   *PkgName = NULL;
 char   *Directory = NULL;
-char    FirstPen[FILENAME_MAX];
+char    FirstPen[MaxPathSize];
 add_mode_t AddMode = NORMAL;
 int     Replace = 0;
 
diff -r feb10fe7a1fa -r 47321778c133 pkgtools/pkg_install/files/add/perform.c
--- a/pkgtools/pkg_install/files/add/perform.c  Wed Dec 29 11:52:43 2004 +0000
+++ b/pkgtools/pkg_install/files/add/perform.c  Wed Dec 29 12:16:56 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.26 2004/12/09 20:10:34 erh Exp $ */
+/*     $NetBSD: perform.c,v 1.27 2004/12/29 12:16:56 agc Exp $ */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -11,7 +11,7 @@
 #if 0
 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
 #else
-__RCSID("$NetBSD: perform.c,v 1.26 2004/12/09 20:10:34 erh Exp $");
+__RCSID("$NetBSD: perform.c,v 1.27 2004/12/29 12:16:56 agc Exp $");
 #endif
 #endif
 
@@ -58,7 +58,7 @@
 #include <sys/utsname.h>
 #endif
 
-static char LogDir[FILENAME_MAX];
+static char LogDir[MaxPathSize];
 static int zapLogDir;          /* Should we delete LogDir? */
 
 static package_t Plist;
@@ -184,14 +184,14 @@
 static int
 pkg_do(const char *pkg, lpkg_head_t *pkgs)
 {
-       char    playpen[FILENAME_MAX];
-       char    replace_from[FILENAME_MAX];
-       char    replace_via[FILENAME_MAX];
-       char    replace_to[FILENAME_MAX];
+       char    playpen[MaxPathSize];
+       char    replace_from[MaxPathSize];
+       char    replace_via[MaxPathSize];
+       char    replace_to[MaxPathSize];
        char   *buildinfo[BI_ENUM_COUNT];
        int     replacing = 0;
        char   *where_to;
-       char   dbdir[FILENAME_MAX];
+       char   dbdir[MaxPathSize];
        const char *exact, *extra1;
        FILE   *cfile;
        int     errc, err_prescan;
@@ -214,7 +214,7 @@
        /* Are we coming in for a second pass, everything already extracted?
         * (Slave mode) */
        if (!pkg) {
-               fgets(playpen, FILENAME_MAX, stdin);
+               fgets(playpen, MaxPathSize, stdin);
                playpen[strlen(playpen) - 1] = '\0';    /* remove newline! */
                if (chdir(playpen) == FAIL) {
                        warnx("add in SLAVE mode can't chdir to %s", playpen);
@@ -484,8 +484,8 @@
                char   *s;
 
                if ((s = strrchr(PkgName, '-')) != NULL) {
-                       char    buf[FILENAME_MAX];
-                       char    installed[FILENAME_MAX];
+                       char    buf[MaxPathSize];
+                       char    installed[MaxPathSize];
 
                        /*
                         * See if the pkg is already installed. If so, we might
@@ -512,7 +512,7 @@
                                                 * (from +REQUIRED_BY) that require this pkg
                                                 */
                                                FILE *rb;                     /* +REQUIRED_BY file */
-                                               char pkg2chk[FILENAME_MAX];
+                                               char pkg2chk[MaxPathSize];
 
                                                rb = fopen(replace_from, "r");
                                                if (! rb) {
@@ -527,7 +527,7 @@
                                                        package_t depPlist;
                                                        FILE *depf;
                                                        plist_t *depp;
-                                                       char depC[FILENAME_MAX];
+                                                       char depC[MaxPathSize];
                                                        
                                                        s = strrchr(pkg2chk, '\n');
                                                        if (s)
@@ -551,8 +551,8 @@
                                                        fclose(depf);
                                                        
                                                        for (depp = depPlist.head; depp; depp = depp->next) {
-                                                               char base_new[FILENAME_MAX];
-                                                               char base_exist[FILENAME_MAX];
+                                                               char base_new[MaxPathSize];
+                                                               char base_exist[MaxPathSize];
                                                                char *s2;
                                                                
                                                                if (depp->type != PLIST_PKGDEP)
@@ -632,7 +632,7 @@
 
        /* See if there are conflicting packages installed */
        for (p = Plist.head; p; p = p->next) {
-               char    installed[FILENAME_MAX];
+               char    installed[MaxPathSize];
 
                if (p->type != PLIST_PKGCFL)
                        continue;
@@ -650,7 +650,7 @@
         */
        err_prescan=0;
        for (p = Plist.head; p; p = p->next) {
-               char installed[FILENAME_MAX];
+               char installed[MaxPathSize];
                
                if (p->type != PLIST_PKGDEP)
                        continue;
@@ -683,7 +683,7 @@
                        }
                        
                        if (skip >= 0) {
-                               char    buf[FILENAME_MAX];
+                               char    buf[MaxPathSize];
                
                                (void) snprintf(buf, sizeof(buf),
                                    skip ? "%.*s[0-9]*" : "%.*s-[0-9]*",
@@ -695,7 +695,7 @@
                                        if (Replace > 1)
                                        {
                                                int errc0 = 0;
-                                               char tmp[FILENAME_MAX];
+                                               char tmp[MaxPathSize];
 
                                                warnx("Attempting to update `%s' using binary package\n", p->name);
                                                /* Yes, append .tgz after the version so the */
@@ -731,7 +731,7 @@
 
        /* Now check the packing list for dependencies */
        for (exact = NULL, p = Plist.head; p; p = p->next) {
-               char    installed[FILENAME_MAX];
+               char    installed[MaxPathSize];
 
                if (p->type == PLIST_BLDDEP) {
                        exact = p->name;
@@ -842,7 +842,7 @@
 
        /* Time to record the deed? */
        if (!NoRecord && !Fake) {
-               char    contents[FILENAME_MAX];
+               char    contents[MaxPathSize];
 
 #ifndef __INTERIX
                if (getuid() != 0)
diff -r feb10fe7a1fa -r 47321778c133 pkgtools/pkg_install/files/add/verify.c
--- a/pkgtools/pkg_install/files/add/verify.c   Wed Dec 29 11:52:43 2004 +0000
+++ b/pkgtools/pkg_install/files/add/verify.c   Wed Dec 29 12:16:56 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: verify.c,v 1.6 2004/04/07 22:44:23 agc Exp $ */
+/* $NetBSD: verify.c,v 1.7 2004/12/29 12:16:56 agc Exp $ */
 
 /*
  * Copyright (c) 2001 Alistair G. Crooks.  All rights reserved.
@@ -41,7 +41,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1999 \
                The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: verify.c,v 1.6 2004/04/07 22:44:23 agc Exp $");
+__RCSID("$NetBSD: verify.c,v 1.7 2004/12/29 12:16:56 agc Exp $");
 #endif
 
 #if HAVE_SYS_TYPES_H
@@ -91,7 +91,7 @@
        struct stat     st;
        const char    *const *ep;
        char            buf[BUFSIZ];
-       char            f[FILENAME_MAX];
+       char            f[MaxPathSize];
        int             ret;
        int             i;
 
diff -r feb10fe7a1fa -r 47321778c133 pkgtools/pkg_install/files/admin/main.c
--- a/pkgtools/pkg_install/files/admin/main.c   Wed Dec 29 11:52:43 2004 +0000
+++ b/pkgtools/pkg_install/files/admin/main.c   Wed Dec 29 12:16:56 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.16 2004/08/20 20:09:53 jlam Exp $   */
+/*     $NetBSD: main.c,v 1.17 2004/12/29 12:16:56 agc Exp $    */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -8,7 +8,7 @@
 #include <sys/cdefs.h>
 #endif
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.16 2004/08/20 20:09:53 jlam Exp $");
+__RCSID("$NetBSD: main.c,v 1.17 2004/12/29 12:16:56 agc Exp $");
 #endif
 
 /*
@@ -114,8 +114,8 @@
        plist_t *p;
        package_t Plist;
        char   *PkgName, *dirp = NULL, *md5file;
-       char    file[FILENAME_MAX];
-       char    dir[FILENAME_MAX];



Home | Main Index | Thread Index | Old Index