coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] test: Add unary operator -E: test that a file is an empty di


From: Mattias Andrée
Subject: Re: [PATCH] test: Add unary operator -E: test that a file is an empty directory
Date: Wed, 6 Apr 2016 20:23:07 +0200
User-agent: Claws Mail

On Wed, 6 Apr 2016 11:58:11 -0600
Eric Blake <address@hidden> wrote:

> On 04/06/2016 11:09 AM, address@hidden wrote:
> > From: Mattias Andrée <address@hidden>
> > 
> > ---
> >  doc/coreutils.texi |  7 ++++++-
> >  src/test.c         | 44
> > +++++++++++++++++++++++++++++++++++++++++++- 2 files
> > changed, 49 insertions(+), 2 deletions(-)  
> 
> 
> Thanks for the patch, and remembering to document it.
> However, it also needs a NEWS entry and testsuite
> coverage; by the time you do that, the patch may be
> non-trivial enough to need copyright assignment.

Will do. Copyright assignment request has already been send.

> 
> Also, the bar for adding new options to 'test' is very
> high - is there any other existing practice (say in bash,
> ksh, zsh, BSD, or elsewhere) that is already using -E,
> and if so, are they using it for the same purpose?  If
> so, mention it and this patch is worthwhile; if not, I'm
> a bit reluctant to be the first inventor, especially if
> something else more portable can be used.

I have not looked at all shells, but for non-builtin
implementations it seems like -E is free on all
implementations and that there is no equivalent.
I have submitted this addition too to sbase, but it is
pending. The rationale for this flag that it is better
to implement it in test than as a separate command.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=385069

> 
> On the other hand, I readily concur that "test -s
> directory" does NOT accurately report whether the
> directory has contents, so maybe adding the new operator
> has justification on that grounds; it would also be nice
> if you could simultaneously propose it on the bash
> mailing list, so that multiple GNU programs implement the
> same semantics at once.
> 

I was think about proposing Bash add it, or simply
remove the builtin test command completely.
Bash's test and coreutils's test are not fully compatible
(Bash does not support big integers, and have a bug
[have not reported it yet] where it fails follow POSIX's
rules of how to parse the expression,) and I don't
see the use of having test built in, but perhaps they
do. And if there really is a need for a builtin, just
embed coreutil's implementation.

Attachment: pgpWYtD9kDtrN.pgp
Description: OpenPGP digital signature


reply via email to

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