Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 720038 - media-libs/sdl-mixer fails to build with /bin/sh set to dash
Summary: media-libs/sdl-mixer fails to build with /bin/sh set to dash
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Games
Keywords: PullRequest
Depends on:
Blocks: nonbash
  Show dependency tree
Reported: 2020-04-29 19:26 UTC by Ilya Trukhanov
Modified: 2020-12-21 22:03 UTC (History)
3 users (show)

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

output of `emerge -pqv '=media-libs/sdl-mixer-1.2.12-r4::gentoo'` (emergepqv,186 bytes, text/plain)
2020-04-29 19:26 UTC, Ilya Trukhanov
complete build.log (build.log,8.44 KB, text/x-log)
2020-04-29 19:27 UTC, Ilya Trukhanov
complete build.log with CONFIG_SHELL=/bin/bash (build.log,47.86 KB, text/x-log)
2020-04-29 19:36 UTC, Ilya Trukhanov

Note You need to log in before you can comment on or make changes to this bug.
Description Ilya Trukhanov 2020-04-29 19:26:07 UTC
Created attachment 635226 [details]
output of `emerge -pqv '=media-libs/sdl-mixer-1.2.12-r4::gentoo'`

Portage 2.3.99 (python 3.7.7-final-0, default/linux/amd64/17.1/desktop, gcc-9.3.0, glibc-2.31-r2, 5.4.35-gentoo x86_64)
                         System Settings
System uname: Linux-5.4.35-gentoo-x86_64-AMD_Ryzen_7_1700_Eight-Core_Processor-with-gentoo-2.7
KiB Mem:    32875228 total,    340264 free
KiB Swap:    8358208 total,   8313876 free
Timestamp of repository gentoo: Tue, 28 Apr 2020 12:45:01 +0000
Head commit of repository gentoo: 83f5ebaecb1e0351c10f988589fe2858259e6a85
Timestamp of repository dotnet: Mon, 20 Apr 2020 14:35:11 +0000
Head commit of repository dotnet: d690cd146a69acd3028c190ed089ca186c9c5c0f

Timestamp of repository steam-overlay: Sun, 19 Apr 2020 17:12:53 +0000
Head commit of repository steam-overlay: d7eea0702c044d94af5b8de9f57c89313f9f05cc

Timestamp of repository vortex: Sun, 19 Apr 2020 17:12:55 +0000
Head commit of repository vortex: 67d57ce9d53d943dc29ad8c080274ca2eb889878

Timestamp of repository wine: Sat, 25 Apr 2020 21:41:53 +0000
Head commit of repository wine: 79f2c5f121b0010f1564ae656ab1c6a81b81b868

sh dash
ld GNU ld (Gentoo 2.34 p1) 2.34.0
ccache version 3.7.9 [disabled]
app-shells/bash:          5.0_p17::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.30.2::gentoo
dev-lang/python:          2.7.18::gentoo, 3.5.9::gentoo, 3.7.7-r2::gentoo
dev-util/ccache:          3.7.9::gentoo
dev-util/cmake:           3.17.1::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.18::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.2::gentoo
sys-devel/binutils:       2.34::gentoo
sys-devel/gcc:            9.3.0::gentoo
sys-devel/gcc-config:     2.2.1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.6::gentoo (virtual/os-headers)
sys-libs/glibc:           2.31-r2::gentoo

    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://
    priority: -1000
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes

    location: /var/db/repos/dotnet
    sync-type: git
    masters: gentoo

    location: /var/db/repos/localrepo
    masters: gentoo

    location: /var/db/repos/steam-overlay
    sync-type: git
    masters: gentoo

    location: /var/db/repos/vortex
    sync-type: git
    masters: gentoo

    location: /var/db/repos/wine
    sync-type: git
    masters: gentoo

    location: /usr/local/portage-crossdev
    masters: gentoo
    priority: 10

Installed sets: @ghidra, @work
ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-O2 -pipe -march=native"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=native"
FCFLAGS="-O2 -pipe -march=native"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms sign strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -march=native"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
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"
USE="X a52 aac acl acpi alsa amd64 berkdb branding bzip2 cairo caps cdda cdr cli crypt dbus discord-presence dri dts dvd dvdr elogind emboss encode exif flac fortran gdbm gif gles gpm gtk iconv icu ipv6 jpeg lcms ldap libnotify libtirpc mad mng mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds pulseaudio qt5 readline realtime sdl seccomp spell split-usr ssl staging startup-notification svg tcpd tiff truetype udev udisks unicode upower usb vaapi vdpau vorbis vulkan wxwidgets x264 xattr xcb xinerama xml xv xvid zlib zsh-completion" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" 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 wacom joystick" KERNEL="linux" L10N="en-US" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres12" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python3_7" QEMU_SOFTMMU_TARGETS="arm x86_64" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="amdgpu radeonsi radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Comment 1 Ilya Trukhanov 2020-04-29 19:27:28 UTC
Created attachment 635228 [details]
complete build.log
Comment 2 Ilya Trukhanov 2020-04-29 19:36:17 UTC
Created attachment 635242 [details]
complete build.log with CONFIG_SHELL=/bin/bash

I believe this is related to

When I set CONFIG_SHELL=/bin/bash through /etc/portage/env/ as suggested in the bug report, make gets further but eventually breaks with a bunch of libtool errors. Build log with CONFIG_SHELL=/bin/bash attached.

I think these are also related to /bin/sh being set to dash. I managed to get the package to build succesfully by adding the following function to the ebuild:

multilib_src_compile() {
        emake SHELL=${BASH}
Comment 3 Stefan Strogin gentoo-dev 2020-06-12 02:07:08 UTC
Ilya, have you tried to install it using dash-0.5.11? Looks like a bug in dash, which is fixed in 0.5.11. If so, I don't think it is a right thing to add this workaround here.
You may want to create a bug for stabilizing 0.5.11.
Comment 4 Ilya Trukhanov 2020-06-12 16:00:24 UTC
`equery l dash` returns `app-shells/dash-0.5.11:0`, build still fails with the same errors with `/bin/sh -> dash`.

Actually, I think I figured it out.

There's the following line in the `configure` output:
`checking whether the shell understands "+="...`

When building manually (not with portage), this check results in "no".
When building with portage, it results in "yes".

I checked portage's source code for the `econf` function, and I believe I located it in `bin/`. Looks like it checks if the `CONFIG_SHELL` variable is set, and replaces occurrences of "/bin/sh" with "#!$CONFIG_SHELL" in the `configure` file.

I then added `echo "CONFIG_SHELL is $CONFIG_SHELL"` to the beginning of the `multilib_src_configure` function in `sdl-mixer-1.2.12-r4.ebuild`. When building the package with portage, before the configure script runs I get "CONFIG_SHELL is /bin/bash".

So, it seems to me that portage for some reason sets `CONFIG_SHELL` to `/bin/bash`, then the `configure` script has its shebang (`#! /bin/sh) replaced with `#!/bin/bash`. The script then executes under bash, correctly infers that bash understands "+=" and outputs this operation in the resulting build scripts, which then get invoked with `/bin/sh` for some reason. Dash, not understanding "+=", explodes, taking the build down with it.

I don't think it's possible to send a patch upstream (the last release was in 2012) and I'm not even sure that this is an upstream issue since it looks like it's the portage's modification of the shebang that causes this. Maybe it's possible to get portage to not set `CONFIG_SHELL` somehow?

It'd be nice if we could get maybe someone from the portage team to look at this and figure out the best course of action.
Comment 5 kfm 2020-12-21 20:44:20 UTC
(In reply to Ilya Trukhanov from comment #4)

> I then added `echo "CONFIG_SHELL is $CONFIG_SHELL"` to the beginning of the
> `multilib_src_configure` function in `sdl-mixer-1.2.12-r4.ebuild`. When
> building the package with portage, before the configure script runs I get
> "CONFIG_SHELL is /bin/bash".

I can't reproduce this. Certainly, ebuild authors are able to define CONFIG_SHELL if they so choose, in which case does alter the shebang of the configure script in the manner that you describe. However, CONFIG_SHELL is not set by default, nor does the sdl-mixer ebuild define it.

Please remove any declarations of CONFIG_SHELL from your operating environment, be it by way of /etc/portage/env, /etc/portage/bashrc, your shell dotfiles or any other mechanism, then try building again with >=dash-0.5.11 as /bin/sh. There should not be an issue at this point in time.
Comment 6 kfm 2020-12-21 20:50:35 UTC
Also, please check whether any of the third-party repos (overlays) that you are using have eclass overrides in effect and whether they might be interfering with the default environment.
Comment 7 James Le Cuirot gentoo-dev 2020-12-21 22:03:21 UTC
This just isn't an issue any more because the affected version of dash has been removed. Closing.