[comp.sys.amiga] Bug in ARP Rename command

rss@ece-csc.UUCP (Ralph Scherp) (05/13/88)

I've found what appears to be a bug with the ARP "rename" command.
Specifically, if you do a "rename" command with the destination file
being a directory of the form "/" or "", the file actually gets put
into the directory which is the PARENT of the proper destination 
directory.  E.G.:

     cd dh0:source/junk
     rename fubar /

gives you the file "dh0:fubar" instead of "dh0:source/fubar"; likewise:

    rename fubar ""

gives you "dh0:source/fubar".  If "fubar" instead lives in "dh0:source";
then the sequence

     cd dh0:source
     rename fubar /

gives you the error message "Can't rename fubar as //fubar", which seems
like a strong hint that "rename" is trying to add an inappropriate "/"
character before invoking the system (DOS) Rename() function (or whatever
the appropriate system call is.)

Incidentally, if `rename fubar ""' seems strange, consider going to a 
subdirectory and doing `rename :fubar ""' to move something from the
root of the disk into the current directory, which displays the same
behavior.

This is with ARP version 34.1 [Is there a later version?].
     
 			--Mark Lanzo--
                        (borrowing a friend's acct)

ins_adjb@jhunix.HCF.JHU.EDU (Daniel Jay Barrett) (05/14/88)

In article <3579@ece-csc.UUCP> rss@ece-csc.UUCP writes:
:Specifically, if you do a "rename" command with the destination file
:being a directory of the form "/" or "", the file actually gets put
:into the directory which is the PARENT of the proper destination 
:directory.  E.G.:
:
:     cd dh0:source/junk
:     rename fubar /
:
:gives you the file "dh0:fubar" instead of "dh0:source/fubar"; likewise:

	I noticed this bug about a month ago and reported it to
MicroSmiths.  Just for the record.
-- 
Dan Barrett	ins_adjb@jhunix.UUCP
		barrett@cs.jhu.edu

peter@sugar.UUCP (Peter da Silva) (05/15/88)

In article <3579@ece-csc.UUCP>, rss@ece-csc.UUCP writes:
> gives you the error message "Can't rename fubar as //fubar", which seems
> like a strong hint that "rename" is trying to add an inappropriate "/"
> character before invoking the system (DOS) Rename() function (or whatever
> the appropriate system call is.)

I ran into this problem in Browser. In the published version I wrote a fairly
complex routine to figure out when to add the slash. In the current working
version I "CurrentDir(destdir)" and do a "Rename(sourcefile, filename)" for
the case where the destination is a directory. To get the filename the best
way (because it gives you the real case) is to Examine it and pull the
fib_FileName out.
-- 
-- Peter da Silva      `-_-'      ...!hoptoad!academ!uhnix1!sugar!peter
-- "Have you hugged your U wolf today?" ...!bellcore!tness1!sugar!peter
-- Disclaimer: These may be the official opinions of Hackercorp.