| [c5c522c] | 1 | diff -Nur pax-3.3-gcc/src/ar_io.c pax-3.3-modifyWarn/src/ar_io.c |
|---|
| 2 | --- pax-3.3-gcc/src/ar_io.c 2003-04-22 15:15:50.000000000 +1000 |
|---|
| 3 | +++ pax-3.3-modifyWarn/src/ar_io.c 2003-04-22 15:15:50.000000000 +1000 |
|---|
| 4 | @@ -492,8 +492,9 @@ |
|---|
| 5 | |
|---|
| 6 | if (!invld_rec) |
|---|
| 7 | return(0); |
|---|
| 8 | - paxwarn(1,"Cannot append, device record size %d does not support %s spec", |
|---|
| 9 | - rdblksz, argv0); |
|---|
| 10 | + paxwarn(1, |
|---|
| 11 | + "Cannot append, device record size %d does not support %s spec", |
|---|
| 12 | + rdblksz, argv0); |
|---|
| 13 | return(-1); |
|---|
| 14 | } |
|---|
| 15 | |
|---|
| 16 | diff -Nur pax-3.3-gcc/src/ar_subs.c pax-3.3-modifyWarn/src/ar_subs.c |
|---|
| 17 | --- pax-3.3-gcc/src/ar_subs.c 2003-04-22 15:15:50.000000000 +1000 |
|---|
| 18 | +++ pax-3.3-modifyWarn/src/ar_subs.c 2003-04-22 15:15:50.000000000 +1000 |
|---|
| 19 | @@ -459,7 +459,8 @@ |
|---|
| 20 | * the link table). |
|---|
| 21 | */ |
|---|
| 22 | if ((fd = open(arcn->org_name, O_RDONLY, 0)) < 0) { |
|---|
| 23 | - syswarn(1,errno, "Unable to open %s to read", |
|---|
| 24 | + syswarn (errno == ENOENT ? 2 : 1, errno, |
|---|
| 25 | + "Unable to open %s to read", |
|---|
| 26 | arcn->org_name); |
|---|
| 27 | purg_lnk(arcn); |
|---|
| 28 | continue; |
|---|
| 29 | @@ -940,8 +941,8 @@ |
|---|
| 30 | * first open source file and then create the destination file |
|---|
| 31 | */ |
|---|
| 32 | if ((fdsrc = open(arcn->org_name, O_RDONLY, 0)) < 0) { |
|---|
| 33 | - syswarn(1, errno, "Unable to open %s to read", |
|---|
| 34 | - arcn->org_name); |
|---|
| 35 | + syswarn (errno == ENOENT ? 2 : 1, errno, |
|---|
| 36 | + "Unable to open %s to read", arcn->org_name); |
|---|
| 37 | purg_lnk(arcn); |
|---|
| 38 | continue; |
|---|
| 39 | } |
|---|
| 40 | diff -Nur pax-3.3-gcc/src/buf_subs.c pax-3.3-modifyWarn/src/buf_subs.c |
|---|
| 41 | --- pax-3.3-gcc/src/buf_subs.c 2003-02-03 19:06:43.000000000 +1000 |
|---|
| 42 | +++ pax-3.3-modifyWarn/src/buf_subs.c 2003-04-22 15:15:50.000000000 +1000 |
|---|
| 43 | @@ -594,7 +594,7 @@ |
|---|
| 44 | /* |
|---|
| 45 | * wr_rdfile() |
|---|
| 46 | * fill write buffer with the contents of a file. We are passed an open |
|---|
| 47 | - * file descriptor to the file an the archive structure that describes the |
|---|
| 48 | + * file descriptor to an archive structure that describes the |
|---|
| 49 | * file we are storing. The variable "left" is modified to contain the |
|---|
| 50 | * number of bytes of the file we were NOT able to write to the archive. |
|---|
| 51 | * it is important that we always write EXACTLY the number of bytes that |
|---|
| 52 | @@ -602,7 +602,7 @@ |
|---|
| 53 | * bigger, so reading to the end of file would create an improper archive, |
|---|
| 54 | * we just detect this case and warn the user. We never create a bad |
|---|
| 55 | * archive if we can avoid it. Of course trying to archive files that are |
|---|
| 56 | - * active is asking for trouble. It we fail, we pass back how much we |
|---|
| 57 | + * active is asking for trouble. If we fail, we pass back how much we |
|---|
| 58 | * could NOT copy and let the caller deal with it. |
|---|
| 59 | * Return: |
|---|
| 60 | * 0 ok, -1 if archive write failure. a short read of the file returns a |
|---|
| 61 | @@ -640,11 +640,11 @@ |
|---|
| 62 | if (res < 0) |
|---|
| 63 | syswarn(1, errno, "Read fault on %s", arcn->org_name); |
|---|
| 64 | else if (size != 0L) |
|---|
| 65 | - paxwarn(1, "File changed size during read %s", arcn->org_name); |
|---|
| 66 | + paxwarn(2, "File changed size during read %s", arcn->org_name); |
|---|
| 67 | else if (fstat(ifd, &sb) < 0) |
|---|
| 68 | syswarn(1, errno, "Failed stat on %s", arcn->org_name); |
|---|
| 69 | else if (arcn->sb.st_mtime != sb.st_mtime) |
|---|
| 70 | - paxwarn(1, "File %s was modified during copy to archive", |
|---|
| 71 | + paxwarn(2, "File %s was modified during copy to archive", |
|---|
| 72 | arcn->org_name); |
|---|
| 73 | *left = size; |
|---|
| 74 | return(0); |
|---|
| 75 | @@ -813,12 +813,12 @@ |
|---|
| 76 | syswarn(1, errno, "Failed write during copy of %s to %s", |
|---|
| 77 | arcn->org_name, arcn->name); |
|---|
| 78 | else if (cpcnt != arcn->sb.st_size) |
|---|
| 79 | - paxwarn(1, "File %s changed size during copy to %s", |
|---|
| 80 | + paxwarn(2, "File %s changed size during copy to %s", |
|---|
| 81 | arcn->org_name, arcn->name); |
|---|
| 82 | else if (fstat(fd1, &sb) < 0) |
|---|
| 83 | syswarn(1, errno, "Failed stat of %s", arcn->org_name); |
|---|
| 84 | else if (arcn->sb.st_mtime != sb.st_mtime) |
|---|
| 85 | - paxwarn(1, "File %s was modified during copy to %s", |
|---|
| 86 | + paxwarn(2, "File %s was modified during copy to %s", |
|---|
| 87 | arcn->org_name, arcn->name); |
|---|
| 88 | |
|---|
| 89 | /* |
|---|
| 90 | diff -Nur pax-3.3-gcc/src/cpio.1 pax-3.3-modifyWarn/src/cpio.1 |
|---|
| 91 | --- pax-3.3-gcc/src/cpio.1 2001-05-12 06:02:16.000000000 +1000 |
|---|
| 92 | +++ pax-3.3-modifyWarn/src/cpio.1 2003-04-22 15:15:50.000000000 +1000 |
|---|
| 93 | @@ -39,7 +39,7 @@ |
|---|
| 94 | .Sh SYNOPSIS |
|---|
| 95 | .Nm cpio |
|---|
| 96 | .Fl o |
|---|
| 97 | -.Op Fl aABcLvzZ |
|---|
| 98 | +.Op Fl aABcLMvzZ |
|---|
| 99 | .Op Fl C Ar bytes |
|---|
| 100 | .Op Fl F Ar archive |
|---|
| 101 | .Op Fl H Ar format |
|---|
| 102 | @@ -58,7 +58,7 @@ |
|---|
| 103 | .Op Ar "< archive" |
|---|
| 104 | .Nm cpio |
|---|
| 105 | .Fl p |
|---|
| 106 | -.Op Fl adlLmuv |
|---|
| 107 | +.Op Fl adlLmMuv |
|---|
| 108 | .Ar destination-directory |
|---|
| 109 | .Ar "< name-list" |
|---|
| 110 | .Sh DESCRIPTION |
|---|
| 111 | @@ -117,6 +117,8 @@ |
|---|
| 112 | .El |
|---|
| 113 | .It Fl L |
|---|
| 114 | Follow symbolic links. |
|---|
| 115 | +.It Fl M |
|---|
| 116 | +Do not treat files being modified or deleted during the copy as an error. |
|---|
| 117 | .It Fl v |
|---|
| 118 | Be verbose about operations. |
|---|
| 119 | List filenames as they are written to the archive. |
|---|
| 120 | @@ -255,7 +257,9 @@ |
|---|
| 121 | find a file while writing an archive, or cannot preserve the user |
|---|
| 122 | ID, group ID, file mode, or access and modification times when the |
|---|
| 123 | .Fl p |
|---|
| 124 | -option is specified, a diagnostic message is written to standard |
|---|
| 125 | +option is specified, or a file is modified or deleted when the |
|---|
| 126 | +.Fl M |
|---|
| 127 | +option is not specified, a diagnostic message is written to standard |
|---|
| 128 | error and a non-zero exit value will be returned, but processing |
|---|
| 129 | will continue. |
|---|
| 130 | In the case where |
|---|
| 131 | diff -Nur pax-3.3-gcc/src/extern.h pax-3.3-modifyWarn/src/extern.h |
|---|
| 132 | --- pax-3.3-gcc/src/extern.h 2003-04-22 15:15:50.000000000 +1000 |
|---|
| 133 | +++ pax-3.3-modifyWarn/src/extern.h 2003-04-22 15:15:50.000000000 +1000 |
|---|
| 134 | @@ -223,6 +223,7 @@ |
|---|
| 135 | extern int Dflag; |
|---|
| 136 | extern int Hflag; |
|---|
| 137 | extern int Lflag; |
|---|
| 138 | +extern int Mflag; |
|---|
| 139 | extern int Xflag; |
|---|
| 140 | extern int Yflag; |
|---|
| 141 | extern int Zflag; |
|---|
| 142 | diff -Nur pax-3.3-gcc/src/file_subs.c pax-3.3-modifyWarn/src/file_subs.c |
|---|
| 143 | --- pax-3.3-gcc/src/file_subs.c 2003-02-03 19:06:43.000000000 +1000 |
|---|
| 144 | +++ pax-3.3-modifyWarn/src/file_subs.c 2003-04-22 15:15:50.000000000 +1000 |
|---|
| 145 | @@ -1003,11 +1003,11 @@ |
|---|
| 146 | * they can create inconsistant archive copies. |
|---|
| 147 | */ |
|---|
| 148 | if (cpcnt != arcn->sb.st_size) |
|---|
| 149 | - paxwarn(1, "File changed size %s", arcn->org_name); |
|---|
| 150 | + paxwarn(2, "File changed size during read %s", arcn->org_name); |
|---|
| 151 | else if (fstat(fd, &sb) < 0) |
|---|
| 152 | syswarn(1, errno, "Failed stat on %s", arcn->org_name); |
|---|
| 153 | else if (arcn->sb.st_mtime != sb.st_mtime) |
|---|
| 154 | - paxwarn(1, "File %s was modified during read", arcn->org_name); |
|---|
| 155 | + paxwarn(2, "File %s was modified during read", arcn->org_name); |
|---|
| 156 | else if (lseek(fd, (off_t)0L, SEEK_SET) < 0) |
|---|
| 157 | syswarn(1, errno, "File rewind failed on: %s", arcn->org_name); |
|---|
| 158 | else { |
|---|
| 159 | diff -Nur pax-3.3-gcc/src/ftree.c pax-3.3-modifyWarn/src/ftree.c |
|---|
| 160 | --- pax-3.3-gcc/src/ftree.c 2002-10-17 05:20:02.000000000 +1000 |
|---|
| 161 | +++ pax-3.3-modifyWarn/src/ftree.c 2003-04-22 15:15:50.000000000 +1000 |
|---|
| 162 | @@ -404,7 +404,8 @@ |
|---|
| 163 | paxwarn(1,"File system cycle found at %s",ftent->fts_path); |
|---|
| 164 | continue; |
|---|
| 165 | case FTS_DNR: |
|---|
| 166 | - syswarn(1, ftent->fts_errno, |
|---|
| 167 | + syswarn(ftent->fts_errno == ENOENT ? 2 : 1, |
|---|
| 168 | + ftent->fts_errno, |
|---|
| 169 | "Unable to read directory %s", ftent->fts_path); |
|---|
| 170 | continue; |
|---|
| 171 | case FTS_ERR: |
|---|
| 172 | @@ -412,10 +413,13 @@ |
|---|
| 173 | "File system traversal error"); |
|---|
| 174 | continue; |
|---|
| 175 | case FTS_NS: |
|---|
| 176 | - case FTS_NSOK: |
|---|
| 177 | - syswarn(1, ftent->fts_errno, |
|---|
| 178 | + syswarn(ftent->fts_errno == ENOENT ? 2 : 1, |
|---|
| 179 | + ftent->fts_errno, |
|---|
| 180 | "Unable to access %s", ftent->fts_path); |
|---|
| 181 | continue; |
|---|
| 182 | + case FTS_NSOK: |
|---|
| 183 | + paxwarn(1, "Unable to access %s", ftent->fts_path); |
|---|
| 184 | + continue; |
|---|
| 185 | } |
|---|
| 186 | |
|---|
| 187 | /* |
|---|
| 188 | @@ -470,7 +474,8 @@ |
|---|
| 189 | */ |
|---|
| 190 | if ((cnt = readlink(ftent->fts_path, arcn->ln_name, |
|---|
| 191 | PAXPATHLEN)) < 0) { |
|---|
| 192 | - syswarn(1, errno, "Unable to read symlink %s", |
|---|
| 193 | + syswarn(errno == ENOENT ? 2 : 1, errno, |
|---|
| 194 | + "Unable to read symlink %s", |
|---|
| 195 | ftent->fts_path); |
|---|
| 196 | continue; |
|---|
| 197 | } |
|---|
| 198 | diff -Nur pax-3.3-gcc/src/options.c pax-3.3-modifyWarn/src/options.c |
|---|
| 199 | --- pax-3.3-gcc/src/options.c 2003-04-22 15:15:50.000000000 +1000 |
|---|
| 200 | +++ pax-3.3-modifyWarn/src/options.c 2003-04-22 15:15:50.000000000 +1000 |
|---|
| 201 | @@ -198,8 +198,8 @@ |
|---|
| 202 | /* |
|---|
| 203 | * process option flags |
|---|
| 204 | */ |
|---|
| 205 | - while ((c=getopt(argc,argv,"ab:cdf:iklno:p:rs:tuvwx:zB:DE:G:HLPT:U:XYZ")) |
|---|
| 206 | - != -1) { |
|---|
| 207 | + while ((c=getopt(argc,argv, |
|---|
| 208 | + "ab:cdf:iklno:p:rs:tuvwx:zB:DE:G:HLMPT:U:XYZ")) != -1) { |
|---|
| 209 | switch (c) { |
|---|
| 210 | case 'a': |
|---|
| 211 | /* |
|---|
| 212 | @@ -451,6 +451,14 @@ |
|---|
| 213 | Lflag = 1; |
|---|
| 214 | flg |= CLF; |
|---|
| 215 | break; |
|---|
| 216 | + case 'M': |
|---|
| 217 | + /* |
|---|
| 218 | + * ignore file modified or deleted errors. |
|---|
| 219 | + * non-standard option. |
|---|
| 220 | + */ |
|---|
| 221 | + Mflag = 1; |
|---|
| 222 | + flg |= CMF; |
|---|
| 223 | + break; |
|---|
| 224 | case 'O': |
|---|
| 225 | /* |
|---|
| 226 | * Force one volume. Non standard option. |
|---|
| 227 | @@ -613,7 +621,7 @@ |
|---|
| 228 | * process option flags |
|---|
| 229 | */ |
|---|
| 230 | while ((c = getoldopt(argc, argv, |
|---|
| 231 | - "b:cef:hmopqruts:vwxzBC:HI:LOPXZ014578")) != -1) { |
|---|
| 232 | + "b:cef:hmopqruts:vwxzBC:HI:LMOPXZ014578")) != -1) { |
|---|
| 233 | switch(c) { |
|---|
| 234 | case 'b': |
|---|
| 235 | /* |
|---|
| 236 | @@ -765,6 +773,13 @@ |
|---|
| 237 | */ |
|---|
| 238 | Lflag = 1; |
|---|
| 239 | break; |
|---|
| 240 | + case 'M': |
|---|
| 241 | + /* |
|---|
| 242 | + * ignore file modified or deleted errors. |
|---|
| 243 | + * non-standard option. |
|---|
| 244 | + */ |
|---|
| 245 | + Mflag = 1; |
|---|
| 246 | + break; |
|---|
| 247 | case 'P': |
|---|
| 248 | /* |
|---|
| 249 | * do not remove leading '/' from pathnames |
|---|
| 250 | @@ -1032,7 +1047,8 @@ |
|---|
| 251 | act = -1; |
|---|
| 252 | nodirs = 1; |
|---|
| 253 | listf = stderr; |
|---|
| 254 | - while ((c=getopt(argc,argv,"abcdfiklmoprstuvzABC:E:F:H:I:LO:SZ6")) != -1) |
|---|
| 255 | + while ((c=getopt(argc,argv, |
|---|
| 256 | + "abcdfiklmoprstuvzABC:E:F:H:I:LMO:SZ6")) != -1) |
|---|
| 257 | switch (c) { |
|---|
| 258 | case 'a': |
|---|
| 259 | /* |
|---|
| 260 | @@ -1203,6 +1219,12 @@ |
|---|
| 261 | */ |
|---|
| 262 | Lflag = 1; |
|---|
| 263 | break; |
|---|
| 264 | + case 'M': |
|---|
| 265 | + /* |
|---|
| 266 | + * ignore file modified or deleted errors. |
|---|
| 267 | + * non-standard option. |
|---|
| 268 | + */ |
|---|
| 269 | + Mflag = 1; |
|---|
| 270 | case 'S': |
|---|
| 271 | /* |
|---|
| 272 | * swap halfwords after reading data |
|---|
| 273 | @@ -1257,6 +1279,17 @@ |
|---|
| 274 | * no read errors allowed on updates/append operation! |
|---|
| 275 | */ |
|---|
| 276 | maxflt = 0; |
|---|
| 277 | + /* |
|---|
| 278 | + * This is not a good idea for 2 reasons. Firstly the number of |
|---|
| 279 | + * files supplied on stdin may be huge - storing them in memory |
|---|
| 280 | + * is not such a good idea. Secondly cpio traditionally does not |
|---|
| 281 | + * die if it can not find a file name. Instead it behaves like |
|---|
| 282 | + * pax does when reading the files from stdin - it continues, but |
|---|
| 283 | + * exits with a non-zero exit status. |
|---|
| 284 | + * |
|---|
| 285 | + * By not reading the files here cpio is forced to behave like pax |
|---|
| 286 | + * does. |
|---|
| 287 | + * |
|---|
| 288 | while ((str = getln(stdin)) != NULL) { |
|---|
| 289 | ftree_add(str, NULL); |
|---|
| 290 | } |
|---|
| 291 | @@ -1264,6 +1297,7 @@ |
|---|
| 292 | paxwarn(1, "Problem while reading stdin"); |
|---|
| 293 | cpio_usage(); |
|---|
| 294 | } |
|---|
| 295 | + */ |
|---|
| 296 | break; |
|---|
| 297 | default: |
|---|
| 298 | cpio_usage(); |
|---|
| 299 | @@ -1551,14 +1585,14 @@ |
|---|
| 300 | (void)fputs("[-U user] ... [-G group] ...\n ", stderr); |
|---|
| 301 | (void)fputs("[-T [from_date][,to_date]] ... ", stderr); |
|---|
| 302 | (void)fputs(" [pattern ...]\n", stderr); |
|---|
| 303 | - (void)fputs(" pax -w [-dituvzHLOPX] [-b blocksize] ", stderr); |
|---|
| 304 | + (void)fputs(" pax -w [-dituvzHLMOPX] [-b blocksize] ", stderr); |
|---|
| 305 | (void)fputs("[ [-a] [-f archive] ] [-x format] \n", stderr); |
|---|
| 306 | (void)fputs(" [-B bytes] [-s replstr] ... ", stderr); |
|---|
| 307 | (void)fputs("[-o options] ... [-U user] ...", stderr); |
|---|
| 308 | (void)fputs("\n [-G group] ... ", stderr); |
|---|
| 309 | (void)fputs("[-T [from_date][,to_date][/[c][m]]] ... ", stderr); |
|---|
| 310 | (void)fputs("[file ...]\n", stderr); |
|---|
| 311 | - (void)fputs(" pax -r -w [-diklntuvDHLOPXYZ] ", stderr); |
|---|
| 312 | + (void)fputs(" pax -r -w [-diklntuvDHLMOPXYZ] ", stderr); |
|---|
| 313 | (void)fputs("[-p string] ... [-s replstr] ...", stderr); |
|---|
| 314 | (void)fputs("\n [-U user] ... [-G group] ... ", stderr); |
|---|
| 315 | (void)fputs("[-T [from_date][,to_date][/[c][m]]] ... ", stderr); |
|---|
| 316 | @@ -1574,7 +1608,7 @@ |
|---|
| 317 | void |
|---|
| 318 | tar_usage(void) |
|---|
| 319 | { |
|---|
| 320 | - (void)fputs("usage: tar [-]{crtux}[-befhmopqsvwzHLOPXZ014578] [blocksize] ", |
|---|
| 321 | + (void)fputs("usage: tar [-]{crtux}[-befhmopqsvwzHLMOPXZ014578] [blocksize] ", |
|---|
| 322 | stderr); |
|---|
| 323 | (void)fputs("[archive] [replstr] [-C directory] [-I file] [file ...]\n", |
|---|
| 324 | stderr); |
|---|
| 325 | @@ -1589,10 +1623,10 @@ |
|---|
| 326 | void |
|---|
| 327 | cpio_usage(void) |
|---|
| 328 | { |
|---|
| 329 | - (void)fputs("usage: cpio -o [-aABcLvVzZ] [-C bytes] [-H format] [-O archive]\n", stderr); |
|---|
| 330 | + (void)fputs("usage: cpio -o [-aABcLMvVzZ] [-C bytes] [-H format] [-O archive]\n", stderr); |
|---|
| 331 | (void)fputs(" [-F archive] < name-list [> archive]\n", stderr); |
|---|
| 332 | (void)fputs(" cpio -i [-bBcdfmnrsStuvVzZ6] [-C bytes] [-E file] [-H format]\n", stderr); |
|---|
| 333 | (void)fputs(" [-I archive] [-F archive] [pattern...] [< archive]\n", stderr); |
|---|
| 334 | - (void)fputs(" cpio -p [-adlLmuvV] destination-directory < name-list\n", stderr); |
|---|
| 335 | + (void)fputs(" cpio -p [-adlLmMuvV] destination-directory < name-list\n", stderr); |
|---|
| 336 | exit(1); |
|---|
| 337 | } |
|---|
| 338 | diff -Nur pax-3.3-gcc/src/options.h pax-3.3-modifyWarn/src/options.h |
|---|
| 339 | --- pax-3.3-gcc/src/options.h 1996-06-24 00:20:37.000000000 +1000 |
|---|
| 340 | +++ pax-3.3-modifyWarn/src/options.h 2003-04-22 15:15:50.000000000 +1000 |
|---|
| 341 | @@ -82,18 +82,19 @@ |
|---|
| 342 | #define CGF 0x00200000 /* nonstandard extension */ |
|---|
| 343 | #define CHF 0x00400000 /* nonstandard extension */ |
|---|
| 344 | #define CLF 0x00800000 /* nonstandard extension */ |
|---|
| 345 | -#define CPF 0x01000000 /* nonstandard extension */ |
|---|
| 346 | -#define CTF 0x02000000 /* nonstandard extension */ |
|---|
| 347 | -#define CUF 0x04000000 /* nonstandard extension */ |
|---|
| 348 | -#define CXF 0x08000000 |
|---|
| 349 | -#define CYF 0x10000000 /* nonstandard extension */ |
|---|
| 350 | -#define CZF 0x20000000 /* nonstandard extension */ |
|---|
| 351 | +#define CMF 0x01000000 /* nonstandard extension */ |
|---|
| 352 | +#define CPF 0x02000000 /* nonstandard extension */ |
|---|
| 353 | +#define CTF 0x04000000 /* nonstandard extension */ |
|---|
| 354 | +#define CUF 0x08000000 /* nonstandard extension */ |
|---|
| 355 | +#define CXF 0x10000000 |
|---|
| 356 | +#define CYF 0x20000000 /* nonstandard extension */ |
|---|
| 357 | +#define CZF 0x40000000 /* nonstandard extension */ |
|---|
| 358 | |
|---|
| 359 | /* |
|---|
| 360 | * ascii string indexed by bit position above (alter the above and you must |
|---|
| 361 | * alter this string) used to tell the user what flags caused us to complain |
|---|
| 362 | */ |
|---|
| 363 | -#define FLGCH "abcdfiklnoprstuvwxBDEGHLPTUXYZ" |
|---|
| 364 | +#define FLGCH "abcdfiklnoprstuvwxBDEGHLMPTUXYZ" |
|---|
| 365 | |
|---|
| 366 | /* |
|---|
| 367 | * legal pax operation bit patterns |
|---|
| 368 | @@ -110,7 +111,7 @@ |
|---|
| 369 | * Illegal option flag subsets based on pax operation |
|---|
| 370 | */ |
|---|
| 371 | |
|---|
| 372 | -#define BDEXTR (AF|BF|LF|TF|WF|XF|CBF|CHF|CLF|CPF|CXF) |
|---|
| 373 | +#define BDEXTR (AF|BF|LF|TF|WF|XF|CBF|CHF|CLF|CMF|CPF|CXF) |
|---|
| 374 | #define BDARCH (CF|KF|LF|NF|PF|RF|CDF|CEF|CYF|CZF) |
|---|
| 375 | #define BDCOPY (AF|BF|FF|OF|XF|CBF|CEF) |
|---|
| 376 | -#define BDLIST (AF|BF|IF|KF|LF|OF|PF|RF|TF|UF|WF|XF|CBF|CDF|CHF|CLF|CPF|CXF|CYF|CZF) |
|---|
| 377 | +#define BDLIST (AF|BF|IF|KF|LF|OF|PF|RF|TF|UF|WF|XF|CBF|CDF|CHF|CLF|CMF|CPF|CXF|CYF|CZF) |
|---|
| 378 | diff -Nur pax-3.3-gcc/src/pax.1 pax-3.3-modifyWarn/src/pax.1 |
|---|
| 379 | --- pax-3.3-gcc/src/pax.1 2003-04-22 15:15:50.000000000 +1000 |
|---|
| 380 | +++ pax-3.3-modifyWarn/src/pax.1 2003-04-22 15:15:50.000000000 +1000 |
|---|
| 381 | @@ -109,7 +109,7 @@ |
|---|
| 382 | .Op Ar pattern ... |
|---|
| 383 | .Nm pax |
|---|
| 384 | .Fl w |
|---|
| 385 | -.Op Fl dituvzHLPX |
|---|
| 386 | +.Op Fl dituvzHLMPX |
|---|
| 387 | .Bk -words |
|---|
| 388 | .Op Fl b Ar blocksize |
|---|
| 389 | .Ek |
|---|
| 390 | @@ -835,6 +835,8 @@ |
|---|
| 391 | system traversal. |
|---|
| 392 | .It Fl L |
|---|
| 393 | Follow all symbolic links to perform a logical file system traversal. |
|---|
| 394 | +.It Fl M |
|---|
| 395 | +Do not treat files being modified or deleted during the copy as an error. |
|---|
| 396 | .It Fl O |
|---|
| 397 | Force the archive to be one volume. |
|---|
| 398 | If a volume ends prematurely, |
|---|
| 399 | @@ -1123,8 +1125,11 @@ |
|---|
| 400 | find a file when writing an archive, or cannot preserve the user ID, |
|---|
| 401 | group ID, or file mode when the |
|---|
| 402 | .Fl p |
|---|
| 403 | -option is specified, a diagnostic message is written to standard error |
|---|
| 404 | -and a non-zero exit status will be returned, but processing will continue. |
|---|
| 405 | +option is specified, or a file is modified or deleted when the |
|---|
| 406 | +.Fl M |
|---|
| 407 | +option is not specified, a diagnostic message is written to standard |
|---|
| 408 | +error and a non-zero exit status will be returned, but processing |
|---|
| 409 | +will continue. |
|---|
| 410 | In the case where |
|---|
| 411 | .Nm |
|---|
| 412 | cannot create a link to a file, |
|---|
| 413 | @@ -1175,6 +1180,7 @@ |
|---|
| 414 | .Fl G , |
|---|
| 415 | .Fl H , |
|---|
| 416 | .Fl L , |
|---|
| 417 | +.Fl M , |
|---|
| 418 | .Fl O , |
|---|
| 419 | .Fl P , |
|---|
| 420 | .Fl T , |
|---|
| 421 | diff -Nur pax-3.3-gcc/src/pax.c pax-3.3-modifyWarn/src/pax.c |
|---|
| 422 | --- pax-3.3-gcc/src/pax.c 2003-04-22 15:15:50.000000000 +1000 |
|---|
| 423 | +++ pax-3.3-modifyWarn/src/pax.c 2003-04-22 15:15:50.000000000 +1000 |
|---|
| 424 | @@ -92,6 +92,7 @@ |
|---|
| 425 | int Dflag; /* same as uflag except inode change time */ |
|---|
| 426 | int Hflag; /* follow command line symlinks (write only) */ |
|---|
| 427 | int Lflag; /* follow symlinks when writing */ |
|---|
| 428 | +int Mflag; /* follow symlinks when writing */ |
|---|
| 429 | int Xflag; /* archive files with same device id only */ |
|---|
| 430 | int Yflag; /* same as Dflg except after name mode */ |
|---|
| 431 | int Zflag; /* same as uflg except after name mode */ |
|---|
| 432 | diff -Nur pax-3.3-gcc/src/tar.1 pax-3.3-modifyWarn/src/tar.1 |
|---|
| 433 | --- pax-3.3-gcc/src/tar.1 2003-03-13 06:12:35.000000000 +1000 |
|---|
| 434 | +++ pax-3.3-modifyWarn/src/tar.1 2003-04-22 15:15:50.000000000 +1000 |
|---|
| 435 | @@ -39,7 +39,7 @@ |
|---|
| 436 | .Sh SYNOPSIS |
|---|
| 437 | .Nm tar |
|---|
| 438 | .Sm off |
|---|
| 439 | -.Oo \&- Oc {crtux} Op befhmopqsvwzHLOPXZ014578 |
|---|
| 440 | +.Oo \&- Oc {crtux} Op befhmopqsvwzHLMOPXZ014578 |
|---|
| 441 | .Sm on |
|---|
| 442 | .Op Ar blocksize |
|---|
| 443 | .Op Ar archive |
|---|
| 444 | @@ -208,6 +208,8 @@ |
|---|
| 445 | In extract mode this means that a directory entry in the archive |
|---|
| 446 | will not overwrite an existing symbolic link, but rather what the |
|---|
| 447 | link ultimately points to. |
|---|
| 448 | +.It Fl M |
|---|
| 449 | +Do not treat files being modified or deleted during the copy as an error. |
|---|
| 450 | .It Fl P |
|---|
| 451 | Do not strip leading slashes |
|---|
| 452 | .Pq Sq / |
|---|
| 453 | @@ -282,7 +284,9 @@ |
|---|
| 454 | find a file while writing an archive, or cannot preserve the user |
|---|
| 455 | ID, group ID, file mode, or access and modification times when the |
|---|
| 456 | .Fl p |
|---|
| 457 | -option is specified, a diagnostic message is written to standard |
|---|
| 458 | +option is specified, or a file is modified or deleted when the |
|---|
| 459 | +.Fl M |
|---|
| 460 | +option is not specified, a diagnostic message is written to standard |
|---|
| 461 | error and a non-zero exit value will be returned, but processing |
|---|
| 462 | will continue. |
|---|
| 463 | In the case where |
|---|
| 464 | @@ -330,6 +334,8 @@ |
|---|
| 465 | .Sh CAVEATS |
|---|
| 466 | The |
|---|
| 467 | .Fl L |
|---|
| 468 | -flag is not portable to other versions of |
|---|
| 469 | +and |
|---|
| 470 | +.Fl M |
|---|
| 471 | +flags are not portable to other versions of |
|---|
| 472 | .Nm |
|---|
| 473 | -where it may have a different meaning. |
|---|
| 474 | +where they may have a different meaning. |
|---|
| 475 | diff -Nur pax-3.3-gcc/src/tty_subs.c pax-3.3-modifyWarn/src/tty_subs.c |
|---|
| 476 | --- pax-3.3-gcc/src/tty_subs.c 2003-03-05 06:27:58.000000000 +1000 |
|---|
| 477 | +++ pax-3.3-modifyWarn/src/tty_subs.c 2003-04-22 15:15:50.000000000 +1000 |
|---|
| 478 | @@ -142,19 +142,17 @@ |
|---|
| 479 | } |
|---|
| 480 | |
|---|
| 481 | /* |
|---|
| 482 | - * paxwarn() |
|---|
| 483 | - * write a warning message to stderr. if "set" the exit value of pax |
|---|
| 484 | - * will be non-zero. |
|---|
| 485 | + * vsyswarn() |
|---|
| 486 | + * write a warning message to stderr. If the parameter "set" is: |
|---|
| 487 | + * 0 the exit value of pax will unaffected. |
|---|
| 488 | + * 1 the exit value of pax will be non-zero. |
|---|
| 489 | + * 2 the exit value of pax be non-zero if the -M flag has been given, |
|---|
| 490 | + * otherwise the exit value is uneffected and a warning is printed. |
|---|
| 491 | */ |
|---|
| 492 | |
|---|
| 493 | -void |
|---|
| 494 | -paxwarn(int set, const char *fmt, ...) |
|---|
| 495 | +static void |
|---|
| 496 | +vsyswarn(int set, int errnum, const char *fmt, va_list ap) |
|---|
| 497 | { |
|---|
| 498 | - va_list ap; |
|---|
| 499 | - |
|---|
| 500 | - va_start(ap, fmt); |
|---|
| 501 | - if (set) |
|---|
| 502 | - exit_val = 1; |
|---|
| 503 | /* |
|---|
| 504 | * when vflag we better ship out an extra \n to get this message on a |
|---|
| 505 | * line by itself |
|---|
| 506 | @@ -165,15 +163,38 @@ |
|---|
| 507 | vfpart = 0; |
|---|
| 508 | } |
|---|
| 509 | (void)fprintf(stderr, "%s: ", argv0); |
|---|
| 510 | + if (set == 2 && Mflag) |
|---|
| 511 | + (void)fprintf(stderr, "Warning - "); |
|---|
| 512 | + else if (set) |
|---|
| 513 | + exit_val = 1; |
|---|
| 514 | (void)vfprintf(stderr, fmt, ap); |
|---|
| 515 | - va_end(ap); |
|---|
| 516 | + |
|---|
| 517 | + /* |
|---|
| 518 | + * format and print the errno |
|---|
| 519 | + */ |
|---|
| 520 | + if (errnum > 0) |
|---|
| 521 | + (void)fprintf(stderr, ": %s", strerror(errnum)); |
|---|
| 522 | (void)fputc('\n', stderr); |
|---|
| 523 | } |
|---|
| 524 | |
|---|
| 525 | /* |
|---|
| 526 | + * paxwarn() |
|---|
| 527 | + * Shorthand interface to vsyswarn() above. |
|---|
| 528 | + */ |
|---|
| 529 | + |
|---|
| 530 | +void |
|---|
| 531 | +paxwarn(int set, const char *fmt, ...) |
|---|
| 532 | +{ |
|---|
| 533 | + va_list ap; |
|---|
| 534 | + |
|---|
| 535 | + va_start(ap, fmt); |
|---|
| 536 | + vsyswarn(set, 0, fmt, ap); |
|---|
| 537 | + va_end(ap); |
|---|
| 538 | +} |
|---|
| 539 | + |
|---|
| 540 | +/* |
|---|
| 541 | * syswarn() |
|---|
| 542 | - * write a warning message to stderr. if "set" the exit value of pax |
|---|
| 543 | - * will be non-zero. |
|---|
| 544 | + * Shorthand interface to vsyswarn() above. |
|---|
| 545 | */ |
|---|
| 546 | |
|---|
| 547 | void |
|---|
| 548 | @@ -182,25 +203,6 @@ |
|---|
| 549 | va_list ap; |
|---|
| 550 | |
|---|
| 551 | va_start(ap, fmt); |
|---|
| 552 | - if (set) |
|---|
| 553 | - exit_val = 1; |
|---|
| 554 | - /* |
|---|
| 555 | - * when vflag we better ship out an extra \n to get this message on a |
|---|
| 556 | - * line by itself |
|---|
| 557 | - */ |
|---|
| 558 | - if (vflag && vfpart) { |
|---|
| 559 | - (void)fflush(listf); |
|---|
| 560 | - (void)fputc('\n', stderr); |
|---|
| 561 | - vfpart = 0; |
|---|
| 562 | - } |
|---|
| 563 | - (void)fprintf(stderr, "%s: ", argv0); |
|---|
| 564 | - (void)vfprintf(stderr, fmt, ap); |
|---|
| 565 | + vsyswarn(set, errnum, fmt, ap); |
|---|
| 566 | va_end(ap); |
|---|
| 567 | - |
|---|
| 568 | - /* |
|---|
| 569 | - * format and print the errno |
|---|
| 570 | - */ |
|---|
| 571 | - if (errnum > 0) |
|---|
| 572 | - (void)fprintf(stderr, ": %s", strerror(errnum)); |
|---|
| 573 | - (void)fputc('\n', stderr); |
|---|
| 574 | } |
|---|