Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 445336 - sys-apps/portage: prepstrip fails in parallel with splitdebug (sys-libs/glibc: ln: failed to create hard link '.../image/usr/lib/debug/usr/lib64/libieee.a.debug': File exists)
Summary: sys-apps/portage: prepstrip fails in parallel with splitdebug (sys-libs/glibc...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS, REGRESSION
: 446976 455754 (view as bug list)
Depends on:
Blocks: 445274
  Show dependency tree
 
Reported: 2012-11-30 13:03 UTC by MaratIK
Modified: 2013-03-06 18:53 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log.7z (build.log.7z,336.34 KB, application/x-7z-compressed)
2012-11-30 13:03 UTC, MaratIK
Details
environment (environment,138.31 KB, text/plain)
2012-11-30 13:04 UTC, MaratIK
Details
emerge -pqv '=sys-libs/glibc-2.15-r3' (pqv.log,109 bytes, text/plain)
2012-11-30 13:04 UTC, MaratIK
Details
emerge --info '=sys-libs/glibc-2.15-r3' (info.log,11.97 KB, text/plain)
2012-11-30 13:05 UTC, MaratIK
Details
use sort -u to avoid duplicates (prepstrip-avoid-duplicates-for-bug-445336.patch,869 bytes, patch)
2012-12-01 03:59 UTC, Zac Medico
Details | Diff
use sort -u to avoid duplicates (prepstrip-avoid-duplicates-for-bug-445336.patch,1.03 KB, patch)
2012-12-01 21:22 UTC, Zac Medico
Details | Diff
build.log.xz (build.log.xz,291.83 KB, text/plain)
2013-03-06 17:19 UTC, Andrew Savchenko
Details
environment (environment,140.82 KB, text/plain)
2013-03-06 17:20 UTC, Andrew Savchenko
Details
emerge --info (emerge.info,7.81 KB, text/plain)
2013-03-06 17:20 UTC, Andrew Savchenko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description MaratIK 2012-11-30 13:03:49 UTC
Created attachment 331040 [details]
build.log.7z

emerge -1 '=sys-libs/glibc-2.15-r3' failed (install phase) during strip binaries:

ln: failed to create hard link ‘/var/tmp/portage/sys-libs/glibc-2.15-r3/image/usr/lib/debug/usr/lib64/libieee.a.debug’: File exists
 * ERROR: sys-libs/glibc-2.15-r3 failed (install phase):
 *   ln failed unexpectedly

Seems to me that bug introduced via flag FEATURES="splitdebug".
Comment 1 MaratIK 2012-11-30 13:04:18 UTC
Created attachment 331042 [details]
environment
Comment 2 MaratIK 2012-11-30 13:04:48 UTC
Created attachment 331044 [details]
emerge -pqv '=sys-libs/glibc-2.15-r3'
Comment 3 MaratIK 2012-11-30 13:05:12 UTC
Created attachment 331046 [details]
emerge --info '=sys-libs/glibc-2.15-r3'
Comment 4 SpanKY gentoo-dev 2012-11-30 21:45:39 UTC
in the future, please don't use .7z for compression/archiving.  use tar+{gz or bz2 or xz}.

error is coming from the strip code in portage.  did it fail when using 2.2.0_alpha142 ?
Comment 5 MaratIK 2012-11-30 23:16:22 UTC
using 2.2.0_alpha142 glibc installs with warning:
ln complains that var/tmp/portage/sys-libs/glibc-2.15-r3/image/usr/lib/debug/usr/lib64/libieee.a.debug and other *.a.debug files exist and he cannot create hardlink. But it is just warning, no errors as in the case 2.2.0_alpha143
Comment 6 Zac Medico gentoo-dev 2012-11-30 23:28:23 UTC
It looks like both scanelf and find are outputting the *.a files in prepstrip here:

while read -r x ; do
	inode_link=$(get_inode_number "${x}") || die "stat failed unexpectedly"
	echo "${x}" >> "${inode_link}" || die "echo failed unexpectedly"
done < <(
	scanelf -yqRBF '#k%F' -k '.symtab' "$@"
	find "$@" -type f ! -type l -name '*.a'
)

@vapier and solar:

Can we safely remove the find command here, or will scanelf omit *.a files in some cases (maybe dependent on scanelf version)?
Comment 7 Zac Medico gentoo-dev 2012-12-01 03:39:35 UTC
Use sort -u to eliminate any duplicates:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=bba20c632e79426cd006dd2b732fcaed079ac43a

I haven't tried to reproduce this bug, so please test. The patch applies to /usr/lib/portage/bin/ebuild-helpers/prepstrip.
Comment 8 Zac Medico gentoo-dev 2012-12-01 03:59:31 UTC
Created attachment 331112 [details, diff]
use sort -u to avoid duplicates
Comment 9 MaratIK 2012-12-01 10:20:33 UTC
After patching 1 error for 1 file:

ln: failed to create hard link ‘/var/tmp/portage/sys-libs/glibc-2.15-r3/image/usr/lib/debug/usr/lib32/libieee.a.debug’: File exists

ln: failed to create hard link ‘/var/tmp/portage/sys-libs/glibc-2.15-r3/image/usr/lib/debug/usr/lib32/libmcheck.a.debug’: File exists

ln: failed to create hard link ‘/var/tmp/portage/sys-libs/glibc-2.15-r3/image/usr/lib/debug/usr/lib32/libc_stubs.a.debug’: File exists

ln: failed to create hard link ‘/var/tmp/portage/sys-libs/glibc-2.15-r3/image/usr/lib/debug/usr/lib64/libieee.a.debug’: File exists

ln: failed to create hard link ‘/var/tmp/portage/sys-libs/glibc-2.15-r3/image/usr/lib/debug/usr/lib64/libmcheck.a.debug’: File exists

ln: failed to create hard link ‘/var/tmp/portage/sys-libs/glibc-2.15-r3/image/usr/lib/debug/usr/lib64/libc_stubs.a.debug’: File exists
Comment 10 SpanKY gentoo-dev 2012-12-01 18:16:06 UTC
(In reply to comment #6)

hmm, those files are ELFs, they're just given .a suffixes (presumably so they can get linked against)

might have to `grep -v '[.]a$'` the output from scanelf ...

$ file /usr/lib/*.a
/usr/lib/libanl.a:               current ar archive
/usr/lib/libBrokenLocale.a:      current ar archive
/usr/lib/libbsd-compat.a:        current ar archive
/usr/lib/libc.a:                 current ar archive
/usr/lib/libc_nonshared.a:       current ar archive
/usr/lib/libcrypt.a:             current ar archive
/usr/lib/libc_stubs.a:           ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
/usr/lib/libdl.a:                current ar archive
/usr/lib/libg.a:                 current ar archive
/usr/lib/libieee.a:              ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
/usr/lib/libm.a:                 current ar archive
/usr/lib/libmcheck.a:            ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
/usr/lib/libnsl.a:               current ar archive
/usr/lib/libpthread.a:           current ar archive
/usr/lib/libpthread_nonshared.a: current ar archive
/usr/lib/libresolv.a:            current ar archive
/usr/lib/librpcsvc.a:            current ar archive
/usr/lib/librt.a:                current ar archive
/usr/lib/libutil.a:              current ar archive
Comment 11 Zac Medico gentoo-dev 2012-12-01 21:22:48 UTC
Created attachment 331158 [details, diff]
use sort -u to avoid duplicates

(In reply to comment #9)
> After patching 1 error for 1 file:
> 
> ln: failed to create hard link
> ‘/var/tmp/portage/sys-libs/glibc-2.15-r3/image/usr/lib/debug/usr/lib32/
> libieee.a.debug’: File exists

The sort call was not in the right place. I've tested this new patch and it works correctly now:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f930e2fafd14705e548637330cfc2d848c102cfa
Comment 12 SpanKY gentoo-dev 2012-12-01 21:38:37 UTC
(In reply to comment #11)

i think this is the way to go rather than changing scanelf.  the tool knows nothing of file names, just file formats.

you should put a comment in there though explaining why there is a sort, or at least mention this bug #
Comment 13 Zac Medico gentoo-dev 2012-12-01 21:42:52 UTC
Okay, I've added a comment referencing this bug:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d86595e92193fd6b2b76365d01a13147c21bf75f
Comment 14 Zac Medico gentoo-dev 2012-12-01 22:04:44 UTC
This is fixed in 2.1.11.33 and 2.2.0_alpha144.
Comment 15 Jeroen Roovers (RETIRED) gentoo-dev 2012-12-12 15:10:32 UTC
*** Bug 446976 has been marked as a duplicate of this bug. ***
Comment 16 SpanKY gentoo-dev 2013-02-08 05:49:24 UTC
*** Bug 455754 has been marked as a duplicate of this bug. ***
Comment 17 Andrew Savchenko gentoo-dev 2013-03-06 17:19:41 UTC
Created attachment 341126 [details]
build.log.xz

Hello,

I hit this bug while upgrading to glibc-2.16.0 with FEATURES=splitdebug (required by valgrind), though I use the latest portage-2.2.0_alpha166.
Comment 18 Andrew Savchenko gentoo-dev 2013-03-06 17:20:04 UTC
Created attachment 341128 [details]
environment
Comment 19 Andrew Savchenko gentoo-dev 2013-03-06 17:20:14 UTC
Created attachment 341130 [details]
emerge --info
Comment 20 Andrew Savchenko gentoo-dev 2013-03-06 17:32:46 UTC
Strange thing, I updated pax-utils from 0.3.0 to 0.6 and this fixed my issue.
Please add some version dep on pax-utils.
Comment 21 Andrew Savchenko gentoo-dev 2013-03-06 17:33:49 UTC
(I updated pax-utils because it is where scanelf belongs to).
Comment 22 Zac Medico gentoo-dev 2013-03-06 18:53:02 UTC
(In reply to comment #20)
> Strange thing, I updated pax-utils from 0.3.0 to 0.6 and this fixed my issue.
> Please add some version dep on pax-utils.

Regardless if pax-utils version, if you still experience an issue like this with latest portage, then it's a portage bug because portage should be using locks to prevent any possibility interference.