chip@tct.uucp (Chip Salzenberg) (05/02/90)
According to merlyn@iwarp.intel.com (Randal Schwartz): >According to lwall@jpl-devvax (Larry Wall): >| I'm gonna have to break apart each name into directory and filename, >| stat the two directories to see if they're the same directory, and then >| compare the filenames. > >Naaah. Yes, he will, Randal. There's no way I'm going to put "sub safe_rename" in each and every Perl script. A Perl implementation in which "rename($from, $to)" sometimes clobbers $from is buggy. We should all be thankful (we are thankful, right?) that Larry is so quick to provide bug fixes instead of workarounds. -- Chip Salzenberg at ComDev/TCT <chip%tct@ateng.com>, <uunet!ateng!tct!chip>
6sigma2@polari.UUCP (Brian Matthews) (05/02/90)
In article <7930@jpl-devvax.JPL.NASA.GOV> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes: |In article <1952@polari.UUCP> 6sigma2@polari.UUCP (Brian Matthews) writes: |: The rename emulation first unlinks the destination, but this is a Bad Thing |: if the source and dest are the same. |Ouch. And it's rather difficult to do it right, since two differing strings |may in fact refer to the same directory entry. Sigh... Let the kernel do the hard stuff :-) Just stat the two files, and do the obvious. In fact, it's probably fairly simple to do in perl itself, but it still needs to be done in C someday. -- Brian L. Matthews blm@6sceng.UUCP