Bug 65598 - gcc 3.1 reports ugly version string
Summary: gcc 3.1 reports ugly version string
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: gcc
Version: 1.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-05-28 13:24 UTC by darkeye
Modified: 2008-05-01 15:38 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-05-28 13:26:15 UTC
Embargoed:


Attachments (Terms of Use)

Description darkeye 2002-05-28 13:24:51 UTC
Description of Problem:
when invoking gcc --version, the usual ouput for gcc is to report nothing
else but its version number. E.g. one would expect:

$ gcc --version
3.1.1

or maybe:

$ gcc --version
3.1.1 20020522 (prerelease)


or something similar. Whereas the gcc-3.1-2 RPM reports a very long
bogus string:

$ gcc --version
gcc (GCC) 3.1 20020522 (Red Hat Linux Rawhide 3.1-2)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


The major problem with this is that the string does not start with the
version number of the gcc. Several configure scripts rely on this version
number when configuring a Makefile to apply appropriate flags. One
such configure script is the one for lame 3.92 (http://www.mp3dev.org/mp3/)


Version-Release number of selected component (if applicable):
3.1-2 (20020522)


How Reproducible:
just type:

gcc --version


Steps to Reproduce:
1. 
2. 
3. 

Actual Results:
gcc (GCC) 3.1 20020522 (Red Hat Linux Rawhide 3.1-2)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



Expected Results:
3.1

or

3.1.1

or

3.1 and then any string or info necessary


Additional Information:
I see that the version string is replaces by the RPM spec script on
purpose. It would be beneficial if the changed version string still
began with the GCC version number.

Comment 1 Jakub Jelinek 2002-05-28 13:34:58 UTC
Then the configure scripts simply need changing.
This is not something we add in our rpm (we just merely replace the content
in the () with more specific info). gcc 3.1 switched to --version output like:
gcc (GCC) 3.1.1 20020528 (prerelease)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

to match what other GNU programs do (try ls --version, bash --version, etc.).

See
2002-01-08  Joseph S. Myers  <jsm28.uk>

        * gcc.c (option_map): Remove --version.
        (process_command): Handle -fversion following the GNU Coding
        Standards.  Partially addresses PR other/704.

change.

Comment 2 darkeye 2002-05-28 13:41:31 UTC
Maybe for ls, bash, but not for gcc. The version string in the sources that
the source RPM contains is:

"3.1.1 20020522 (prerelease)"

(in files gcc/version.c, gcc/f/version.c), which begins with the version
number. This is changed to a string which is very differently formateed.

Also, the gcc sources downloadable from gcc.gnu.org contain merely
the version number, e.g. "3.1" in gcc/version.c.


Comment 3 Jakub Jelinek 2002-05-28 15:28:11 UTC
But the version_string in the source is not exactly what you get by running
gcc --version, see gcc.c:
          /* translate_options () has turned --version into -fversion.  */
          printf (_("%s (GCC) %s\n"), programname, version_string);
          fputs (_("Copyright (C) 2002 Free Software Foundation, Inc.\n"),
                 stdout);
          fputs (_("This is free software; see the source for copying conditions.  There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"),
                 stdout);
          exit (0);

Comment 4 darkeye 2002-05-28 16:01:14 UTC
Oh, I see. What way would you then suggest to tell the version number of gcc
by using a script? Is it deterministic so far as say the version number is
the 3rd word in the first line that is returned by "gcc --version"?
Are there any guidelines for the format of the returned string?

Comment 5 Jakub Jelinek 2002-05-28 17:01:07 UTC
Whatever works ;)
E.g. gcc --version | sed -n '1s/^[^ ]* (.*) //;s/ .*$//;1p'
might work, similarly you can parse gcc -v, etc.

Comment 6 darkeye 2002-05-29 05:23:55 UTC
Thanks!!
(It's too bad the GNU coding standard does not specify a parsable version
string format...)


Note You need to log in before you can comment on or make changes to this bug.