GNU bug report logs - #52873
expr unexpected syntax error

Previous Next

Package: coreutils;

Reported by: Martin Rixham <martin.rixham <at> equalexperts.com>

Date: Wed, 29 Dec 2021 16:14:02 UTC

Severity: normal

Tags: notabug

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#52873: closed (expr unexpected syntax error)
Date: Wed, 29 Dec 2021 19:53:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Wed, 29 Dec 2021 11:52:25 -0800
with message-id <3df84a2c-05aa-7aea-6d38-6ebe80a3b76f <at> cs.ucla.edu>
and subject line Re: bug#52873: expr unexpected syntax error
has caused the debbugs.gnu.org bug report #52873,
regarding expr unexpected syntax error
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
52873: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=52873
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Martin Rixham <martin.rixham <at> equalexperts.com>
To: bug-coreutils <at> gnu.org
Subject: expr unexpected syntax error
Date: Wed, 29 Dec 2021 12:42:24 +0000
[Message part 3 (text/plain, inline)]
I'm getting an error from the following:

    [martin <at> fedora ~]$ expr ')' : '.*'
    expr: syntax error: unexpected ')'

There also seems to be a similar problem with:

    expr '(' : '.*'

Here's the version:

    [martin <at> fedora ~]$ expr --version
    expr (GNU coreutils) 8.32
    Copyright (C) 2020 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <
https://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    Written by Mike Parker, James Youngman, and Paul Eggert.

And a uname for good measure:

    [martin <at> fedora ~]$ uname -a
    Linux fedora 5.15.7-200.fc35.x86_64 #1 SMP Wed Dec 8 19:00:47 UTC 2021
x86_64 x86_64 x86_64 GNU/Linux

Thanks,

Martin
[Message part 4 (text/html, inline)]
[Message part 5 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Davide Brini <dave_br <at> gmx.com>
Cc: Martin Rixham <martin.rixham <at> equalexperts.com>, 52873-done <at> debbugs.gnu.org
Subject: Re: bug#52873: expr unexpected syntax error
Date: Wed, 29 Dec 2021 11:52:25 -0800
On 12/29/21 08:31, Davide Brini wrote:
> I think you need to use '+' before the offending token

Yes. That's a GNU extension. If you want to be portable to any POSIX 
implementation, you can use this instead:

expr "X(" : '.*' - 1

A similar example is given in the POSIX spec for 'expr':

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/expr.html

As this is not a bug, I'm closing the bug report.


This bug report was last modified 3 years and 196 days ago.

Previous Next


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