coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Enhancement Requests + Patch: Unlink to support multiple arguments


From: Bob Proulx
Subject: Re: Enhancement Requests + Patch: Unlink to support multiple arguments
Date: Wed, 18 Nov 2015 00:14:08 -0700
User-agent: Mutt/1.5.24 (2015-08-30)

Pádraig Brady wrote:
> Bob Proulx wrote:
> > Why are you using unlink here instead of rm?  I think you are using
> > the wrong tool for the job.  Why even care if unlink can take multiple
> > arguments?
>...
> Good info thanks. Yes rm will not unlink() a dir.

Is the use of unlink so that it works on either files or directories?
Seemingly an unusual case.  And what if the directory is not empty?
And also why not use rmdir on directories?

> >> Is this something the community would like for me to submit?
> > 
> > I do not have a strong opinion.  Traditional Unix systems only allowed
> > one argument and no options.  *BSD now allows multiple arguments and
> > includes various options.  It would be nice to be compatible with *BSD.
> 
> I'm not sure they do?

Oops.  Yes.  I see I was wrong there.

> Note the rm and unlink man pages are merged in FreeBSD at least,
> which might confuse things.

Oh, yes, that does tend to put people on that track.  I wonder why
they merge those two but don't merge rmdir?  I wouldn't merge any of
those and would keep all three separate.  Frankly I would deprecate
and hide unlink the command as much as possible.  If (and I wouldn't
but if) I were to merge two man pages I would merge rm and rmdir and
not rm and unlink.

Looking at the man page now I see:

  SYNOPSIS
     rm [-f | -i] [-dIPRrvWx] file ...
     unlink file

> > one argument and no options.  *BSD now allows multiple arguments and
> > includes various options.  It would be nice to be compatible with *BSD.

I was wrong.  Drat!  *BSD does NOT allow multiple arguments does not
not allow options.  As the man page synopsis clearly shows.  So
actually GNU unlink appears perfectly compatible with *BSD as well as
the traditional Unix systems such as HP-UX and so forth.  I had that
statement wrong.  Oops.

I guess with *BSD having the same unlink behavior as GNU unlink I
would lean to do nothing so as to remain compatible.  And I would
encourage people not to use the unlink command further.

Nothing prevents people from using the unlink system call however.
For example using perl:

  perl -e 'unlink "foo"'

Bob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]