network filenames

Clive Feather clive at ixi.UUCP
Thu Jun 22 02:15:19 AEST 1989


In article <3620 at orca.WV.TEK.COM> andrew at frip.WV.TEK.COM (Andrew Klossner) writes:
}	"If find // to be both concise and from the *users* point of
}	view quite indicative of "something special".  It seems that
}	only "wizards" get hung up on the point that is normally
}	semantically equivalent to / in file names."
}
>No, innocent programs get hung up too.  For example, this shell script
}fragment:
}
}	cp input_file $HOME/tmp_file
>
}will, if run by root (with $HOME="/"), expand into:
>
}	cp input_file //tmp_file
}
}and the kernel network code goes off in search of machine "tmp_file".

Posix says that leading // is implementation defined, but all other cases of
multiple slashes are equivalent to a single slash. The Rationale then tells
you to concatenate using two slashes:

	cp input_file $HOME//tmp_file

This will work unless $HOME=// (a very unlikely case).
-- 
Clive D.W. Feather
IXI Limited
clive at ixi.uucp
...!uunet!ukc!ixi!clive (riskier)



More information about the Comp.unix.wizards mailing list