source:
npl/overig/archivetools/pax/pax-3.3-modifyWarn.patch
@
892871d
Last change on this file since 892871d was c5c522c, checked in by , 8 years ago | |
---|---|
|
|
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 492 492 493 493 if (!invld_rec) 494 494 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); 497 498 return(-1); 498 499 } 499 500 -
src/ar_subs.c
diff -Nur pax-3.3-gcc/src/ar_subs.c pax-3.3-modifyWarn/src/ar_subs.c
old new 459 459 * the link table). 460 460 */ 461 461 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", 463 464 arcn->org_name); 464 465 purg_lnk(arcn); 465 466 continue; … … 940 941 * first open source file and then create the destination file 941 942 */ 942 943 if ((fdsrc = open(arcn->org_name, O_RDONLY, 0)) < 0) { 943 syswarn (1, errno, "Unable to open %s to read",944 944 syswarn (errno == ENOENT ? 2 : 1, errno, 945 "Unable to open %s to read", arcn->org_name); 945 946 purg_lnk(arcn); 946 947 continue; 947 948 } -
src/buf_subs.c
diff -Nur pax-3.3-gcc/src/buf_subs.c pax-3.3-modifyWarn/src/buf_subs.c
old new 594 594 /* 595 595 * wr_rdfile() 596 596 * fill write buffer with the contents of a file. We are passed an open 597 * file descriptor to the file an thearchive structure that describes the597 * file descriptor to an archive structure that describes the 598 598 * file we are storing. The variable "left" is modified to contain the 599 599 * number of bytes of the file we were NOT able to write to the archive. 600 600 * it is important that we always write EXACTLY the number of bytes that … … 602 602 * bigger, so reading to the end of file would create an improper archive, 603 603 * we just detect this case and warn the user. We never create a bad 604 604 * archive if we can avoid it. Of course trying to archive files that are 605 * active is asking for trouble. I twe fail, we pass back how much we605 * active is asking for trouble. If we fail, we pass back how much we 606 606 * could NOT copy and let the caller deal with it. 607 607 * Return: 608 608 * 0 ok, -1 if archive write failure. a short read of the file returns a … … 640 640 if (res < 0) 641 641 syswarn(1, errno, "Read fault on %s", arcn->org_name); 642 642 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); 644 644 else if (fstat(ifd, &sb) < 0) 645 645 syswarn(1, errno, "Failed stat on %s", arcn->org_name); 646 646 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", 648 648 arcn->org_name); 649 649 *left = size; 650 650 return(0); … … 813 813 syswarn(1, errno, "Failed write during copy of %s to %s", 814 814 arcn->org_name, arcn->name); 815 815 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", 817 817 arcn->org_name, arcn->name); 818 818 else if (fstat(fd1, &sb) < 0) 819 819 syswarn(1, errno, "Failed stat of %s", arcn->org_name); 820 820 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", 822 822 arcn->org_name, arcn->name); 823 823 824 824 /* -
src/cpio.1
diff -Nur pax-3.3-gcc/src/cpio.1 pax-3.3-modifyWarn/src/cpio.1
old new 39 39 .Sh SYNOPSIS 40 40 .Nm cpio 41 41 .Fl o 42 .Op Fl aABcL vzZ42 .Op Fl aABcLMvzZ 43 43 .Op Fl C Ar bytes 44 44 .Op Fl F Ar archive 45 45 .Op Fl H Ar format … … 58 58 .Op Ar "< archive" 59 59 .Nm cpio 60 60 .Fl p 61 .Op Fl adlLm uv61 .Op Fl adlLmMuv 62 62 .Ar destination-directory 63 63 .Ar "< name-list" 64 64 .Sh DESCRIPTION … … 117 117 .El 118 118 .It Fl L 119 119 Follow symbolic links. 120 .It Fl M 121 Do not treat files being modified or deleted during the copy as an error. 120 122 .It Fl v 121 123 Be verbose about operations. 122 124 List filenames as they are written to the archive. … … 255 257 find a file while writing an archive, or cannot preserve the user 256 258 ID, group ID, file mode, or access and modification times when the 257 259 .Fl p 258 option is specified, a diagnostic message is written to standard 260 option is specified, or a file is modified or deleted when the 261 .Fl M 262 option is not specified, a diagnostic message is written to standard 259 263 error and a non-zero exit value will be returned, but processing 260 264 will continue. 261 265 In the case where -
src/extern.h
diff -Nur pax-3.3-gcc/src/extern.h pax-3.3-modifyWarn/src/extern.h
old new 223 223 extern int Dflag; 224 224 extern int Hflag; 225 225 extern int Lflag; 226 extern int Mflag; 226 227 extern int Xflag; 227 228 extern int Yflag; 228 229 extern 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 1003 1003 * they can create inconsistant archive copies. 1004 1004 */ 1005 1005 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); 1007 1007 else if (fstat(fd, &sb) < 0) 1008 1008 syswarn(1, errno, "Failed stat on %s", arcn->org_name); 1009 1009 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); 1011 1011 else if (lseek(fd, (off_t)0L, SEEK_SET) < 0) 1012 1012 syswarn(1, errno, "File rewind failed on: %s", arcn->org_name); 1013 1013 else { -
src/ftree.c
diff -Nur pax-3.3-gcc/src/ftree.c pax-3.3-modifyWarn/src/ftree.c
old new 404 404 paxwarn(1,"File system cycle found at %s",ftent->fts_path); 405 405 continue; 406 406 case FTS_DNR: 407 syswarn(1, ftent->fts_errno, 407 syswarn(ftent->fts_errno == ENOENT ? 2 : 1, 408 ftent->fts_errno, 408 409 "Unable to read directory %s", ftent->fts_path); 409 410 continue; 410 411 case FTS_ERR: … … 412 413 "File system traversal error"); 413 414 continue; 414 415 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, 417 418 "Unable to access %s", ftent->fts_path); 418 419 continue; 420 case FTS_NSOK: 421 paxwarn(1, "Unable to access %s", ftent->fts_path); 422 continue; 419 423 } 420 424 421 425 /* … … 470 474 */ 471 475 if ((cnt = readlink(ftent->fts_path, arcn->ln_name, 472 476 PAXPATHLEN)) < 0) { 473 syswarn(1, errno, "Unable to read symlink %s", 477 syswarn(errno == ENOENT ? 2 : 1, errno, 478 "Unable to read symlink %s", 474 479 ftent->fts_path); 475 480 continue; 476 481 } -
src/options.c
diff -Nur pax-3.3-gcc/src/options.c pax-3.3-modifyWarn/src/options.c
old new 198 198 /* 199 199 * process option flags 200 200 */ 201 while ((c=getopt(argc,argv, "ab:cdf:iklno:p:rs:tuvwx:zB:DE:G:HLPT:U:XYZ"))202 201 while ((c=getopt(argc,argv, 202 "ab:cdf:iklno:p:rs:tuvwx:zB:DE:G:HLMPT:U:XYZ")) != -1) { 203 203 switch (c) { 204 204 case 'a': 205 205 /* … … 451 451 Lflag = 1; 452 452 flg |= CLF; 453 453 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; 454 462 case 'O': 455 463 /* 456 464 * Force one volume. Non standard option. … … 613 621 * process option flags 614 622 */ 615 623 while ((c = getoldopt(argc, argv, 616 "b:cef:hmopqruts:vwxzBC:HI:L OPXZ014578")) != -1) {624 "b:cef:hmopqruts:vwxzBC:HI:LMOPXZ014578")) != -1) { 617 625 switch(c) { 618 626 case 'b': 619 627 /* … … 765 773 */ 766 774 Lflag = 1; 767 775 break; 776 case 'M': 777 /* 778 * ignore file modified or deleted errors. 779 * non-standard option. 780 */ 781 Mflag = 1; 782 break; 768 783 case 'P': 769 784 /* 770 785 * do not remove leading '/' from pathnames … … 1032 1047 act = -1; 1033 1048 nodirs = 1; 1034 1049 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) 1036 1052 switch (c) { 1037 1053 case 'a': 1038 1054 /* … … 1203 1219 */ 1204 1220 Lflag = 1; 1205 1221 break; 1222 case 'M': 1223 /* 1224 * ignore file modified or deleted errors. 1225 * non-standard option. 1226 */ 1227 Mflag = 1; 1206 1228 case 'S': 1207 1229 /* 1208 1230 * swap halfwords after reading data … … 1257 1279 * no read errors allowed on updates/append operation! 1258 1280 */ 1259 1281 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 * 1260 1293 while ((str = getln(stdin)) != NULL) { 1261 1294 ftree_add(str, NULL); 1262 1295 } … … 1264 1297 paxwarn(1, "Problem while reading stdin"); 1265 1298 cpio_usage(); 1266 1299 } 1300 */ 1267 1301 break; 1268 1302 default: 1269 1303 cpio_usage(); … … 1551 1585 (void)fputs("[-U user] ... [-G group] ...\n ", stderr); 1552 1586 (void)fputs("[-T [from_date][,to_date]] ... ", stderr); 1553 1587 (void)fputs(" [pattern ...]\n", stderr); 1554 (void)fputs(" pax -w [-dituvzHL OPX] [-b blocksize] ", stderr);1588 (void)fputs(" pax -w [-dituvzHLMOPX] [-b blocksize] ", stderr); 1555 1589 (void)fputs("[ [-a] [-f archive] ] [-x format] \n", stderr); 1556 1590 (void)fputs(" [-B bytes] [-s replstr] ... ", stderr); 1557 1591 (void)fputs("[-o options] ... [-U user] ...", stderr); 1558 1592 (void)fputs("\n [-G group] ... ", stderr); 1559 1593 (void)fputs("[-T [from_date][,to_date][/[c][m]]] ... ", stderr); 1560 1594 (void)fputs("[file ...]\n", stderr); 1561 (void)fputs(" pax -r -w [-diklntuvDHL OPXYZ] ", stderr);1595 (void)fputs(" pax -r -w [-diklntuvDHLMOPXYZ] ", stderr); 1562 1596 (void)fputs("[-p string] ... [-s replstr] ...", stderr); 1563 1597 (void)fputs("\n [-U user] ... [-G group] ... ", stderr); 1564 1598 (void)fputs("[-T [from_date][,to_date][/[c][m]]] ... ", stderr); … … 1574 1608 void 1575 1609 tar_usage(void) 1576 1610 { 1577 (void)fputs("usage: tar [-]{crtux}[-befhmopqsvwzHL OPXZ014578] [blocksize] ",1611 (void)fputs("usage: tar [-]{crtux}[-befhmopqsvwzHLMOPXZ014578] [blocksize] ", 1578 1612 stderr); 1579 1613 (void)fputs("[archive] [replstr] [-C directory] [-I file] [file ...]\n", 1580 1614 stderr); … … 1589 1623 void 1590 1624 cpio_usage(void) 1591 1625 { 1592 (void)fputs("usage: cpio -o [-aABcL vVzZ] [-C bytes] [-H format] [-O archive]\n", stderr);1626 (void)fputs("usage: cpio -o [-aABcLMvVzZ] [-C bytes] [-H format] [-O archive]\n", stderr); 1593 1627 (void)fputs(" [-F archive] < name-list [> archive]\n", stderr); 1594 1628 (void)fputs(" cpio -i [-bBcdfmnrsStuvVzZ6] [-C bytes] [-E file] [-H format]\n", stderr); 1595 1629 (void)fputs(" [-I archive] [-F archive] [pattern...] [< archive]\n", stderr); 1596 (void)fputs(" cpio -p [-adlLm uvV] destination-directory < name-list\n", stderr);1630 (void)fputs(" cpio -p [-adlLmMuvV] destination-directory < name-list\n", stderr); 1597 1631 exit(1); 1598 1632 } -
src/options.h
diff -Nur pax-3.3-gcc/src/options.h pax-3.3-modifyWarn/src/options.h
old new 82 82 #define CGF 0x00200000 /* nonstandard extension */ 83 83 #define CHF 0x00400000 /* nonstandard extension */ 84 84 #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 */ 91 92 92 93 /* 93 94 * ascii string indexed by bit position above (alter the above and you must 94 95 * alter this string) used to tell the user what flags caused us to complain 95 96 */ 96 #define FLGCH "abcdfiklnoprstuvwxBDEGHL PTUXYZ"97 #define FLGCH "abcdfiklnoprstuvwxBDEGHLMPTUXYZ" 97 98 98 99 /* 99 100 * legal pax operation bit patterns … … 110 111 * Illegal option flag subsets based on pax operation 111 112 */ 112 113 113 #define BDEXTR (AF|BF|LF|TF|WF|XF|CBF|CHF|CLF|C PF|CXF)114 #define BDEXTR (AF|BF|LF|TF|WF|XF|CBF|CHF|CLF|CMF|CPF|CXF) 114 115 #define BDARCH (CF|KF|LF|NF|PF|RF|CDF|CEF|CYF|CZF) 115 116 #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|C PF|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 109 109 .Op Ar pattern ... 110 110 .Nm pax 111 111 .Fl w 112 .Op Fl dituvzHL PX112 .Op Fl dituvzHLMPX 113 113 .Bk -words 114 114 .Op Fl b Ar blocksize 115 115 .Ek … … 835 835 system traversal. 836 836 .It Fl L 837 837 Follow all symbolic links to perform a logical file system traversal. 838 .It Fl M 839 Do not treat files being modified or deleted during the copy as an error. 838 840 .It Fl O 839 841 Force the archive to be one volume. 840 842 If a volume ends prematurely, … … 1123 1125 find a file when writing an archive, or cannot preserve the user ID, 1124 1126 group ID, or file mode when the 1125 1127 .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. 1128 option is specified, or a file is modified or deleted when the 1129 .Fl M 1130 option is not specified, a diagnostic message is written to standard 1131 error and a non-zero exit status will be returned, but processing 1132 will continue. 1128 1133 In the case where 1129 1134 .Nm 1130 1135 cannot create a link to a file, … … 1175 1180 .Fl G , 1176 1181 .Fl H , 1177 1182 .Fl L , 1183 .Fl M , 1178 1184 .Fl O , 1179 1185 .Fl P , 1180 1186 .Fl T , -
src/pax.c
diff -Nur pax-3.3-gcc/src/pax.c pax-3.3-modifyWarn/src/pax.c
old new 92 92 int Dflag; /* same as uflag except inode change time */ 93 93 int Hflag; /* follow command line symlinks (write only) */ 94 94 int Lflag; /* follow symlinks when writing */ 95 int Mflag; /* follow symlinks when writing */ 95 96 int Xflag; /* archive files with same device id only */ 96 97 int Yflag; /* same as Dflg except after name mode */ 97 98 int 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 39 39 .Sh SYNOPSIS 40 40 .Nm tar 41 41 .Sm off 42 .Oo \&- Oc {crtux} Op befhmopqsvwzHL OPXZ01457842 .Oo \&- Oc {crtux} Op befhmopqsvwzHLMOPXZ014578 43 43 .Sm on 44 44 .Op Ar blocksize 45 45 .Op Ar archive … … 208 208 In extract mode this means that a directory entry in the archive 209 209 will not overwrite an existing symbolic link, but rather what the 210 210 link ultimately points to. 211 .It Fl M 212 Do not treat files being modified or deleted during the copy as an error. 211 213 .It Fl P 212 214 Do not strip leading slashes 213 215 .Pq Sq / … … 282 284 find a file while writing an archive, or cannot preserve the user 283 285 ID, group ID, file mode, or access and modification times when the 284 286 .Fl p 285 option is specified, a diagnostic message is written to standard 287 option is specified, or a file is modified or deleted when the 288 .Fl M 289 option is not specified, a diagnostic message is written to standard 286 290 error and a non-zero exit value will be returned, but processing 287 291 will continue. 288 292 In the case where … … 330 334 .Sh CAVEATS 331 335 The 332 336 .Fl L 333 flag is not portable to other versions of 337 and 338 .Fl M 339 flags are not portable to other versions of 334 340 .Nm 335 where itmay have a different meaning.341 where 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 142 142 } 143 143 144 144 /* 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. 148 151 */ 149 152 150 void151 paxwarn(int set, const char *fmt, ...)153 static void 154 vsyswarn(int set, int errnum, const char *fmt, va_list ap) 152 155 { 153 va_list ap;154 155 va_start(ap, fmt);156 if (set)157 exit_val = 1;158 156 /* 159 157 * when vflag we better ship out an extra \n to get this message on a 160 158 * line by itself … … 165 163 vfpart = 0; 166 164 } 167 165 (void)fprintf(stderr, "%s: ", argv0); 166 if (set == 2 && Mflag) 167 (void)fprintf(stderr, "Warning - "); 168 else if (set) 169 exit_val = 1; 168 170 (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)); 170 177 (void)fputc('\n', stderr); 171 178 } 172 179 173 180 /* 181 * paxwarn() 182 * Shorthand interface to vsyswarn() above. 183 */ 184 185 void 186 paxwarn(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 /* 174 196 * 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. 177 198 */ 178 199 179 200 void … … 182 203 va_list ap; 183 204 184 205 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); 198 207 va_end(ap); 199 200 /*201 * format and print the errno202 */203 if (errnum > 0)204 (void)fprintf(stderr, ": %s", strerror(errnum));205 (void)fputc('\n', stderr);206 208 }
Note: See TracBrowser
for help on using the repository browser.