/etc/link problem via /etc/mvdir

John F. Haugh II haugj at pigs.UUCP
Tue Jun 7 02:39:27 AEST 1988


In article <7850 at ncoast.UUCP>, allbery at ncoast.UUCP (Brandon S. Allbery) writes:
> As quoted from <532 at etn-rad.UUCP> by markus at etn-rad.UUCP (Markus Richardson):
> +---------------
> | I did something dangerous/stupid but only realized it after the fact.  
> | my . directory looked something like:
> | 	dir1/  dir2/  dir3/  dir4/  dir5/  dir6/  dir7/  dir8/  dir9/
> | 
> | I entered '/etc/mvdir * dir9' thinking (ala /bin/mv) that /etc/mvdir
> | and /etc/link would be smart enough to catch that I was trying to
> | link a directory (namely dir9) to itself.  Well, after no error message I 
> | got alittle panicky and of course did a /bin/ls.  Nothing in the . directory!
> +---------------
> 
> Check the man pages.  /etc/link is a pure link(2) with NO CHECKING WHATSOEVER
> -- it is a tool for repairing a filesystem, NOT intended for general use.
> -- 
> 	      Brandon S. Allbery, moderator of comp.sources.misc

The /etc/mvdir I have does not support multiple arguments so I obviously
don't have the same version as Markus is talking about.

However, the version which I have will not permit a directory to be moved
into another IF the two source is a prefix of the destination.  For example,

	mvdir /etc /etc

fails with the message 'arguments have common path'.  /etc/mvdir is attempting
to move /etc to /etc/etc and finds that /etc is a path prefix of /etc/etc.

The comparision is on a textual basis, so the test fails for any case where
the path contains directories such as `/etc/../etc' or even `/etc/.'.  None
the less, even these cases are detectable and any deviation from `expected'
behavior should be documented, or any paths containing `.' or `..' should
be disallowed.

/etc/mvdir can work without suprizes if properly coded.  In both my case
and Markus', the program is broken.  The user should never be expected to
do with `right' thing without first being warned about what the `wrong'
thing is.

- John.
-- 
 The Beach Bum                                 Big "D" Home for Wayward Hackers
 UUCP: ...!killer!rpp386!jfh                          jfh at rpp386.uucp :SMAILERS

 "You are in a twisty little maze of UUCP connections, all alike" -- fortune



More information about the Comp.bugs.sys5 mailing list