Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 905934 - app-admin/eselect-1.4.20 Crashes with error: bad interpreter: No such file or directory
Summary: app-admin/eselect-1.4.20 Crashes with error: bad interpreter: No such file or...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: eselect (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo eselect Team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2023-05-08 11:33 UTC by Esteve Varela Colominas
Modified: 2023-06-06 18:54 UTC (History)
0 users

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


Attachments
runtime log (log.txt,141 bytes, text/plain)
2023-05-10 08:54 UTC, Esteve Varela Colominas
Details
build log (build.log,16.30 KB, text/plain)
2023-05-10 09:12 UTC, Esteve Varela Colominas
Details
Patch for configure.ac (eselect.diff,1.65 KB, patch)
2023-05-10 11:16 UTC, Ulrich Müller
Details | Diff
Patch v2 (eselect.diff,2.13 KB, patch)
2023-05-11 17:09 UTC, Ulrich Müller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Esteve Varela Colominas 2023-05-08 11:33:32 UTC
Currently, the configure script autodetects the location of BASH, to set the shebang line of eselect.in.

My situation is one where I'm building into a new ROOT/EPREFIX combination. Due to the change in EPREFIX, the wrong path is used by the script once eselect is installed. Further complicating matters, the target system doesn't have any bash installed at all :)

I'm not sure what to suggest in regards to fixing this. Maybe the shebang line should be fixed in the ebuild, maybe the ebuild should set the $BASH variable, or maybe "#!/usr/bin/env bash" should be used instead, or the $prefix (configure's --prefix option) path should be used in combination with a hardcoded /bin/bash. I really don't know in this case...
Comment 1 Ulrich Müller gentoo-dev 2023-05-10 07:35:16 UTC
Please attach build.log and emerge --info output.
Comment 2 Esteve Varela Colominas 2023-05-10 07:39:36 UTC
This isn't a build-time failure, it's a runtime issue due to the shebang of the script being set wrong.
Comment 4 Esteve Varela Colominas 2023-05-10 08:53:39 UTC
>How is the program run (on the console, in a terminal, as a daemon, in what runlevel etc.)

"eselect"

>Any error output

$ eselect
bash: /data/data/com.termux/files/gentoo/usr/bin/eselect: /home/mid-kid/.gentoo-current/bin/bash: bad interpreter: No such file or directory

>What makes the program crash, behave wrong, not start

the shebang

>Is there a workaround?

Refer to the first message.

>What was the last working version of the package, if any?

none

>What changed to make it not work?

nothing
Comment 5 Esteve Varela Colominas 2023-05-10 08:54:47 UTC
Created attachment 861422 [details]
runtime log
Comment 6 Esteve Varela Colominas 2023-05-10 08:55:19 UTC
$ emerge --info eselect
setlocale: unsupported locale setting
setlocale: unsupported locale setting
Portage 3.0.44 (python 3.11.3-final-0, default/linux/arm64/17.0/prefix/kernel-3.2+, gcc-12, glibc-2.36-r7, 4.9.337-perf-g153a7273b25b aarch64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.9.337-perf-g153a7273b25b-aarch64-with-glibc2.36
KiB Mem:     5766524 total,    134868 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Tue, 09 May 2023 00:45:01 +0000
Head commit of repository gentoo: 69d6ba14a7cb096757e96c16afcb7d48b9f2fbe0
sh bash 5.1_p16-r2
ld GNU ld (Gentoo 2.39 p6) 2.39.0
app-misc/pax-utils:        1.3.5::gentoo
app-shells/bash:           5.1_p16-r2::gentoo
dev-lang/python:           3.11.3::gentoo
sys-apps/baselayout:       2.13-r1::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-devel/binutils:        2.39-r5::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/gcc:             12.2.1_p20230428-r1::gentoo
sys-devel/gcc-config:      2.10::gentoo
sys-devel/make:            4.4.1::gentoo
sys-kernel/linux-headers:  6.1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.36-r7::gentoo
Repositories:

gentoo
    location: /data/data/com.termux/files/gentoo/var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: True
    sync-rsync-extra-opts: 
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-metamanifest: no
    sync-rsync-verify-jobs: 1

ACCEPT_KEYWORDS="arm64"
ACCEPT_LICENSE="@FREE"
CBUILD="aarch64-unknown-linux-gnu"
CFLAGS="-O2"
CHOST="aarch64-unknown-linux-gnu"
CONFIG_PROTECT="/data/data/com.termux/files/gentoo/etc /etc"
CONFIG_PROTECT_MASK="/data/data/com.termux/files/gentoo/etc/env.d /etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2"
DISTDIR="/data/data/com.termux/files/gentoo/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE 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 XDG_STATE_HOME"
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="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PKGDIR="/data/data/com.termux/files/gentoo/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/data/data/com.termux/files/gentoo/"
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="/data/data/com.termux/files/gentoo/var/tmp"
SHELL="/data/data/com.termux/files/usr/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 test-rust unicode zlib" ADA_TARGET="gnat_2021" 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_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby30" 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, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, MAKEOPTS, 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

=================================================================
                        Package Settings
=================================================================

app-admin/eselect-1.4.20::gentoo was built with the following:
USE="(prefix) -doc -emacs -vim-syntax"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg 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"
Comment 7 Ulrich Müller gentoo-dev 2023-05-10 08:58:53 UTC
Please attach the build.log too. (It will tell what exactly happened during configure time.)
Comment 8 Esteve Varela Colominas 2023-05-10 09:07:27 UTC
What happened is that the configure script walked the $PATH variable on the host to find bash, using AC_PATH_PROGS: https://gitweb.gentoo.org/proj/eselect.git/tree/configure.ac#n15 , which it then used to replace the shebang line on bin/eselect.in during build: https://gitweb.gentoo.org/proj/eselect.git/tree/bin/Makefile.am#n4
Comment 9 Esteve Varela Colominas 2023-05-10 09:12:39 UTC
Created attachment 861423 [details]
build log
Comment 10 Esteve Varela Colominas 2023-05-10 09:13:35 UTC
For what it's worth, it also got the wrong path for env-update.
Comment 11 Ulrich Müller gentoo-dev 2023-05-10 11:16:27 UTC
Created attachment 861424 [details, diff]
Patch for configure.ac

Could you test attached patch? (Make sure to run eautoreconf.)
Comment 12 Esteve Varela Colominas 2023-05-10 13:08:48 UTC
This doesn't work, I added a few prints around the script, to see that it now checks for the files in the following order:
- /data/data/com.termux/files/gentoo/bin/bash
- /data/data/com.termux/files/gentoo/usr/bin/bash
- /bin/bash

My current path-related settings are:
EPREFIX=/data/data/com.termux/files/gentoo
BROOT=/home/mid-kid/.gentoo-current
ROOT=/home/mid-kid/Stuff/Workspace/termux/sysroot

Since I'm installing into a new ROOT, and DESTDIR isn't passed to the build system until "make install" is invoked, I don't think there's a way to autodetect the location of bash from the buildsystem itself. It needs to be either hardcoded or passed by the ebuild.
Comment 13 Esteve Varela Colominas 2023-05-10 13:09:08 UTC
Forgot to thank you for the patch :)
Comment 14 Ulrich Müller gentoo-dev 2023-05-10 18:21:18 UTC
I wonder if we should simply use a fixed path ${EPREFIX}/bin/bash, instead of trying to determine it at configure time.

Same for ${EPREFIX}/usr/sbin/env-update.
Comment 15 Esteve Varela Colominas 2023-05-11 12:13:28 UTC
Currently I'm hardcoding it in the ebuild through the ac_cv_path_BASH/ENV_UPDATE variables. That seems like a decent solution, or alternatively, using a /usr/bin/env shebang. Hardcoding it in eselect itself wouldn't be the worst thing, given it's only made for gentoo anyway, but I feel like most programs and ebuild will rely on the former anyway.
Comment 16 Ulrich Müller gentoo-dev 2023-05-11 17:09:23 UTC
Created attachment 861530 [details, diff]
Patch v2

Please test if attached patch fixes the problem for you.
Comment 17 Esteve Varela Colominas 2023-05-12 16:39:47 UTC
Sorry for the wait, but this one worked perfectly!
Comment 18 Larry the Git Cow gentoo-dev 2023-05-12 16:44:23 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/eselect.git/commit/?id=ad863d288f29bcca776369dec7765dbb0174ba82

commit ad863d288f29bcca776369dec7765dbb0174ba82
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2023-05-11 17:04:20 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2023-05-11 17:04:20 +0000

    Don't autodetect bash and env-update at configure time
    
    * bin/eselect.in: Update shebang to use EPREFIX. Bug 905934.
    * bin/Makefile.am (dosed): Don't substitute BASH.
    * libs/package-manager.bash.in (env_update): Don't use an absolute
    path for env-update.
    * libs/Makefile.am (dosed): Don't substitute ENV_UPDATE.
    * configure.ac: Drop checks for bash and env-update paths.
    
    Bug: https://bugs.gentoo.org/905934
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 ChangeLog                    |  7 +++++++
 bin/Makefile.am              |  3 +--
 bin/eselect.in               |  2 +-
 configure.ac                 | 12 ------------
 libs/Makefile.am             |  1 -
 libs/package-manager.bash.in |  4 ++--
 6 files changed, 11 insertions(+), 18 deletions(-)
Comment 19 Ulrich Müller gentoo-dev 2023-05-12 16:48:31 UTC
Let's give this some time for testing in the live (9999) version.

I'll make a new release in two or three weeks. (Feel free to ping me if I forget.)
Comment 20 Larry the Git Cow gentoo-dev 2023-06-06 18:54:54 UTC
The bug has been closed via the following commit(s):

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

commit a7c3c82dab37b4ebaee8fc9f110aa86264a15b4a
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2023-06-06 18:51:58 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2023-06-06 18:54:47 +0000

    app-admin/eselect: add 1.4.23
    
    Closes: https://bugs.gentoo.org/905934
    Closes: https://bugs.gentoo.org/907844
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 app-admin/eselect/Manifest              |  1 +
 app-admin/eselect/eselect-1.4.23.ebuild | 58 +++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)