public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/105831] New: Nonportable syntax in "test" and "[" commands.
@ 2022-06-03  9:49 micha at NetBSD dot org
  2022-06-04  3:45 ` [Bug bootstrap/105831] " egallager at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: micha at NetBSD dot org @ 2022-06-03  9:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105831

            Bug ID: 105831
           Summary: Nonportable syntax in "test" and "[" commands.
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: micha at NetBSD dot org
  Target Milestone: ---

Created attachment 53076
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53076&action=edit
Patches for portable string comparison (POSIX shell)

Nonportable string comparisons in files "gcc/configure.ac" and
"gcc/config/nvptx/gen-opt.sh".

Patches attached for portable POSIX syntax.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug bootstrap/105831] Nonportable syntax in "test" and "[" commands.
  2022-06-03  9:49 [Bug bootstrap/105831] New: Nonportable syntax in "test" and "[" commands micha at NetBSD dot org
@ 2022-06-04  3:45 ` egallager at gcc dot gnu.org
  2022-06-06 10:19 ` redi at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: egallager at gcc dot gnu.org @ 2022-06-04  3:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105831

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egallager at gcc dot gnu.org

--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
Hi, please send the patch to the gcc-patches mailing list for review.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug bootstrap/105831] Nonportable syntax in "test" and "[" commands.
  2022-06-03  9:49 [Bug bootstrap/105831] New: Nonportable syntax in "test" and "[" commands micha at NetBSD dot org
  2022-06-04  3:45 ` [Bug bootstrap/105831] " egallager at gcc dot gnu.org
@ 2022-06-06 10:19 ` redi at gcc dot gnu.org
  2023-05-18  1:58 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2022-06-06 10:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105831

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Right. The patch looks correct, but patches should be sent to the list, not
added to bugzilla:
https://gcc.gnu.org/contribute.html#patches

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug bootstrap/105831] Nonportable syntax in "test" and "[" commands.
  2022-06-03  9:49 [Bug bootstrap/105831] New: Nonportable syntax in "test" and "[" commands micha at NetBSD dot org
  2022-06-04  3:45 ` [Bug bootstrap/105831] " egallager at gcc dot gnu.org
  2022-06-06 10:19 ` redi at gcc dot gnu.org
@ 2023-05-18  1:58 ` pinskia at gcc dot gnu.org
  2023-05-18  1:58 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-18  1:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105831

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note I think most folks on AIX, uses CONFIG_SHELL=bash due to the speed of
/bin/sh and configure :
https://gcc.gnu.org/install/specific.html#x-ibm-aix

So the patch to configure.ac while good does not do much.

And IIRC nvptx target is really only tested on GNU/Linux so nvptx/gen-opt.sh
will most likely only be invoked with bash (dash?).

So while good, will not do much.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug bootstrap/105831] Nonportable syntax in "test" and "[" commands.
  2022-06-03  9:49 [Bug bootstrap/105831] New: Nonportable syntax in "test" and "[" commands micha at NetBSD dot org
                   ` (2 preceding siblings ...)
  2023-05-18  1:58 ` pinskia at gcc dot gnu.org
@ 2023-05-18  1:58 ` pinskia at gcc dot gnu.org
  2023-05-18  8:44 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-18  1:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105831

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-05-18
             Status|UNCONFIRMED                 |NEW

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug bootstrap/105831] Nonportable syntax in "test" and "[" commands.
  2022-06-03  9:49 [Bug bootstrap/105831] New: Nonportable syntax in "test" and "[" commands micha at NetBSD dot org
                   ` (3 preceding siblings ...)
  2023-05-18  1:58 ` pinskia at gcc dot gnu.org
@ 2023-05-18  8:44 ` redi at gcc dot gnu.org
  2023-05-18  8:58 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2023-05-18  8:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105831

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The == syntax also fails with dash, which is used as the default /bin/sh on
debian:

$ /bin/sh -c "test foo = foo && echo y"
y
$ /bin/sh -c "test foo == foo && echo y"
/bin/sh: 1: test: foo: unexpected operator

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug bootstrap/105831] Nonportable syntax in "test" and "[" commands.
  2022-06-03  9:49 [Bug bootstrap/105831] New: Nonportable syntax in "test" and "[" commands micha at NetBSD dot org
                   ` (4 preceding siblings ...)
  2023-05-18  8:44 ` redi at gcc dot gnu.org
@ 2023-05-18  8:58 ` redi at gcc dot gnu.org
  2023-05-18 12:57 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2023-05-18  8:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105831

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
== does work with ksh, which is used as /bin/sh on AIX, Solaris, and OpenBSD,
and works with FreeBSD sh (derived from ask, I think).

It doesn't work with dash, or NetBSD sh (also derived from ash, I think), or
with zsh (unless you quote it as "==").

So I think we do want this change. I'll get it pushed.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug bootstrap/105831] Nonportable syntax in "test" and "[" commands.
  2022-06-03  9:49 [Bug bootstrap/105831] New: Nonportable syntax in "test" and "[" commands micha at NetBSD dot org
                   ` (5 preceding siblings ...)
  2023-05-18  8:58 ` redi at gcc dot gnu.org
@ 2023-05-18 12:57 ` redi at gcc dot gnu.org
  2023-05-18 14:24 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2023-05-18 12:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105831

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Submitted as https://gcc.gnu.org/pipermail/gcc-patches/2023-May/618914.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug bootstrap/105831] Nonportable syntax in "test" and "[" commands.
  2022-06-03  9:49 [Bug bootstrap/105831] New: Nonportable syntax in "test" and "[" commands micha at NetBSD dot org
                   ` (6 preceding siblings ...)
  2023-05-18 12:57 ` redi at gcc dot gnu.org
@ 2023-05-18 14:24 ` cvs-commit at gcc dot gnu.org
  2023-05-18 14:24 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-18 14:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105831

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:95b93adcac69536bab617e045149719ec69099ae

commit r14-968-g95b93adcac69536bab617e045149719ec69099ae
Author: Michael Bäuerle <micha@NetBSD.org>
Date:   Thu May 18 10:15:49 2023 +0100

    gcc: Fix nonportable shell syntax in "test" and "[" commands [PR105831]

    POSIX sh does not support the == for string comparisons, use = instead.

    gcc/ChangeLog:

            PR bootstrap/105831
            * config/nvptx/gen-opt.sh: Use = operator instead of ==.
            * configure.ac: Likewise.
            * configure: Regenerate.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug bootstrap/105831] Nonportable syntax in "test" and "[" commands.
  2022-06-03  9:49 [Bug bootstrap/105831] New: Nonportable syntax in "test" and "[" commands micha at NetBSD dot org
                   ` (7 preceding siblings ...)
  2023-05-18 14:24 ` cvs-commit at gcc dot gnu.org
@ 2023-05-18 14:24 ` cvs-commit at gcc dot gnu.org
  2023-05-18 14:24 ` cvs-commit at gcc dot gnu.org
  2023-05-18 14:26 ` redi at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-18 14:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105831

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:6e2fbe4f345f48ae3c8ba5bfbc1a7b783b398614

commit r14-969-g6e2fbe4f345f48ae3c8ba5bfbc1a7b783b398614
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu May 18 10:18:19 2023 +0100

    gcc: Fix nonportable shell syntax in "test" and "[" commands [PR105831]

    POSIX sh does not support the == for string comparisons, use = instead.

    The gen_directive_tests script uses a bash shebang so == does work, but
    there's no reason this script can't just use the more portable form
    anyway.

            PR bootstrap/105831

    gcc/ChangeLog:

            * config.gcc: Use = operator instead of ==.

    gcc/testsuite/ChangeLog:

            * gcc.test-framework/gen_directive_tests: Use = operator instead
            of ==.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug bootstrap/105831] Nonportable syntax in "test" and "[" commands.
  2022-06-03  9:49 [Bug bootstrap/105831] New: Nonportable syntax in "test" and "[" commands micha at NetBSD dot org
                   ` (8 preceding siblings ...)
  2023-05-18 14:24 ` cvs-commit at gcc dot gnu.org
@ 2023-05-18 14:24 ` cvs-commit at gcc dot gnu.org
  2023-05-18 14:26 ` redi at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-18 14:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105831

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:120e444974e12eb727eea170a3bfd80783e3851f

commit r14-970-g120e444974e12eb727eea170a3bfd80783e3851f
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu May 18 10:18:19 2023 +0100

    contrib: Fix nonportable shell syntax in "test" and "[" commands [PR105831]

    POSIX sh does not support the == for string comparisons, use = instead.

    These contrib scripts all use a bash shebang so == does work, but
    there's no reason they can't just use the more portable form anyway.

            PR bootstrap/105831

    contrib/ChangeLog:

            * bench-stringop: Use = operator instead of ==.
            * repro_fail: Likewise.

    contrib/reghunt/ChangeLog:

            * bin/reg-hunt: Use = operator instead of ==.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug bootstrap/105831] Nonportable syntax in "test" and "[" commands.
  2022-06-03  9:49 [Bug bootstrap/105831] New: Nonportable syntax in "test" and "[" commands micha at NetBSD dot org
                   ` (9 preceding siblings ...)
  2023-05-18 14:24 ` cvs-commit at gcc dot gnu.org
@ 2023-05-18 14:26 ` redi at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2023-05-18 14:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105831

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
   Target Milestone|---                         |14.0
         Resolution|---                         |FIXED

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed on trunk (and some other cases of == elsewhere). Thanks for the patch and
report.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-05-18 14:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-03  9:49 [Bug bootstrap/105831] New: Nonportable syntax in "test" and "[" commands micha at NetBSD dot org
2022-06-04  3:45 ` [Bug bootstrap/105831] " egallager at gcc dot gnu.org
2022-06-06 10:19 ` redi at gcc dot gnu.org
2023-05-18  1:58 ` pinskia at gcc dot gnu.org
2023-05-18  1:58 ` pinskia at gcc dot gnu.org
2023-05-18  8:44 ` redi at gcc dot gnu.org
2023-05-18  8:58 ` redi at gcc dot gnu.org
2023-05-18 12:57 ` redi at gcc dot gnu.org
2023-05-18 14:24 ` cvs-commit at gcc dot gnu.org
2023-05-18 14:24 ` cvs-commit at gcc dot gnu.org
2023-05-18 14:24 ` cvs-commit at gcc dot gnu.org
2023-05-18 14:26 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).