source: npl/overig/archivetools/pax/pax-3.3-modifyWarn.patch @ 516e1e9

gcc484perl-5.22
Last change on this file since 516e1e9 was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100644
File size: 18.7 KB
  • src/ar_io.c

    diff -Nur pax-3.3-gcc/src/ar_io.c pax-3.3-modifyWarn/src/ar_io.c
    old new  
    492492
    493493        if (!invld_rec)
    494494                return(0);
    495         paxwarn(1,"Cannot append, device record size %d does not support %s spec",
    496                 rdblksz, argv0);
     495        paxwarn(1,
     496          "Cannot append, device record size %d does not support %s spec",
     497          rdblksz, argv0);
    497498        return(-1);
    498499}
    499500
  • src/ar_subs.c

    diff -Nur pax-3.3-gcc/src/ar_subs.c pax-3.3-modifyWarn/src/ar_subs.c
    old new  
    459459                         * the link table).
    460460                         */
    461461                        if ((fd = open(arcn->org_name, O_RDONLY, 0)) < 0) {
    462                                 syswarn(1,errno, "Unable to open %s to read",
     462                                syswarn (errno == ENOENT ? 2 : 1, errno,
     463                                        "Unable to open %s to read",
    463464                                        arcn->org_name);
    464465                                purg_lnk(arcn);
    465466                                continue;
     
    940941                 * first open source file and then create the destination file
    941942                 */
    942943                if ((fdsrc = open(arcn->org_name, O_RDONLY, 0)) < 0) {
    943                         syswarn(1, errno, "Unable to open %s to read",
    944                             arcn->org_name);
     944                        syswarn (errno == ENOENT ? 2 : 1, errno,
     945                                "Unable to open %s to read", arcn->org_name);
    945946                        purg_lnk(arcn);
    946947                        continue;
    947948                }
  • src/buf_subs.c

    diff -Nur pax-3.3-gcc/src/buf_subs.c pax-3.3-modifyWarn/src/buf_subs.c
    old new  
    594594/*
    595595 * wr_rdfile()
    596596 *      fill write buffer with the contents of a file. We are passed an open
    597  *      file descriptor to the file an the archive structure that describes the
     597 *      file descriptor to an archive structure that describes the
    598598 *      file we are storing. The variable "left" is modified to contain the
    599599 *      number of bytes of the file we were NOT able to write to the archive.
    600600 *      it is important that we always write EXACTLY the number of bytes that
     
    602602 *      bigger, so reading to the end of file would create an improper archive,
    603603 *      we just detect this case and warn the user. We never create a bad
    604604 *      archive if we can avoid it. Of course trying to archive files that are
    605  *      active is asking for trouble. It we fail, we pass back how much we
     605 *      active is asking for trouble. If we fail, we pass back how much we
    606606 *      could NOT copy and let the caller deal with it.
    607607 * Return:
    608608 *      0 ok, -1 if archive write failure. a short read of the file returns a
     
    640640        if (res < 0)
    641641                syswarn(1, errno, "Read fault on %s", arcn->org_name);
    642642        else if (size != 0L)
    643                 paxwarn(1, "File changed size during read %s", arcn->org_name);
     643                paxwarn(2, "File changed size during read %s", arcn->org_name);
    644644        else if (fstat(ifd, &sb) < 0)
    645645                syswarn(1, errno, "Failed stat on %s", arcn->org_name);
    646646        else if (arcn->sb.st_mtime != sb.st_mtime)
    647                 paxwarn(1, "File %s was modified during copy to archive",
     647                paxwarn(2, "File %s was modified during copy to archive",
    648648                        arcn->org_name);
    649649        *left = size;
    650650        return(0);
     
    813813                syswarn(1, errno, "Failed write during copy of %s to %s",
    814814                        arcn->org_name, arcn->name);
    815815        else if (cpcnt != arcn->sb.st_size)
    816                 paxwarn(1, "File %s changed size during copy to %s",
     816                paxwarn(2, "File %s changed size during copy to %s",
    817817                        arcn->org_name, arcn->name);
    818818        else if (fstat(fd1, &sb) < 0)
    819819                syswarn(1, errno, "Failed stat of %s", arcn->org_name);
    820820        else if (arcn->sb.st_mtime != sb.st_mtime)
    821                 paxwarn(1, "File %s was modified during copy to %s",
     821                paxwarn(2, "File %s was modified during copy to %s",
    822822                        arcn->org_name, arcn->name);
    823823
    824824        /*
  • src/cpio.1

    diff -Nur pax-3.3-gcc/src/cpio.1 pax-3.3-modifyWarn/src/cpio.1
    old new  
    3939.Sh SYNOPSIS
    4040.Nm cpio
    4141.Fl o
    42 .Op Fl aABcLvzZ
     42.Op Fl aABcLMvzZ
    4343.Op Fl C Ar bytes
    4444.Op Fl F Ar archive
    4545.Op Fl H Ar format
     
    5858.Op Ar "< archive"
    5959.Nm cpio
    6060.Fl p
    61 .Op Fl adlLmuv
     61.Op Fl adlLmMuv
    6262.Ar destination-directory
    6363.Ar "< name-list"
    6464.Sh DESCRIPTION
     
    117117.El
    118118.It Fl L
    119119Follow symbolic links.
     120.It Fl M
     121Do not treat files being modified or deleted during the copy as an error.
    120122.It Fl v
    121123Be verbose about operations.
    122124List filenames as they are written to the archive.
     
    255257find a file while writing an archive, or cannot preserve the user
    256258ID, group ID, file mode, or access and modification times when the
    257259.Fl p
    258 option is specified, a diagnostic message is written to standard
     260option is specified, or a file is modified or deleted when the
     261.Fl M
     262option is not specified, a diagnostic message is written to standard
    259263error and a non-zero exit value will be returned, but processing
    260264will continue.
    261265In the case where
  • src/extern.h

    diff -Nur pax-3.3-gcc/src/extern.h pax-3.3-modifyWarn/src/extern.h
    old new  
    223223extern int Dflag;
    224224extern int Hflag;
    225225extern int Lflag;
     226extern int Mflag;
    226227extern int Xflag;
    227228extern int Yflag;
    228229extern int Zflag;
  • src/file_subs.c

    diff -Nur pax-3.3-gcc/src/file_subs.c pax-3.3-modifyWarn/src/file_subs.c
    old new  
    10031003         * they can create inconsistant archive copies.
    10041004         */
    10051005        if (cpcnt != arcn->sb.st_size)
    1006                 paxwarn(1, "File changed size %s", arcn->org_name);
     1006                paxwarn(2, "File changed size during read %s", arcn->org_name);
    10071007        else if (fstat(fd, &sb) < 0)
    10081008                syswarn(1, errno, "Failed stat on %s", arcn->org_name);
    10091009        else if (arcn->sb.st_mtime != sb.st_mtime)
    1010                 paxwarn(1, "File %s was modified during read", arcn->org_name);
     1010                paxwarn(2, "File %s was modified during read", arcn->org_name);
    10111011        else if (lseek(fd, (off_t)0L, SEEK_SET) < 0)
    10121012                syswarn(1, errno, "File rewind failed on: %s", arcn->org_name);
    10131013        else {
  • src/ftree.c

    diff -Nur pax-3.3-gcc/src/ftree.c pax-3.3-modifyWarn/src/ftree.c
    old new  
    404404                        paxwarn(1,"File system cycle found at %s",ftent->fts_path);
    405405                        continue;
    406406                case FTS_DNR:
    407                         syswarn(1, ftent->fts_errno,
     407                        syswarn(ftent->fts_errno == ENOENT ? 2 : 1,
     408                            ftent->fts_errno,
    408409                            "Unable to read directory %s", ftent->fts_path);
    409410                        continue;
    410411                case FTS_ERR:
     
    412413                            "File system traversal error");
    413414                        continue;
    414415                case FTS_NS:
    415                 case FTS_NSOK:
    416                         syswarn(1, ftent->fts_errno,
     416                        syswarn(ftent->fts_errno == ENOENT ? 2 : 1,
     417                            ftent->fts_errno,
    417418                            "Unable to access %s", ftent->fts_path);
    418419                        continue;
     420                case FTS_NSOK:
     421                        paxwarn(1, "Unable to access %s", ftent->fts_path);
     422                        continue;
    419423                }
    420424
    421425                /*
     
    470474                         */
    471475                        if ((cnt = readlink(ftent->fts_path, arcn->ln_name,
    472476                            PAXPATHLEN)) < 0) {
    473                                 syswarn(1, errno, "Unable to read symlink %s",
     477                                syswarn(errno == ENOENT ? 2 : 1, errno,
     478                                    "Unable to read symlink %s",
    474479                                    ftent->fts_path);
    475480                                continue;
    476481                        }
  • src/options.c

    diff -Nur pax-3.3-gcc/src/options.c pax-3.3-modifyWarn/src/options.c
    old new  
    198198        /*
    199199         * process option flags
    200200         */
    201         while ((c=getopt(argc,argv,"ab:cdf:iklno:p:rs:tuvwx:zB:DE:G:HLPT:U:XYZ"))
    202             != -1) {
     201        while ((c=getopt(argc,argv,
     202          "ab:cdf:iklno:p:rs:tuvwx:zB:DE:G:HLMPT:U:XYZ")) != -1) {
    203203                switch (c) {
    204204                case 'a':
    205205                        /*
     
    451451                        Lflag = 1;
    452452                        flg |= CLF;
    453453                        break;
     454                case 'M':
     455                        /*
     456                         * ignore file modified or deleted errors.
     457                         * non-standard option.
     458                         */
     459                        Mflag = 1;
     460                        flg |= CMF;
     461                        break;
    454462                case 'O':
    455463                        /*
    456464                         * Force one volume.  Non standard option.
     
    613621         * process option flags
    614622         */
    615623        while ((c = getoldopt(argc, argv,
    616             "b:cef:hmopqruts:vwxzBC:HI:LOPXZ014578")) != -1) {
     624            "b:cef:hmopqruts:vwxzBC:HI:LMOPXZ014578")) != -1) {
    617625                switch(c) {
    618626                case 'b':
    619627                        /*
     
    765773                         */
    766774                        Lflag = 1;
    767775                        break;
     776                case 'M':
     777                        /*
     778                         * ignore file modified or deleted errors.
     779                         * non-standard option.
     780                         */
     781                        Mflag = 1;
     782                        break;
    768783                case 'P':
    769784                        /*
    770785                         * do not remove leading '/' from pathnames
     
    10321047        act = -1;
    10331048        nodirs = 1;
    10341049        listf = stderr;
    1035         while ((c=getopt(argc,argv,"abcdfiklmoprstuvzABC:E:F:H:I:LO:SZ6")) != -1)
     1050        while ((c=getopt(argc,argv,
     1051          "abcdfiklmoprstuvzABC:E:F:H:I:LMO:SZ6")) != -1)
    10361052                switch (c) {
    10371053                        case 'a':
    10381054                                /*
     
    12031219                                 */
    12041220                                Lflag = 1;
    12051221                                break;
     1222                        case 'M':
     1223                                /*
     1224                                 * ignore file modified or deleted errors.
     1225                                 * non-standard option.
     1226                                 */
     1227                                Mflag = 1;
    12061228                        case 'S':
    12071229                                /*
    12081230                                 * swap halfwords after reading data
     
    12571279                         * no read errors allowed on updates/append operation!
    12581280                         */
    12591281                        maxflt = 0;
     1282                        /*
     1283                         * This is not a good idea for 2 reasons.  Firstly the number of
     1284                         * files supplied on stdin may be huge - storing them in memory
     1285                         * is not such a good idea.  Secondly cpio traditionally does not
     1286                         * die if it can not find a file name.  Instead it behaves like
     1287                         * pax does when reading the files from stdin - it continues, but
     1288                         * exits with a non-zero exit status.
     1289                         *
     1290                         * By not reading the files here cpio is forced to behave like pax
     1291                         * does.
     1292                         *
    12601293                        while ((str = getln(stdin)) != NULL) {
    12611294                                ftree_add(str, NULL);
    12621295                        }
     
    12641297                                paxwarn(1, "Problem while reading stdin");
    12651298                                cpio_usage();
    12661299                        }
     1300                        */
    12671301                        break;
    12681302                default:
    12691303                        cpio_usage();
     
    15511585        (void)fputs("[-U user] ... [-G group] ...\n           ", stderr);
    15521586        (void)fputs("[-T [from_date][,to_date]] ... ", stderr);
    15531587        (void)fputs(" [pattern ...]\n", stderr);
    1554         (void)fputs("       pax -w [-dituvzHLOPX] [-b blocksize] ", stderr);
     1588        (void)fputs("       pax -w [-dituvzHLMOPX] [-b blocksize] ", stderr);
    15551589        (void)fputs("[ [-a] [-f archive] ] [-x format] \n", stderr);
    15561590        (void)fputs("           [-B bytes] [-s replstr] ... ", stderr);
    15571591        (void)fputs("[-o options] ... [-U user] ...", stderr);
    15581592        (void)fputs("\n           [-G group] ... ", stderr);
    15591593        (void)fputs("[-T [from_date][,to_date][/[c][m]]] ... ", stderr);
    15601594        (void)fputs("[file ...]\n", stderr);
    1561         (void)fputs("       pax -r -w [-diklntuvDHLOPXYZ] ", stderr);
     1595        (void)fputs("       pax -r -w [-diklntuvDHLMOPXYZ] ", stderr);
    15621596        (void)fputs("[-p string] ... [-s replstr] ...", stderr);
    15631597        (void)fputs("\n           [-U user] ... [-G group] ... ", stderr);
    15641598        (void)fputs("[-T [from_date][,to_date][/[c][m]]] ... ", stderr);
     
    15741608void
    15751609tar_usage(void)
    15761610{
    1577         (void)fputs("usage: tar [-]{crtux}[-befhmopqsvwzHLOPXZ014578] [blocksize] ",
     1611        (void)fputs("usage: tar [-]{crtux}[-befhmopqsvwzHLMOPXZ014578] [blocksize] ",
    15781612                 stderr);
    15791613        (void)fputs("[archive] [replstr] [-C directory] [-I file] [file ...]\n",
    15801614            stderr);
     
    15891623void
    15901624cpio_usage(void)
    15911625{
    1592         (void)fputs("usage: cpio -o [-aABcLvVzZ] [-C bytes] [-H format] [-O archive]\n", stderr);
     1626        (void)fputs("usage: cpio -o [-aABcLMvVzZ] [-C bytes] [-H format] [-O archive]\n", stderr);
    15931627        (void)fputs("               [-F archive] < name-list [> archive]\n", stderr);
    15941628        (void)fputs("       cpio -i [-bBcdfmnrsStuvVzZ6] [-C bytes] [-E file] [-H format]\n", stderr);
    15951629        (void)fputs("               [-I archive] [-F archive] [pattern...] [< archive]\n", stderr);
    1596         (void)fputs("       cpio -p [-adlLmuvV] destination-directory < name-list\n", stderr);
     1630        (void)fputs("       cpio -p [-adlLmMuvV] destination-directory < name-list\n", stderr);
    15971631        exit(1);
    15981632}
  • src/options.h

    diff -Nur pax-3.3-gcc/src/options.h pax-3.3-modifyWarn/src/options.h
    old new  
    8282#define CGF     0x00200000      /* nonstandard extension */
    8383#define CHF     0x00400000      /* nonstandard extension */
    8484#define CLF     0x00800000      /* nonstandard extension */
    85 #define CPF     0x01000000      /* nonstandard extension */
    86 #define CTF     0x02000000      /* nonstandard extension */
    87 #define CUF     0x04000000      /* nonstandard extension */
    88 #define CXF     0x08000000
    89 #define CYF     0x10000000      /* nonstandard extension */
    90 #define CZF     0x20000000      /* nonstandard extension */
     85#define CMF     0x01000000      /* nonstandard extension */
     86#define CPF     0x02000000      /* nonstandard extension */
     87#define CTF     0x04000000      /* nonstandard extension */
     88#define CUF     0x08000000      /* nonstandard extension */
     89#define CXF     0x10000000
     90#define CYF     0x20000000      /* nonstandard extension */
     91#define CZF     0x40000000      /* nonstandard extension */
    9192
    9293/*
    9394 * ascii string indexed by bit position above (alter the above and you must
    9495 * alter this string) used to tell the user what flags caused us to complain
    9596 */
    96 #define FLGCH   "abcdfiklnoprstuvwxBDEGHLPTUXYZ"
     97#define FLGCH   "abcdfiklnoprstuvwxBDEGHLMPTUXYZ"
    9798
    9899/*
    99100 * legal pax operation bit patterns
     
    110111 * Illegal option flag subsets based on pax operation
    111112 */
    112113
    113 #define BDEXTR  (AF|BF|LF|TF|WF|XF|CBF|CHF|CLF|CPF|CXF)
     114#define BDEXTR  (AF|BF|LF|TF|WF|XF|CBF|CHF|CLF|CMF|CPF|CXF)
    114115#define BDARCH  (CF|KF|LF|NF|PF|RF|CDF|CEF|CYF|CZF)
    115116#define BDCOPY  (AF|BF|FF|OF|XF|CBF|CEF)
    116 #define BDLIST (AF|BF|IF|KF|LF|OF|PF|RF|TF|UF|WF|XF|CBF|CDF|CHF|CLF|CPF|CXF|CYF|CZF)
     117#define BDLIST (AF|BF|IF|KF|LF|OF|PF|RF|TF|UF|WF|XF|CBF|CDF|CHF|CLF|CMF|CPF|CXF|CYF|CZF)
  • src/pax.1

    diff -Nur pax-3.3-gcc/src/pax.1 pax-3.3-modifyWarn/src/pax.1
    old new  
    109109.Op Ar pattern ...
    110110.Nm pax
    111111.Fl w
    112 .Op Fl dituvzHLPX
     112.Op Fl dituvzHLMPX
    113113.Bk -words
    114114.Op Fl b Ar blocksize
    115115.Ek
     
    835835system traversal.
    836836.It Fl L
    837837Follow all symbolic links to perform a logical file system traversal.
     838.It Fl M
     839Do not treat files being modified or deleted during the copy as an error.
    838840.It Fl O
    839841Force the archive to be one volume.
    840842If a volume ends prematurely,
     
    11231125find a file when writing an archive, or cannot preserve the user ID,
    11241126group ID, or file mode when the
    11251127.Fl p
    1126 option is specified, a diagnostic message is written to standard error
    1127 and a non-zero exit status will be returned, but processing will continue.
     1128option is specified, or a file is modified or deleted when the
     1129.Fl M
     1130option is not specified, a diagnostic message is written to standard
     1131error and a non-zero exit status will be returned, but processing
     1132will continue.
    11281133In the case where
    11291134.Nm
    11301135cannot create a link to a file,
     
    11751180.Fl G ,
    11761181.Fl H ,
    11771182.Fl L ,
     1183.Fl M ,
    11781184.Fl O ,
    11791185.Fl P ,
    11801186.Fl T ,
  • src/pax.c

    diff -Nur pax-3.3-gcc/src/pax.c pax-3.3-modifyWarn/src/pax.c
    old new  
    9292int     Dflag;                  /* same as uflag except inode change time */
    9393int     Hflag;                  /* follow command line symlinks (write only) */
    9494int     Lflag;                  /* follow symlinks when writing */
     95int     Mflag;                  /* follow symlinks when writing */
    9596int     Xflag;                  /* archive files with same device id only */
    9697int     Yflag;                  /* same as Dflg except after name mode */
    9798int     Zflag;                  /* same as uflg except after name mode */
  • src/tar.1

    diff -Nur pax-3.3-gcc/src/tar.1 pax-3.3-modifyWarn/src/tar.1
    old new  
    3939.Sh SYNOPSIS
    4040.Nm tar
    4141.Sm off
    42 .Oo \&- Oc {crtux} Op befhmopqsvwzHLOPXZ014578
     42.Oo \&- Oc {crtux} Op befhmopqsvwzHLMOPXZ014578
    4343.Sm on
    4444.Op Ar blocksize
    4545.Op Ar archive
     
    208208In extract mode this means that a directory entry in the archive
    209209will not overwrite an existing symbolic link, but rather what the
    210210link ultimately points to.
     211.It Fl M
     212Do not treat files being modified or deleted during the copy as an error.
    211213.It Fl P
    212214Do not strip leading slashes
    213215.Pq Sq /
     
    282284find a file while writing an archive, or cannot preserve the user
    283285ID, group ID, file mode, or access and modification times when the
    284286.Fl p
    285 option is specified, a diagnostic message is written to standard
     287option is specified, or a file is modified or deleted when the
     288.Fl M
     289option is not specified, a diagnostic message is written to standard
    286290error and a non-zero exit value will be returned, but processing
    287291will continue.
    288292In the case where
     
    330334.Sh CAVEATS
    331335The
    332336.Fl L
    333 flag is not portable to other versions of
     337and
     338.Fl M
     339flags are not portable to other versions of
    334340.Nm
    335 where it may have a different meaning.
     341where they may have a different meaning.
  • src/tty_subs.c

    diff -Nur pax-3.3-gcc/src/tty_subs.c pax-3.3-modifyWarn/src/tty_subs.c
    old new  
    142142}
    143143
    144144/*
    145  * paxwarn()
    146  *      write a warning message to stderr. if "set" the exit value of pax
    147  *      will be non-zero.
     145 * vsyswarn()
     146 *      write a warning message to stderr.  If the parameter "set" is:
     147 *          0 the exit value of pax will unaffected.
     148 *          1 the exit value of pax will be non-zero.
     149 *          2 the exit value of pax be non-zero if the -M flag has been given,
     150 *            otherwise the exit value is uneffected and a warning is printed.
    148151 */
    149152
    150 void
    151 paxwarn(int set, const char *fmt, ...)
     153static void
     154vsyswarn(int set, int errnum, const char *fmt, va_list ap)
    152155{
    153         va_list ap;
    154 
    155         va_start(ap, fmt);
    156         if (set)
    157                 exit_val = 1;
    158156        /*
    159157         * when vflag we better ship out an extra \n to get this message on a
    160158         * line by itself
     
    165163                vfpart = 0;
    166164        }
    167165        (void)fprintf(stderr, "%s: ", argv0);
     166        if (set == 2 && Mflag)
     167                (void)fprintf(stderr, "Warning - ");
     168        else if (set)
     169                exit_val = 1;
    168170        (void)vfprintf(stderr, fmt, ap);
    169         va_end(ap);
     171
     172        /*
     173         * format and print the errno
     174         */
     175        if (errnum > 0)
     176                (void)fprintf(stderr, ": %s", strerror(errnum));
    170177        (void)fputc('\n', stderr);
    171178}
    172179
    173180/*
     181 * paxwarn()
     182 *      Shorthand interface to vsyswarn() above.
     183 */
     184
     185void
     186paxwarn(int set, const char *fmt, ...)
     187{
     188        va_list ap;
     189
     190        va_start(ap, fmt);
     191        vsyswarn(set, 0, fmt, ap);
     192        va_end(ap);
     193}
     194
     195/*
    174196 * syswarn()
    175  *      write a warning message to stderr. if "set" the exit value of pax
    176  *      will be non-zero.
     197 *      Shorthand interface to vsyswarn() above.
    177198 */
    178199
    179200void
     
    182203        va_list ap;
    183204
    184205        va_start(ap, fmt);
    185         if (set)
    186                 exit_val = 1;
    187         /*
    188          * when vflag we better ship out an extra \n to get this message on a
    189          * line by itself
    190          */
    191         if (vflag && vfpart) {
    192                 (void)fflush(listf);
    193                 (void)fputc('\n', stderr);
    194                 vfpart = 0;
    195         }
    196         (void)fprintf(stderr, "%s: ", argv0);
    197         (void)vfprintf(stderr, fmt, ap);
     206        vsyswarn(set, errnum, fmt, ap);
    198207        va_end(ap);
    199 
    200         /*
    201          * format and print the errno
    202          */
    203         if (errnum > 0)
    204                 (void)fprintf(stderr, ": %s", strerror(errnum));
    205         (void)fputc('\n', stderr);
    206208}
Note: See TracBrowser for help on using the repository browser.