Bug 705116

Summary: --profile-use won't read GCDA files of non-owner
Product: Red Hat Enterprise Linux 5 Reporter: Steve Snyder <swsnyder>
Component: gcc44Assignee: Jakub Jelinek <jakub>
Status: CLOSED WONTFIX QA Contact: qe-baseos-tools-bugs
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.6   
Target Milestone: rc   
Target Release: ---   
Hardware: i386   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-17 09:39:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Steve Snyder 2011-05-16 17:24:31 UTC
Description of problem:

After doing a profiling run of an instrumented binary, a *.gcda file is generated.  When rebuilding with --profile-use gcc44 will say that a *.cgda file owned by another user (but with readable permissions) "does not exist" even though the file is readable.

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

gcc44-4.4.4-13.el5 (x86)

How reproducible:

Always

Steps to Reproduce:
1.  As User A use gcc44 to create *.gcda file
2.  As User B attempt to read *.gcda with gcc44's --profile-use
3.
  
Actual results:

gcc44 complains that a file that is clearly present and readable is "not found"

Expected results:

Given appropriate read permissions, *.gcda files should be readable by gcc44.

Additional info:


[steve@nemesis ~]$ vi /tmp/testapp.c
[steve@nemesis ~]$ gcc44 --profile-dir=/tmp --profile-generate -O2 -o /tmp/testapp /tmp/testapp.c
[steve@nemesis ~]$ /tmp/testapp
got here
[steve@nemesis ~]$ ll /tmp/testapp*
-rwxr-xr-x 1 steve users 15984 May 16 13:12 /tmp/testapp
-rw-r--r-- 1 steve users    98 May 16 13:12 /tmp/testapp.c
-rw-r--r-- 1 steve users   144 May 16 13:13 /tmp/testapp.gcda
[steve@nemesis ~]$ rm -f /tmp/testapp
[steve@nemesis ~]$ su - nancy

Password:
[nancy@nemesis ~]$ gcc44 --profile-dir=/tmp --profile-use -O2 -o /tmp/testapp /tmp/testapp.c
/tmp/testapp.c: In function âmainâ:
/tmp/testapp.c:8: note: file /tmp/testapp.gcda not found, execution counts estimated
[nancy@nemesis ~]$ file /tmp/testapp.gcda
/tmp/testapp.gcda: data

[nancy@nemesis ~]$ rm -f /tmp/testapp
[nancy@nemesis ~]$ exit
[steve@nemesis ~]$ gcc44 --profile-dir=/tmp --profile-use -O2 -o /tmp/testapp /tmp/testapp.c
[steve@nemesis ~]$ ll /tmp/testapp*
-rwxr-xr-x 1 steve users 4951 May 16 13:18 /tmp/testapp
-rw-r--r-- 1 steve users   98 May 16 13:12 /tmp/testapp.c
-rw-r--r-- 1 steve users  144 May 16 13:13 /tmp/testapp.gcda

Comment 1 Jakub Jelinek 2011-05-17 09:39:09 UTC
This is something that has been changed in gcc 4.5:
http://gcc.gnu.org/ml/gcc-patches/2009-09/msg01170.html
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152419
In older gccs it used to open them always in write mode.
I don't think this is severe enough for it to be backported.