GNU bug report logs - #28461
erreurs

Previous Next

Package: coreutils;

Reported by: Eric Mariaud <eric.mariaud <at> gmail.com>

Date: Thu, 14 Sep 2017 17:46:02 UTC

Severity: normal

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28461 in the body.
You can then email your comments to 28461 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#28461; Package coreutils. (Thu, 14 Sep 2017 17:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Eric Mariaud <eric.mariaud <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Thu, 14 Sep 2017 17:46:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eric Mariaud <eric.mariaud <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: erreurs
Date: Thu, 14 Sep 2017 19:43:03 +0200
[Message part 1 (text/plain, inline)]
Bonjour

voici le résultat des commandes que me retourne mon terminal, Xubuntu 14.04


eric <at> Eric-Xub:~/Bureau$ expr 2 + 3
5
eric <at> Eric-Xub:~/Bureau$ expr 2 * 3
expr: erreur de syntaxe
eric <at> Eric-Xub:~/Bureau$

Cordialement
[Message part 2 (text/html, inline)]

Reply sent to Assaf Gordon <assafgordon <at> gmail.com>:
You have taken responsibility. (Thu, 14 Sep 2017 18:02:01 GMT) Full text and rfc822 format available.

Notification sent to Eric Mariaud <eric.mariaud <at> gmail.com>:
bug acknowledged by developer. (Thu, 14 Sep 2017 18:02:03 GMT) Full text and rfc822 format available.

Message #10 received at 28461-done <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Eric Mariaud <eric.mariaud <at> gmail.com>, 28461-done <at> debbugs.gnu.org
Subject: Re: bug#28461: erreurs
Date: Thu, 14 Sep 2017 12:00:53 -0600
tag 28461 notabug
stop

Hello,

On 2017-09-14 11:43 AM, Eric Mariaud wrote:
> eric <at> Eric-Xub:~/Bureau$ expr 2 + 3
> 5
> eric <at> Eric-Xub:~/Bureau$ expr 2 * 3
> expr: erreur de syntaxe

The asterisks ( * ) character has special meaning on the shell,
which you can observe by comparing the output of:

    echo 2 + 3
vs
    echo 2 * 3

Technically, the shell replaces the '*' character with the list of
all files in the current directory. The 'expr' program never sees it.

Add single-quotes around the '*' character to send it as-is to 'expr':

    $ expr 2 '*' 3
    6

Alternatively,
Most modern shells support built-in basic arithmetic using
the '$(())' syntax (dollar-sign and two parentheses):

    $ echo $((2*3))
    6


As such, I'm marking this as not-a-bug, but discussion can continue by
replying to this thread.

regards,
 - assaf





Information forwarded to bug-coreutils <at> gnu.org:
bug#28461; Package coreutils. (Fri, 15 Sep 2017 05:46:01 GMT) Full text and rfc822 format available.

Message #13 received at 28461 <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: 28461 <at> debbugs.gnu.org, assafgordon <at> gmail.com, eric.mariaud <at> gmail.com
Subject: Re: bug#28461: erreurs
Date: Fri, 15 Sep 2017 07:45:47 +0200
On 09/14/2017 08:00 PM, Assaf Gordon wrote:
> On 2017-09-14 11:43 AM, Eric Mariaud wrote:
>> eric <at> Eric-Xub:~/Bureau$ expr 2 + 3
>> 5
>> eric <at> Eric-Xub:~/Bureau$ expr 2 * 3
>> expr: erreur de syntaxe
> 
> The asterisks ( * ) character has special meaning on the shell,
> which you can observe by comparing the output of:
> 
>     echo 2 + 3
> vs
>     echo 2 * 3
> 
> Technically, the shell replaces the '*' character with the list of
> all files in the current directory. The 'expr' program never sees it.

Well, we could try to improve the error diagnostics.  I see in
the code that expr returns "syntax error" without any more explanation
in several places.  It could at least say what it would expect or
not expect in that place.

And finally - when it comes to shell pattern globbing - it could
do an extra check if the offending argument is an existing file
similar to latest 'find' [1]:

  $ touch a b c
  $ ../find/find -name *
  find: paths must precede expression: `b'
  find: possible unquoted pattern after predicate `-name'?

[1] https://git.sv.gnu.org/cgit/findutils.git/commit/?id=9530e31f6d

WDYT?

Thanks & have a nice day,
Berny




Information forwarded to bug-coreutils <at> gnu.org:
bug#28461; Package coreutils. (Fri, 15 Sep 2017 06:43:01 GMT) Full text and rfc822 format available.

Message #16 received at 28461 <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>, 28461 <at> debbugs.gnu.org,
 eric.mariaud <at> gmail.com
Subject: Re: bug#28461: erreurs
Date: Fri, 15 Sep 2017 00:41:56 -0600
[Message part 1 (text/plain, inline)]
Hello,

On 2017-09-14 11:45 PM, Bernhard Voelker wrote:
>> On 2017-09-14 11:43 AM, Eric Mariaud wrote:
>>> eric <at> Eric-Xub:~/Bureau$ expr 2 * 3
>>> expr: erreur de syntaxe
> 
> Well, we could try to improve the error diagnostics.
> 
> WDYT?

Very good idea.

Perhaps something like the attached? (not fully tested...)

-assaf
[0001-expr-add-detailed-syntax-error-messages.patch (text/x-patch, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#28461; Package coreutils. (Sat, 16 Sep 2017 03:38:02 GMT) Full text and rfc822 format available.

Message #19 received at 28461 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Assaf Gordon <assafgordon <at> gmail.com>,
 Bernhard Voelker <mail <at> bernhard-voelker.de>, 28461 <at> debbugs.gnu.org,
 eric.mariaud <at> gmail.com
Subject: Re: bug#28461: erreurs
Date: Fri, 15 Sep 2017 20:37:27 -0700
On 14/09/17 23:41, Assaf Gordon wrote:
> Hello,
> 
> On 2017-09-14 11:45 PM, Bernhard Voelker wrote:
>>> On 2017-09-14 11:43 AM, Eric Mariaud wrote:
>>>> eric <at> Eric-Xub:~/Bureau$ expr 2 * 3
>>>> expr: erreur de syntaxe
>>
>> Well, we could try to improve the error diagnostics.
>>
>> WDYT?
> 
> Very good idea.
> 
> Perhaps something like the attached? (not fully tested...)
> 
> -assaf
> 
That's a good improvement!

<bikeshedding>
I'd change:

s/missing more parameters after/missing parameter after/

This would be fine even in the case of multi param
operations like 'match' and 'substr'

thanks!
Pádraig.





Information forwarded to bug-coreutils <at> gnu.org:
bug#28461; Package coreutils. (Sat, 16 Sep 2017 03:45:02 GMT) Full text and rfc822 format available.

Message #22 received at 28461 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Pádraig Brady <P <at> draigbrady.com>
Cc: 28461 <at> debbugs.gnu.org, Assaf Gordon <assafgordon <at> gmail.com>,
 Bernhard Voelker <mail <at> bernhard-voelker.de>, eric.mariaud <at> gmail.com
Subject: Re: bug#28461: erreurs
Date: Fri, 15 Sep 2017 20:44:30 -0700
On Fri, Sep 15, 2017 at 8:37 PM, Pádraig Brady <P <at> draigbrady.com> wrote:
...
> That's a good improvement!

Indeed!

> <bikeshedding>
> I'd change:
>
> s/missing more parameters after/missing parameter after/

Or, perhaps use wording similar to what test does:

  ..._("missing argument after %s")




Information forwarded to bug-coreutils <at> gnu.org:
bug#28461; Package coreutils. (Sat, 16 Sep 2017 04:34:02 GMT) Full text and rfc822 format available.

Message #25 received at 28461 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Jim Meyering <jim <at> meyering.net>
Cc: 28461 <at> debbugs.gnu.org, Assaf Gordon <assafgordon <at> gmail.com>,
 Bernhard Voelker <mail <at> bernhard-voelker.de>, eric.mariaud <at> gmail.com
Subject: Re: bug#28461: erreurs
Date: Fri, 15 Sep 2017 21:33:00 -0700
On 15/09/17 20:44, Jim Meyering wrote:
> On Fri, Sep 15, 2017 at 8:37 PM, Pádraig Brady <P <at> draigbrady.com> wrote:
> ...
>> That's a good improvement!
> 
> Indeed!
> 
>> <bikeshedding>
>> I'd change:
>>
>> s/missing more parameters after/missing parameter after/
> 
> Or, perhaps use wording similar to what test does:
> 
>   ..._("missing argument after %s")

better again





Information forwarded to bug-coreutils <at> gnu.org:
bug#28461; Package coreutils. (Sat, 16 Sep 2017 04:39:02 GMT) Full text and rfc822 format available.

Message #28 received at 28461 <at> debbugs.gnu.org (full text, mbox):

From: R0b0t1 <r030t1 <at> gmail.com>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: 28461 <at> debbugs.gnu.org, assafgordon <at> gmail.com, eric.mariaud <at> gmail.com
Subject: Re: bug#28461: erreurs
Date: Fri, 15 Sep 2017 23:23:31 -0500
On Fri, Sep 15, 2017 at 12:45 AM, Bernhard Voelker
<mail <at> bernhard-voelker.de> wrote:
> And finally - when it comes to shell pattern globbing - it could
> do an extra check if the offending argument is an existing file
> similar to latest 'find' [1]:
>
>   $ touch a b c
>   $ ../find/find -name *
>   find: paths must precede expression: `b'
>   find: possible unquoted pattern after predicate `-name'?
>
> [1] https://git.sv.gnu.org/cgit/findutils.git/commit/?id=9530e31f6d
>
> WDYT?
>

I think the proposed change is useful.

For consistency's sake, I feel like I need to point out that I
suggested a similar change to "rm" (check to make sure $HOME was not a
target) and one of the arguments against such a check was that the
file operations necessary to do so would take too much time. It may be
a good idea to consider that in this case as well. I personally do not
understand how this might be the case, but I admit to possessing no
great intellect.

Respectfully,
     R0b0t1




Information forwarded to bug-coreutils <at> gnu.org:
bug#28461; Package coreutils. (Sat, 16 Sep 2017 07:28:02 GMT) Full text and rfc822 format available.

Message #31 received at 28461 <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: R0b0t1 <r030t1 <at> gmail.com>
Cc: 28461 <at> debbugs.gnu.org, assafgordon <at> gmail.com, eric.mariaud <at> gmail.com
Subject: Re: bug#28461: erreurs
Date: Sat, 16 Sep 2017 09:27:00 +0200
On 09/16/2017 06:23 AM, R0b0t1 wrote:
> For consistency's sake, I feel like I need to point out that I
> suggested a similar change to "rm" (check to make sure $HOME was not a
> target) and one of the arguments against such a check was that the
> file operations necessary to do so would take too much time.

It seems quite likely that the user forgot to quote the
multiplier "*" argument. And expr is terminating anyway,
so the extra check would just be executed once.

Have a nice day,
Berny




Information forwarded to bug-coreutils <at> gnu.org:
bug#28461; Package coreutils. (Sun, 17 Sep 2017 06:28:01 GMT) Full text and rfc822 format available.

Message #34 received at 28461 <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Pádraig Brady <P <at> draigBrady.com>,
 Jim Meyering <jim <at> meyering.net>
Cc: 28461 <at> debbugs.gnu.org, Bernhard Voelker <mail <at> bernhard-voelker.de>,
 eric.mariaud <at> gmail.com
Subject: Re: bug#28461: erreurs
Date: Sun, 17 Sep 2017 00:27:27 -0600
[Message part 1 (text/plain, inline)]
On 2017-09-15 10:33 PM, Pádraig Brady wrote:
> On 15/09/17 20:44, Jim Meyering wrote:
>> Or, perhaps use wording similar to what test does:
>>
>>   ..._("missing argument after %s")
> 
> better again

Thank you for all comments.

Attached an updated patch with all instances of 'parameter'
changed to 'argument'.


regards,
 - assaf

[0001-expr-add-detailed-syntax-error-messages.patch (text/x-patch, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#28461; Package coreutils. (Mon, 18 Sep 2017 00:48:02 GMT) Full text and rfc822 format available.

Message #37 received at 28461-done <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Assaf Gordon <assafgordon <at> gmail.com>
Cc: 28461-done <at> debbugs.gnu.org, Bernhard Voelker <mail <at> bernhard-voelker.de>,
 Pádraig Brady <P <at> draigbrady.com>,
 Eric Mariaud <eric.mariaud <at> gmail.com>
Subject: Re: bug#28461: erreurs
Date: Sun, 17 Sep 2017 17:47:28 -0700
On Sat, Sep 16, 2017 at 11:27 PM, Assaf Gordon <assafgordon <at> gmail.com> wrote:
...
> Attached an updated patch with all instances of 'parameter'
> changed to 'argument'.

Looks fine. Thank you!
I marked the issue as "done".




Information forwarded to bug-coreutils <at> gnu.org:
bug#28461; Package coreutils. (Wed, 20 Sep 2017 06:01:02 GMT) Full text and rfc822 format available.

Message #40 received at 28461-done <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Jim Meyering <jim <at> meyering.net>
Cc: 28461-done <at> debbugs.gnu.org, Bernhard Voelker <mail <at> bernhard-voelker.de>,
 Pádraig Brady <P <at> draigbrady.com>,
 Eric Mariaud <eric.mariaud <at> gmail.com>
Subject: Re: bug#28461: erreurs
Date: Tue, 19 Sep 2017 23:59:56 -0600
On 2017-09-17 06:47 PM, Jim Meyering wrote:
> On Sat, Sep 16, 2017 at 11:27 PM, Assaf Gordon <assafgordon <at> gmail.com> wrote:
> ...
>> Attached an updated patch with all instances of 'parameter'
>> changed to 'argument'.
> 
> Looks fine. Thank you!
> I marked the issue as "done".

Thank you all.
Pushed here:
  https://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=454d7f31


regards,
 - assaf




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 18 Oct 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 192 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.