public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/111360] New: contrib/gcc_update: bad test
@ 2023-09-10  9:49 egallager at gcc dot gnu.org
  2023-09-10  9:51 ` [Bug other/111360] " egallager at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: egallager at gcc dot gnu.org @ 2023-09-10  9:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111360
           Summary: contrib/gcc_update: bad test
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: egallager at gcc dot gnu.org
  Target Milestone: ---

Running contrib/gcc_update on the gcc111 machine on the compile farm includes
the following message in its output:

./contrib/gcc_update[346]: test: argument expected

The line in question has:

        if test -n $r; then

Shouldn't the "${r}" be quoted or something? Or maybe the issue is actually
that the command to set it on the previous lines is failing; it's set like
this:

        # Open-coded version of "git gcc-descr" from
contrib/gcc-git-customization.sh
        revision=`$GCC_GIT log -n1 --pretty=tformat:%h`
        r=`$GCC_GIT describe --all --match 'basepoints/gcc-[0-9]*' HEAD \
           | sed -n
's,^\(tags/\)\?basepoints/gcc-\([0-9]\+\)-\([0-9]\+\)-g[0-9a-f]*$,r\2-\3,p;s,^\(tags/\)\?basepoints/gcc-\([0-9]\+\)$,r\2-0,p'`;

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

* [Bug other/111360] contrib/gcc_update: bad test
  2023-09-10  9:49 [Bug other/111360] New: contrib/gcc_update: bad test egallager at gcc dot gnu.org
@ 2023-09-10  9:51 ` egallager at gcc dot gnu.org
  2023-09-11  9:02 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: egallager at gcc dot gnu.org @ 2023-09-10  9:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |belyshev at depni dot sinp.msu.ru

--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
git blame says that Serge Belyshev was the last to touch this line in
r12-3370-g78b34cd8a803aa; adding to cc

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

* [Bug other/111360] contrib/gcc_update: bad test
  2023-09-10  9:49 [Bug other/111360] New: contrib/gcc_update: bad test egallager at gcc dot gnu.org
  2023-09-10  9:51 ` [Bug other/111360] " egallager at gcc dot gnu.org
@ 2023-09-11  9:02 ` redi at gcc dot gnu.org
  2023-09-12 11:45 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2023-09-11  9:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-09-11
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #0)
> Running contrib/gcc_update on the gcc111 machine on the compile farm
> includes the following message in its output:
> 
> ./contrib/gcc_update[346]: test: argument expected
> 
> The line in question has:
> 
> 	if test -n $r; then
> 
> Shouldn't the "${r}" be quoted or something?

Yes, either $r is non-empty and the test passes or it's empty and the script is
broken. So you might as well just assume it's non-empty!

It should be quoted. "$r" is fine, there's no need for braces around it.

> Or maybe the issue is actually
> that the command to set it on the previous lines is failing;

Commands can fail. If the script is testing for a non-empty result, presumably
it's acceptable for the command to fail, so the script should just test
correctly.

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

* [Bug other/111360] contrib/gcc_update: bad test
  2023-09-10  9:49 [Bug other/111360] New: contrib/gcc_update: bad test egallager at gcc dot gnu.org
  2023-09-10  9:51 ` [Bug other/111360] " egallager at gcc dot gnu.org
  2023-09-11  9:02 ` redi at gcc dot gnu.org
@ 2023-09-12 11:45 ` cvs-commit at gcc dot gnu.org
  2023-09-12 12:12 ` redi at gcc dot gnu.org
  2023-09-12 19:01 ` egallager at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-12 11:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:df63338236b91ba79d5f89fce9b16e0c34b2bada

commit r14-3879-gdf63338236b91ba79d5f89fce9b16e0c34b2bada
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Sep 12 12:02:13 2023 +0100

    contrib: Quote variable in test expression [PR111360]

    Without the quotes some shells will always return true and some will
    print an error. It should be quoted so that a null variable works as
    intended.

    contrib/ChangeLog:

            PR other/111360
            * gcc_update: Quote variable.

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

* [Bug other/111360] contrib/gcc_update: bad test
  2023-09-10  9:49 [Bug other/111360] New: contrib/gcc_update: bad test egallager at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-09-12 11:45 ` cvs-commit at gcc dot gnu.org
@ 2023-09-12 12:12 ` redi at gcc dot gnu.org
  2023-09-12 19:01 ` egallager at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2023-09-12 12:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed on trunk

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

* [Bug other/111360] contrib/gcc_update: bad test
  2023-09-10  9:49 [Bug other/111360] New: contrib/gcc_update: bad test egallager at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-09-12 12:12 ` redi at gcc dot gnu.org
@ 2023-09-12 19:01 ` egallager at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: egallager at gcc dot gnu.org @ 2023-09-12 19:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #4)
> Fixed on trunk

Cool, thanks. I'm wondering if it might be worthwhile to run shellcheck[1] on
GCC's various shell scripts to catch similar mistakes? I just tried running it
on all the ones in contrib/, but the output seemed rather noisy...

[1]: https://www.shellcheck.net/

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

end of thread, other threads:[~2023-09-12 19:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-10  9:49 [Bug other/111360] New: contrib/gcc_update: bad test egallager at gcc dot gnu.org
2023-09-10  9:51 ` [Bug other/111360] " egallager at gcc dot gnu.org
2023-09-11  9:02 ` redi at gcc dot gnu.org
2023-09-12 11:45 ` cvs-commit at gcc dot gnu.org
2023-09-12 12:12 ` redi at gcc dot gnu.org
2023-09-12 19:01 ` egallager 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).