Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 843209 - sys-libs/libxcrypt-4.4.28 installs files to bogus location on prefix
Summary: sys-libs/libxcrypt-4.4.28 installs files to bogus location on prefix
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2022-05-07 21:25 UTC by Nick Bowler
Modified: 2022-05-24 02:20 UTC (History)
2 users (show)

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


Attachments
prefix.patch (file_843209.txt,1.10 KB, patch)
2022-05-07 21:35 UTC, Sam James
Details | Diff
prefix.patch (file_843209.txt,2.26 KB, patch)
2022-05-07 23:00 UTC, Sam James
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Bowler 2022-05-07 21:25:59 UTC
libxcrypt-4.4.28 installs "successfully" on prefix but some symlinks
are created in bogus locations.

For example, with EPREFIX=/home/nbowler/prefix-glibc, the following
files are created:

  /home/nbowler/prefix-glibc/usr/home/nbowler/prefix-glibc/lib64/libowcrypt.so
  /home/nbowler/prefix-glibc/usr/home/nbowler/prefix-glibc/lib64/libcrypt.so

As these files are needed to link against the library and will not be
found by the linker (also, the symlinks are broken relative symlinks),
any package which depends on these libraries will fail to build.

In particular, bootstrap-prefix.sh installs this damaged libxcrypt-4.4.28
and then subsequently fails to build python in stage3.

This is a regression caused by commit aabea35bb6fd ("sys-libs/libxcrypt:
add cross-* build support"), which added $EPREFIX to the output of the
get_xclibdir function.

Since the symlinks are created with the following command:

  dosym "../../$(get_libdir)/${lib_file_target}" "/usr/$(get_xclibdir)/${lib_file_basename}"

the files are installed into /usr/$EPREFIX/... which is obviously bogus.
The prior version of the 4.4.28 ebuild installs correctly, as does
version 4.4.27 which did not receive this change.  Since the 4.4.28 ebuild
revision was not changed existing installations may not be broken but will
become broken if libxcrypt-4.4.28 is reinstalled for whatever reason.

Portage 3.0.30.1_prefix (python 3.9.6-final-0, default/linux/arm64/17.0/prefix/kernel-3.2+, gcc-10.3.1, unavailable, 5.11.15-dirty aarch64)
=================================================================
System uname: Linux-5.11.15-dirty-aarch64-with-glibc2.34
KiB Mem:     4035240 total,   2743148 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Fri, 06 May 2022 00:45:01 +0000
Head commit of repository gentoo: 65a83249fd4006438de3cce006d0141b2be09892
sh bash 5.1_p16
ld GNU ld (Gentoo 2.38 p4) 2.38
app-misc/pax-utils:        1.3.4::gentoo
app-shells/bash:           5.1_p16::gentoo
dev-lang/perl:             5.34.1-r3::gentoo
sys-apps/baselayout:       2.8::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-devel/autoconf:        2.71-r1::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.38-r2::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/gcc:             10.3.1_p20211126::gentoo
sys-devel/gcc-config:      2.5-r1::gentoo
sys-devel/libtool:         2.4.7::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.17-r1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.35-r4::gentoo
Repositories:

gentoo
    location: /home/nbowler/prefix-glibc/var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.prefix.bitzolder.nl/gentoo-portage-prefix
    priority: -1000
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: yes

ACCEPT_KEYWORDS="arm64 ~arm64 ~arm64-linux"
ACCEPT_LICENSE="@FREE"
CBUILD="aarch64-unknown-linux-gnu"
CFLAGS="-O2 -O2 -pipe"
CHOST="aarch64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo /home/nbowler/prefix-glibc/etc/gentoo-release"
CONFIG_SHELL="/home/nbowler/prefix-glibc/bin/bash"
CXXFLAGS="-O2 -O2 -pipe"
DISTDIR="/home/nbowler/prefix-glibc/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
EXTRA_ECONF="LDFLAGS=-IBS=-lcrypt"
FCFLAGS="-O2"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles force-prefix ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sfperms strict unknown-features-warn unmerge-logs unmerge-orphans unprivileged"
FFLAGS="-O2"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="C.UTF8"
LDFLAGS="-lcrypt"
MAKEOPTS="-j1"
PKGDIR="/home/nbowler/prefix-glibc/tmp/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/home/nbowler/prefix-glibc/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/home/nbowler/prefix-glibc/tmp/var/tmp"
SHELL="/bin/bash"
USE="acl arm64 bzip2 cli crypt dri fortran gdbm iconv ipv6 libglvnd libtirpc ncurses nls nptl openmp pcre prefix readline seccomp split-usr ssl unicode zlib" ADA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_ARM="edsp thumb thumb2 v4 v5 v6 v7 v8 vfp vfp-d32 vfpv3 vfpv4" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" RUBY_TARGETS="ruby26 ruby27" USERLAND="GNU" VIDEO_CARDS="fbdev dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-05-07 21:35:12 UTC
Created attachment 777329 [details, diff]
prefix.patch

Is this patch sufficient?

It would also help me to see some ls -al ... output of the wrong files and broken symlinks as it's easier to then grasp without reproducing (I can't currently bootstrap a prefix because of some gcc issue).
Comment 2 Nick Bowler 2022-05-07 22:04:44 UTC
D(In reply to Sam James from comment #1)
> Created attachment 777329 [details, diff] [details, diff]
> prefix.patch
> 
> Is this patch sufficient?

It doesn't change the installed location of the symlink (2nd argument to
dosym) so I'm guessing no.

I've since resumed the bootstrap process after installing a non-broken
libxcrypt so I can't just test patches right now until it finishes.

> It would also help me to see some ls -al ... output of the wrong files and
> broken symlinks as it's easier to then grasp without reproducing (I can't
> currently bootstrap a prefix because of some gcc issue).

The problem is not really the symlink target, the relative symlink would be
valid and correct if the files were actually installed into the correct
destination directory.

The problem is the "/usr/$(get_xclibdir)/${lib_file_basename}" part.

From the ebuild:

  get_xclibdir() {
  	printf -- "%s/%s/%s/%s\n" \
  		"$(get_xcprefix)" \
  		"$(usex split-usr '' '/usr')" \
  		"$(get_libdir)" \
  		"$(usex system '' 'xcrypt')"
  }

Since we are not cross compiling, get_xcprefix simply outputs $EPREFIX;
system and split-usr flags are forced in the profile, so this outputs
"$EPREFIX/lib64", and the destination that is actually passed to dosym
is "/usr/$EPREFIX/lib64".

The expected destination is just "/usr/lib64" (install commands like
dosym are implicitly relative to $ED which is "$D/$EPREFIX").
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-05-07 23:00:21 UTC Comment hidden (obsolete)
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-05-07 23:00:46 UTC
Created attachment 777335 [details, diff]
prefix.patch

Yep, I was just finding it hard to play with it blind. I get the idea, it's just easier to see it (the reason I said about dosym8 -r is b/c it resolves up to EPREFIX, but yes, the /usr is still a problem).
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-05-07 23:01:07 UTC
(In reply to Sam James from comment #4)
> Created attachment 777335 [details, diff] [details, diff]
> prefix.patch
> 
> Yep, I was just finding it hard to play with it blind. I get the idea, it's
> just easier to see it (the reason I said about dosym8 -r is b/c it resolves
> up to EPREFIX, but yes, the /usr is still a problem).

... which works for me on prefix + non-prefix and split-usr + non-split-usr (only tested non-split-usr on non-prefix).
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-05-10 02:23:44 UTC
Unless you have any objections, given this worked for me, I'll commit it in the next day or so.
Comment 7 Nick Bowler 2022-05-11 07:30:36 UTC
(In reply to Sam James from comment #6)
> Unless you have any objections, given this worked for me, I'll commit it in
> the next day or so.

The 2nd patch is whitespace damaged so it does not apply cleanly, but fixing it up manually and the symlinks appear to be installed OK now.
Comment 8 Larry the Git Cow gentoo-dev 2022-05-24 02:16:16 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=939a3db71064f9b1da8e6a6fca3ecfb386f2ec30

commit 939a3db71064f9b1da8e6a6fca3ecfb386f2ec30
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-05-08 04:07:10 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-05-24 02:16:03 +0000

    sys-libs/libxcrypt: fix prefix install
    
    Bug: https://bugs.gentoo.org/802222
    Closes: https://bugs.gentoo.org/843209
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-libs/libxcrypt/libxcrypt-4.4.28-r1.ebuild | 298 ++++++++++++++++++++++++++
 1 file changed, 298 insertions(+)
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-05-24 02:20:18 UTC
Added a safety in pkg_preinst too given I don't really like the messy src_install logic.