Bug 65598 - gcc 3.1 reports ugly version string
gcc 3.1 reports ugly version string
Status: CLOSED NOTABUG
Product: Red Hat Raw Hide
Classification: Retired
Component: gcc (Show other bugs)
1.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-05-28 09:24 EDT by darkeye
Modified: 2008-05-01 11:38 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-05-28 09:26:15 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description darkeye 2002-05-28 09:24:51 EDT
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 09:34:58 EDT
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@cam.ac.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 09:41:31 EDT
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 11:28:11 EDT
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 12:01:14 EDT
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 13:01:07 EDT
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 01:23:55 EDT
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.