Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!brl-adm!brl-smoke!smoke!wayne@ames-nas.arpa From: wayne@ames-nas.arpa (Wayne Hathaway) Newsgroups: net.unix-wizards Subject: Re: rcp Message-ID: <1702@brl-smoke.ARPA> Date: Tue, 11-Mar-86 17:33:23 EST Article-I.D.: brl-smok.1702 Posted: Tue Mar 11 17:33:23 1986 Date-Received: Fri, 14-Mar-86 06:47:46 EST Sender: news@brl-smoke.ARPA Lines: 56 Regarding the BSD "feature" of trashing files if you happen to forget which host you are on and do an rcp of a file onto itself: We (Sterling Software, formerly Informatics) are developing networking software for NASA Ames based on 4.2BSD, and we recognized very early that users would be most unhappy with the virgin BSD behavior. Our first "fix" was to compare the local hostname (from gethostname()) against the colon name and all its aliases (from gethostbyname()). For singly homed hosts, this is reasonably effective. The better fix, which is currently being installed, relates to the uid/gid mapping capability we implemented as part of our Newcastle Connection-based distributed file system (described in an earlier mail to this group). The problem was that uid/gid mappings should be based on MACHINE, rather than PATH (which unfortunately is what Internet names and addresses refer to). That is, it shouldn't matter that a connection came over the HYPERchannel, the Ethernet, or through the IMP -- what counts is the source machine itself. To facilitate this type of mapping, we (re)introduced the concept of machine-id, or mid. Now, with every host in our network assigned a unique mid, it is an easy matter to fetch the mids of both files, and thus protect against the BSD behavior. Also note that this fix is needed for cp itself in a distributed file system environment, particularly since we allow either hostname or alias to be used in remote pathnames (which all start with /r/). Thus our version of Newcastle handles things like cp /r/cramden/etc/hosts /r/ralphie-boy/etc/hosts where "ralphie-boy" is an alias for "cramden." This was a trivial change to mv.c to check for identical mids as well as identical device and inode numbers, using a new pseudo- syscall "statmid" which returns a file's mid ("pseudo- syscall" because it is done in the C library; our distributed file system requires no kernel changes). And a side comment/question: The "hostid" concept of 4.2BSD would seem to have been a start at "machine-ids", but then they went and equated it with Internet address (which of course completely defeats the benefits). Anybody know what Berkeley had in mind for "hostid"? Wayne Hathaway wayne@ames-nas.arpa Sterling Software/Informatics PS: Or is that "kramden"?