Bug 834425

Summary: GPRbuild fails to find GCC in some locales.
Product: [Fedora] Fedora Reporter: Julian Leyh <julian>
Component: gprbuildAssignee: Pavel Zhukov <pavel>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 19CC: bjorn, pzhukov, tero.koskinen
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-11 22:22:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
attached patch for gprbuild.spec
none
remove rpath
none
fix version parsing for non-English locales
none
Git patch for the f19 branch
none
Git patch for the master branch
none
Git patch for the f19 branch
none
Git patch for the master branch none

Description Julian Leyh 2012-06-21 20:35:31 UTC
Created attachment 593584 [details]
attached patch for gprbuild.spec

Description of problem:

gprbuild creates configurations using rpath for the linker.
Additionally, it is broken for non-English locales, since it parses "gcc -v" output and not "gcc -dumpversion".

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

2011-3

How reproducible:

rpath: look into generated cgpr
locale: LC_ALL=de_DE.UTF-8 gprversion

Steps to Reproduce:
1. run gprbuild on some project
2. grep rpath obj/auto.cgpr
3. run LC_ALL=de_DE.UTF-8 gprversion
  
Actual results:

step 2:
   for Run_Path_Option  use ("-Wl,-z,origin,-rpath,");
step 3:
Invalid setup of the gprconfig knowledge base
Exit code: 4

Expected results:

no rpath, working with different locales

Additional info:

Comment 1 Julian Leyh 2012-06-21 20:36:08 UTC
Created attachment 593585 [details]
remove rpath

Comment 2 Julian Leyh 2012-06-21 20:36:36 UTC
Created attachment 593586 [details]
fix version parsing for non-English locales

Comment 3 Pavel Zhukov (IBM) 2012-06-22 06:12:40 UTC
Thank you for your bug report. 
Probably I've lost gprbuild-gccversion.patch while updating to 2011. Besides, I've sent this patch to AdaCore already.

Comment 4 Fedora Update System 2012-06-24 18:57:59 UTC
gprbuild-2011-4.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/gprbuild-2011-4.fc17

Comment 5 Björn Persson 2012-06-24 22:20:45 UTC
(In reply to comment #1)
> Created attachment 593585 [details]
> remove rpath

What does this patch do? Does it completely disable GPRbuild's ability to embed runpaths in binaries, even when it's not a Fedora package being built? Does it do a better job than the -R option?

Comment 6 Pavel Zhukov (IBM) 2012-06-25 06:21:47 UTC
I prefer use -R or chrpath. 
So I'm going to testing gprbuild-2011-4 with other packages and accept or delete patch.

Comment 7 Fedora Update System 2012-06-26 00:48:24 UTC
Package gprbuild-2011-4.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing gprbuild-2011-4.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-9890/gprbuild-2011-4.fc17
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2012-08-09 23:24:56 UTC
gprbuild-2011-4.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Björn Persson 2013-12-03 16:50:13 UTC
The problem with getting the GCC version still exists in GPRbuild 2012 and 2013. In at least the locales fi_FI.UTF-8 and de_DE.UTF-8 it fails to find GCC and claims that "libraries are not supported on this platform".

Please restore the gccversion patch.

Comment 10 Björn Persson 2013-12-03 16:52:04 UTC
Created attachment 832212 [details]
Git patch for the f19 branch

Comment 11 Björn Persson 2013-12-03 16:52:35 UTC
Created attachment 832213 [details]
Git patch for the master branch

Comment 12 Björn Persson 2013-12-03 17:02:24 UTC
Created attachment 832214 [details]
Git patch for the f19 branch

Comment 13 Björn Persson 2013-12-03 17:04:10 UTC
Created attachment 832215 [details]
Git patch for the master branch

I mixed up the patches. Now they're labelled correctly. Sorry.

Comment 14 Pavel Zhukov 2013-12-03 20:19:17 UTC
Bjorn, 
Thank you for the patch. 

for me it looks like a bug in gcc localization, not in gprbuild. Unfortunately I'm not familiar with German and Finish languages but gcc-Version and gcc-versio doesn't look as translation of "gcc version"... 

The original regexp filters all non-gcc compilers out which "could" use gcc alias for compatibility for example but -dumpversion doesn't contain any compiler name string at all. Are some raises possible here? Is something like "^gcc[^\s]\S+ (\S+)" could be less dangerous here?

Comment 15 Björn Persson 2013-12-04 10:32:55 UTC
German is famous for its compound words but it can't match Finnish. In English "gcc version 4.8.2" can be read either as "This is GCC. Specifically, it's version 4.8.2." or as "The GCC version is 4.8.2.". In the latter case "gcc version" is a compound and the only problem with the German translation is that it doesn't spell "GCC" with capitals. The Swedish translator seems to have chosen the first interpretation. Otherwise I would have had this problem too.

Vietnamese (vi_VN) appears to express "version" in two words:
"gcc phiên bản 4.8.2 20131017 (Red Hat 4.8.2-1) (GCC)"
The current pattern will select "bản" as the version.

Parsing text that's intended for human consumption is inherently unreliable, and trying to do it with localized text is just crazy. If gcc -v is a stable API, then the documentation should tell how its output can be parsed reliably. Otherwise, if -dumpversion isn't acceptable, then the only way this can become anywhere near reliable is to have GPRbuild set the locale to "C" in the subprocess.