*BSD News Article 13507


Return to BSD News archive

Newsgroups: comp.os.386bsd.bugs
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!howland.reston.ans.net!gatech!destroyer!cs.ubc.ca!van-bc!inde!newshost!gday
From: gday@ignatz.inde.bc.ca (Gordon Day)
Subject: Re: patch for bin/rm/rm.c
In-Reply-To: terry@cs.weber.edu's message of Wed, 24 Mar 93 22:21:33 GMT
Message-ID: <GDAY.93Mar26114912@ignatz.inde.bc.ca>
Sender: news@inde.bc.ca
Organization: INDE Electronics, Inc.
References: <1oligtINN6mj@ftp.UU.NET> <f0Yl6J8@quack.kfu.com>
	<CGD.93Mar23164609@erewhon.CS.Berkeley.EDU>
	<1993Mar24.222133.14022@fcom.cc.utah.edu>
Date: Fri, 26 Mar 1993 19:49:12 GMT
Lines: 64

>>>"terry" == A Wizard of Earth C <terry@cs.weber.edu> writes:

[code related stuff deleted]

terry> In SVR4, the removal of trailing slashes is done automatically
terry> (by some code similar to that for symbolic links).

terry> In SunOS, the trailing slashes are removed in a way that would
terry> make you expect it to operate like SVR4; however, although a
terry> trailing slash is seen as an explicit tag that the file *must*
terry> be a directory, functions for manipulating directories fail:

% mkdir foo 
% ls -ld foo 

drwxrwxr-x 2 terry 512 Mar 24 15:12 foo 
% rmdir foo/ rmdir: foo/: Invalid argument
<<<<<<<<<<#1!!!!!!!!!!!!!!!!  
% rm foo rm: foo is a directory 
% rm foo/ rm: foo/ is a directory 
% rmdir foo 
% touch foo 
% rmdir foo rmdir: foo: Not a directory <<<<<<<<<<#2!!!!!!!!!!!!!!!!  
% rmdir foo/ rmdir: foo/: Not a directory 
% rm foo/ rm: foo/: Not a directory <<<<<<<<<<#3!!!!!!!!!!!!!!!!  
% rm foo

terry> In other words, in SunOS, cases 1, 2, and 3 are inconsistant.

First of all, only case 1 is inconsistent with cases 2 and 3.
Secondly, just because SunOs is inconsistent does not mean that they
don't have the right idea.  I find it extremely useful to be able to
do something like...

mv bar/* foo/

 ...knowing that the command will _fail_ if foo is not a directory.
The idea that the OS will silently "help me out" by clobbering a bunch
of files does not thrill me.  If the trailing slash is not going to
guarantee a directory, I would much rather that the call fail than
reinterpret what I mean.  One could say that I should do an ls -l
_before_ I do the move, but it is much faster/easier to get into the
habit of adding a trailing slash, not to mention the fact we do not
always act on our best intentions :-).

terry> I believe we should follow the SVR4 model on this one, since it
terry> seems the wave of the future is POSIX compliance.

Why accept the "standard" when the standard is arguably flawed?  When
there is the possibility of losing data, I would rather sit on the
conservative side.

terry> What does everyone else think, before I go off and make the
terry> obvious patch?

You don't have my vote here.  I encourage you to reconsider this one.
Other thoughts?

Ta,

Gordon.
_______________________________________________________________________________
gordon day, inde electronics, +1-604-430-1446.