Bug 682396

Summary: Some installs, such as that of ld in gcc, to non-default --installroot end up broken
Product: [Fedora] Fedora Reporter: sgovindachar
Component: yumAssignee: Seth Vidal <skvidal>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 14CC: ffesti, james.antill, maxamillion, pmatilai, tla
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-03-07 15:36:23 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 sgovindachar 2011-03-05 04:25:05 UTC
Description of problem:

Installing gcc to a non-default --installroot location results in a broken ld

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

Fedora-14-x86_64-Live-Desktop.iso 

[liveuser@localhost home]$ yum --version
3.2.28
  Installed: rpm-4.8.1-5.fc14.x86_64 at 2010-10-22 18:31
  Built    : Fedora Project at 2010-08-10 07:43
  Committed: Panu Matilainen <pmatilai> at 2010-08-10

  Installed: yum-3.2.28-5.fc14.noarch at 2010-10-22 18:31
  Built    : Fedora Project at 2010-10-05 13:03
  Committed: Seth Vidal <skvidal at fedoraproject.org> at 2010-10-05
[liveuser@localhost home]$ 
[liveuser@localhost home]$ uname -a
Linux localhost.localdomain 2.6.35.6-45.fc14.x86_64 #1 SMP Mon Oct 18 23:57:44 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux
[liveuser@localhost home]$ 

How reproducible:

See steps below.

Steps to Reproduce:

1.  Install gcc in a non-default location:  

  yum --installroot=/media/OS/home/26blahfc14/26blahfc14 -y -v install gcc

Actual results:

Observe that ld is broken because the softlinks are to _absolute_ paths!:

    $ cd /media/OS/home/26blahfc14
  
    $ find . -name ld | xargs ls -laF
  
    lrwxrwxrwx. 1 liveuser liveuser 38 Mar  4 16:30 ./etc/alternatives/ld -> /usr/bin/ld.bfd
    lrwxrwxrwx. 1 liveuser liveuser 48 Mar  4 16:30 ./usr/bin/ld -> /etc/alternatives/ld
    -rwxrwxrwx. 1 liveuser liveuser 57 Mar  4 16:30 ./var/lib/alternatives/ld*
  
    $ find . -name ld.bfd | xargs ls -laF
  
    -rwxrwxrwx. 1 liveuser liveuser 587984 Nov 15 05:43 ./usr/bin/ld.bfd*
  

Expected results:

Either (A) soft-links should be to _relative_ paths, or (B) the --installroot should be pre-fixed to the absolute paths.

To elaborate,

Either (A):

    $ cd /media/OS/home/26blahfc14
    $ pwd
    /media/OS/home/26blahfc14
    $ find . -name ld | xargs ls -laF
    lrwxrwxrwx. 1 liveuser liveuser 48 Mar  4 17:58 ./etc/alternatives/ld -> ../../usr/bin/ld.bfd*
    lrwxrwxrwx. 1 liveuser liveuser 58 Mar  4 17:57 ./usr/bin/ld -> ../../etc/alternatives/ld*
    -rwxrwxrwx. 1 liveuser liveuser 57 Mar  4 16:30 ./var/lib/alternatives/ld*
    $ find . -name ld.bfd | xargs ls -laF
    -rwxrwxrwx. 1 liveuser liveuser 587984 Nov 15 05:43 ./usr/bin/ld.bfd*
    $
 
Or (B): 

    $ cd /media/OS/home/26blahfc14
    $ pwd
    /media/OS/home/26blahfc14
    $ find . -name ld | xargs ls -laF
    lrwxrwxrwx. 1 liveuser liveuser 48 Mar  4 17:58 ./etc/alternatives/ld -> /media/OS/home/26blahfc14/usr/bin/ld.bfd*
    lrwxrwxrwx. 1 liveuser liveuser 58 Mar  4 17:57 ./usr/bin/ld -> /media/OS/home/26blahfc14/etc/alternatives/ld*
    -rwxrwxrwx. 1 liveuser liveuser 57 Mar  4 16:30 ./var/lib/alternatives/ld*
    $ find . -name ld.bfd | xargs ls -laF
    -rwxrwxrwx. 1 liveuser liveuser 587984 Nov 15 05:43 ./usr/bin/ld.bfd*
    $


Additional info:

Work-around is to delete installed soft-links, and to create soft-links as in (A) or (B) above.

Comment 1 James Antill 2011-03-07 13:48:13 UTC
Pretty sure this is not considered a bug, use "chroot /media/OS/home/26blahfc14/26blahfc14" to run commands within the install root.

If there is a Fedora policy against absolute symlinks, feel free to file it against GCC/ld.

Comment 2 sgovindachar 2011-03-07 15:12:27 UTC
chroot is for using a different root directory -- but in this case the tools are installed in a different location -- and the root directory continues to be /.  So it is bug in how yum installs in a different location (not under a different root directory).

Comment 3 James Antill 2011-03-07 15:36:23 UTC
I've tweaked the man page to make the function of --installroot clearer:

http://yum.baseurl.org/gitweb?p=yum.git;a=commitdiff;h=a6efb65474cb2b023e4e021de0fbafad847f472d