mp@whuxle.UUCP (Mark Plotnick) (02/16/84)
When cpio is run under 4.2bsd, specifying the -a option causes the mod times on all the selected input files to be set to 0 (which we all know by now is "Feb 6 2^A06" eastern, "Feb 5 2^A06" pacific; check local lstings for exact time in your area). Files with 0 mod times cause programs like "make" to get indigestion. The problem is that cpio assumes that, in the stat structure, st_mtime is adjacent to st_atime. Not so in 4.2bsd, where a word of zeroes (st_spare1) follows st_atime. Such is the price of progress. Fixes follow. Line numbers are for comparison purposes only; actual line numbers may vary, depending on what model cpio you own. *** 280,287 Cflag? writehdr(BBuf,ct): bwrite(Buf,ct); } close(Ifile); ! if(Acc_time) ! utime(Hdr.h_name, &Statb.st_atime); if(Verbose) err("%s\n", Hdr.h_name); } --- 280,291 ----- Cflag? writehdr(BBuf,ct): bwrite(Buf,ct); } close(Ifile); ! if(Acc_time) { ! time_t timevec[2]; ! timevec[0] = Statb.st_atime; ! timevec[1] = Statb.st_mtime; ! utime(Hdr.h_name, timevec); ! } if(Verbose) err("%s\n", Hdr.h_name); } *************** *** 378,385 ++Blocks; } close(Ifile); ! if(Acc_time) ! utime(Hdr.h_name, &Statb.st_atime); if(Ofile) { close(Ofile); set_time(Fullname, Statb.st_atime, mklong(Hdr.h_mtime)); --- 382,393 ----- ++Blocks; } close(Ifile); ! if(Acc_time) { ! time_t timevec[2]; ! timevec[0] = Statb.st_atime; ! timevec[1] = Statb.st_mtime; ! utime(Hdr.h_name, timevec); ! } if(Ofile) { close(Ofile); set_time(Fullname, Statb.st_atime, mklong(Hdr.h_mtime)); Cpio also doesn't understand symbolic links. But then again, neither does "cp -r". Mark Plotnick WH 1C-244 x6955
guy@rlgvax.UUCP (Guy Harris) (02/18/84)
Also note that this same bug (mod times getting set to 0 by programs which falsely assume that "st_atime" and "st_mtime" are adjacent) appears in the USG "pack"/"pcat"/"unpack" suite and USG "file" command. Furthermore, note that while the V7 manual explicitly gives the format of the "stat" structure, the S3 and later manuals only list a set of fields which are in the "stat" structure; I infer from this a warning that programs which depend explicitly on the layout of the "stat" structure are sinful. Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy