pkgsrc-Bugs archive

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

Re: pkg/45065: archivers/pax minix support



The following reply was made to PR pkg/45065; it has been noted by GNATS.

From: Thomas Cort <tcort%netbsd.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: pkg/45065: archivers/pax minix support
Date: Sat, 5 Nov 2011 20:42:40 -0400

 I've cleaned up the patch a little by using the feature macros defined by
 autotools (HAVE_SETRLIMIT and HAVE_GETRLIMIT) instead of "__minix". The new
 patch follows...
 
 
  
  Patch Summary:
 
  
   * Rename TODEV, MAJOR, and MINOR to PAX_TODEV, PAX_MAJOR, and PAX_MINOR
     to avoid a conflict with existing Minix macros.
 
  
   * setrlimit() isn't implemented on Minix, so bypass the getrlimit() /
     setrlimit() pairs if either function is missing.
 
  
   * Minix has smaller types, so define MFTENT_DUMMY_DEV to be SHRT_MAX
     instead of UINT_MAX when __minix is defined.
 
 
 
 
 Index: files/cpio.c
 ===================================================================
 RCS file: /cvsroot/pkgsrc/archivers/pax/files/cpio.c,v
 retrieving revision 1.6
 diff -u -p -r1.6 cpio.c
 --- files/cpio.c       8 Mar 2007 17:18:18 -0000       1.6
 +++ files/cpio.c       6 Nov 2011 00:34:47 -0000
 @@ -614,10 +614,10 @@ vcpio_rd(ARCHD *arcn, char *buf)
            HEX);
        devmajor = (dev_t)asc_ul(hd->c_maj, sizeof(hd->c_maj), HEX);
        devminor = (dev_t)asc_ul(hd->c_min, sizeof(hd->c_min), HEX);
 -      arcn->sb.st_dev = TODEV(devmajor, devminor);
 +      arcn->sb.st_dev = PAX_TODEV(devmajor, devminor);
        devmajor = (dev_t)asc_ul(hd->c_rmaj, sizeof(hd->c_maj), HEX);
        devminor = (dev_t)asc_ul(hd->c_rmin, sizeof(hd->c_min), HEX);
 -      arcn->sb.st_rdev = TODEV(devmajor, devminor);
 +      arcn->sb.st_rdev = PAX_TODEV(devmajor, devminor);
        arcn->crc = asc_ul(hd->c_chksum, sizeof(hd->c_chksum), HEX);
  
        /*
 @@ -787,13 +787,13 @@ vcpio_wr(ARCHD *arcn)
                HEX) ||
            ul_asc((u_long)arcn->sb.st_nlink, hd->c_nlink, sizeof(hd->c_nlink),
                HEX) ||
 -          ul_asc((u_long)MAJOR(arcn->sb.st_dev),hd->c_maj, sizeof(hd->c_maj),
 +          ul_asc((u_long)PAX_MAJOR(arcn->sb.st_dev),hd->c_maj, 
sizeof(hd->c_maj),
                HEX) ||
 -          ul_asc((u_long)MINOR(arcn->sb.st_dev),hd->c_min, sizeof(hd->c_min),
 +          ul_asc((u_long)PAX_MINOR(arcn->sb.st_dev),hd->c_min, 
sizeof(hd->c_min),
                HEX) ||
 -          ul_asc((u_long)MAJOR(arcn->sb.st_rdev),hd->c_rmaj,sizeof(hd->c_maj),
 +          
ul_asc((u_long)PAX_MAJOR(arcn->sb.st_rdev),hd->c_rmaj,sizeof(hd->c_maj),
                HEX) ||
 -          ul_asc((u_long)MINOR(arcn->sb.st_rdev),hd->c_rmin,sizeof(hd->c_min),
 +          
ul_asc((u_long)PAX_MINOR(arcn->sb.st_rdev),hd->c_rmin,sizeof(hd->c_min),
                HEX) ||
            ul_asc((u_long)nsz, hd->c_namesize, sizeof(hd->c_namesize), HEX))
                goto out;
 Index: files/ftree.c
 ===================================================================
 RCS file: /cvsroot/pkgsrc/archivers/pax/files/ftree.c,v
 retrieving revision 1.12
 diff -u -p -r1.12 ftree.c
 --- files/ftree.c      29 Apr 2008 05:46:09 -0000      1.12
 +++ files/ftree.c      6 Nov 2011 00:34:47 -0000
 @@ -451,7 +451,11 @@ next_file(ARCHD *arcn)
        int             cnt;
        time_t          atime, mtime;
        char            *curlink;
 +#ifndef __minix
  #define MFTENT_DUMMY_DEV      UINT_MAX
 +#else
 +#define MFTENT_DUMMY_DEV SHRT_MAX
 +#endif
  
        curlink = NULL;
  #ifndef SMALL
 Index: files/gen_subs.c
 ===================================================================
 RCS file: /cvsroot/pkgsrc/archivers/pax/files/gen_subs.c,v
 retrieving revision 1.8
 diff -u -p -r1.8 gen_subs.c
 --- files/gen_subs.c   8 Mar 2007 17:18:18 -0000       1.8
 +++ files/gen_subs.c   6 Nov 2011 00:34:47 -0000
 @@ -167,8 +167,8 @@ ls_list(ARCHD *arcn, time_t now, FILE *f
         * print device id's for devices, or sizes for other nodes
         */
        if ((arcn->type == PAX_CHR) || (arcn->type == PAX_BLK))
 -              (void)fprintf(fp, "%4lu,%4lu ", (long) MAJOR(sbp->st_rdev),
 -                  (long) MINOR(sbp->st_rdev));
 +              (void)fprintf(fp, "%4lu,%4lu ", (long) PAX_MAJOR(sbp->st_rdev),
 +                  (long) PAX_MINOR(sbp->st_rdev));
        else {
                (void)fprintf(fp, OFFT_FP("9") " ", (OFFT_T)sbp->st_size);
        }
 Index: files/pack_dev.c
 ===================================================================
 RCS file: /cvsroot/pkgsrc/archivers/pax/files/pack_dev.c,v
 retrieving revision 1.4
 diff -u -p -r1.4 pack_dev.c
 --- files/pack_dev.c   29 Apr 2008 05:46:09 -0000      1.4
 +++ files/pack_dev.c   6 Nov 2011 00:34:47 -0000
 @@ -90,7 +90,7 @@ pack_native(int n, u_long numbers[], con
        portdev_t dev = 0;
  
        if (n == 2) {
 -              dev = TODEV(numbers[0], numbers[1]);
 +              dev = PAX_TODEV(numbers[0], numbers[1]);
                if (major(dev) != numbers[0])
                        *error = iMajorError;
                else if (minor(dev) != numbers[1])
 Index: files/pax.c
 ===================================================================
 RCS file: /cvsroot/pkgsrc/archivers/pax/files/pax.c,v
 retrieving revision 1.9
 diff -u -p -r1.9 pax.c
 --- files/pax.c        8 Mar 2007 17:18:18 -0000       1.9
 +++ files/pax.c        6 Nov 2011 00:34:47 -0000
 @@ -405,6 +405,7 @@ gen_init(void)
        struct sigaction n_hand;
        struct sigaction o_hand;
  
 +#if defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT)
        /*
         * Really needed to handle large archives. We can run out of memory for
         * internal tables really fast when we have a whole lot of files...
 @@ -440,7 +441,7 @@ gen_init(void)
                (void)setrlimit(RLIMIT_RSS , &reslimit);
        }
  #endif
 -
 +#endif /* defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) */
        /*
         * Handle posix locale
         *
 Index: files/pax.h
 ===================================================================
 RCS file: /cvsroot/pkgsrc/archivers/pax/files/pax.h,v
 retrieving revision 1.12
 diff -u -p -r1.12 pax.h
 --- files/pax.h        30 Jan 2010 08:46:20 -0000      1.12
 +++ files/pax.h        6 Nov 2011 00:34:47 -0000
 @@ -247,22 +247,22 @@ typedef struct oplist {
  
  #ifdef HOSTPROG
  # include "pack_dev.h"                        /* explicitly use NetBSD's 
macros */
 -# define MAJOR(x)     major_netbsd(x)
 -# define MINOR(x)     minor_netbsd(x)
 -# define TODEV(x, y)  makedev_netbsd((x), (y))
 +# define PAX_MAJOR(x) major_netbsd(x)
 +# define PAX_MINOR(x) minor_netbsd(x)
 +# define PAX_TODEV(x, y)      makedev_netbsd((x), (y))
  #else
  # ifdef __HAIKU__
  #  define major(x)            ((int)(0x00ff & ((x) >> 8)))
  #  define minor(x)            ((int)(0xffff00ff & (x)))
  #  define makedev(maj,min)    ((0xff00 & ((maj)<<8))|(0xffff00ff & (min)))
  # endif
 -# define MAJOR(x)     major(x)
 -# define MINOR(x)     minor(x)
 +# define PAX_MAJOR(x) major(x)
 +# define PAX_MINOR(x) minor(x)
  # ifdef __QNXNTO__
  # include <sys/netmgr.h>
 -#  define TODEV(x, y) makedev(ND_LOCAL_NODE, (x), (y))
 +#  define PAX_TODEV(x, y)     makedev(ND_LOCAL_NODE, (x), (y))
  # else
 -#  define TODEV(x, y) makedev((x), (y))
 +#  define PAX_TODEV(x, y)     makedev((x), (y))
  # endif
  #endif
  
 Index: files/tar.c
 ===================================================================
 RCS file: /cvsroot/pkgsrc/archivers/pax/files/tar.c,v
 retrieving revision 1.11
 diff -u -p -r1.11 tar.c
 --- files/tar.c        8 Mar 2007 17:18:18 -0000       1.11
 +++ files/tar.c        6 Nov 2011 00:34:47 -0000
 @@ -941,7 +941,7 @@ ustar_rd(ARCHD *arcn, char *buf)
                }
                devmajor = (dev_t)asc_ul(hd->devmajor,sizeof(hd->devmajor),OCT);
                devminor = (dev_t)asc_ul(hd->devminor,sizeof(hd->devminor),OCT);
 -              arcn->sb.st_rdev = TODEV(devmajor, devminor);
 +              arcn->sb.st_rdev = PAX_TODEV(devmajor, devminor);
                break;
        case SYMTYPE:
        case LNKTYPE:
 @@ -1155,9 +1155,9 @@ ustar_wr(ARCHD *arcn)
                        hd->typeflag = CHRTYPE;
                else
                        hd->typeflag = BLKTYPE;
 -              if (ul_oct((u_long)MAJOR(arcn->sb.st_rdev), hd->devmajor,
 +              if (ul_oct((u_long)PAX_MAJOR(arcn->sb.st_rdev), hd->devmajor,
                   sizeof(hd->devmajor), 3) ||
 -                 ul_oct((u_long)MINOR(arcn->sb.st_rdev), hd->devminor,
 +                 ul_oct((u_long)PAX_MINOR(arcn->sb.st_rdev), hd->devminor,
                   sizeof(hd->devminor), 3) ||
                   ul_oct((u_long)0L, hd->size, sizeof(hd->size), 3))
                        return size_err("DEVTYPE", arcn);
 


Home | Main Index | Thread Index | Old Index