Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 750563 - app-shells/tcsh-6.20.00: Does not work with musl
Summary: app-shells/tcsh-6.20.00: Does not work with musl
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Fabian Groffen
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2020-10-21 15:22 UTC by Marcus Comstedt
Modified: 2020-12-24 08:19 UTC (History)
1 user (show)

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


Attachments
Proposed patch to fix the issue (use_sysmalloc.patch,758 bytes, patch)
2020-10-21 15:22 UTC, Marcus Comstedt
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Comstedt 2020-10-21 15:22:53 UTC
Created attachment 667649 [details, diff]
Proposed patch to fix the issue

tcsh has a builtin malloc which uses sbrk(), which is not supported on musl.
There is a define SYSMALLOC that can be used to disable the builtin malloc
and just use the regular one instead.  This define is already set for
Linux/glibc, but because the test used is "defined(__GLIBC__)", the same
does not happen on Linux/musl.

With the builtin malloc, you get the following on startup:

$ tcsh
(nil) current memory allocation:
free:	    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
used:	    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
	Total in use: 0, total free: 0
	Allocated memory from 0x138820000 to 0xffffffffffffffff.  Real top at 0x138820000
nbytes=80: Out of memory
Aborted
$

With the system malloc tcsh works fine.  The attached patch enables system
malloc by adding "defined (__linux__)" to the list of tests enabling system
malloc.  Since system malloc was already enabled for glibc, this should not
lead to any regressions.
Comment 1 Marcus Comstedt 2020-10-21 15:24:30 UTC
Portage 3.0.4 (python 3.7.8-final-0, default/linux/ppc64/17.0/musl, gcc-9.3.0, musl-1.1.24, 5.4.65 ppc64)
=================================================================
System uname: Linux-5.4.65-ppc64-POWER9,_altivec_supported-with-gentoo-2.7
KiB Mem:   133525888 total,  25411712 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Sat, 26 Sep 2020 07:00:01 +0000
Head commit of repository gentoo: 9b39e18668f007a1e733301753cfc1cabe5c9186
sh bash 5.0_p18
ld GNU ld (Gentoo 2.33.1 p2) 2.33.1
app-shells/bash:          5.0_p18::gentoo
dev-lang/perl:            5.30.3::gentoo
dev-lang/python:          2.7.18-r1::gentoo, 3.7.8-r2::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.18::gentoo
sys-devel/autoconf:       2.69-r5::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.33.1-r1::musl
sys-devel/gcc:            9.3.0-r1::musl
sys-devel/gcc-config:     2.3.1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.4-r1::gentoo (virtual/os-headers)
sys-libs/musl:            1.1.24::gentoo
Repositories:

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

musl
    location: /var/lib/layman/musl
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="ppc64"
ACCEPT_LICENSE="@FREE"
CBUILD="powerpc64-gentoo-linux-musl"
CFLAGS="-O2 -pipe -fomit-frame-pointer"
CHOST="powerpc64-gentoo-linux-musl"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -fomit-frame-pointer"
DISTDIR="/tmp/distfiles"
EMERGE_DEFAULT_OPTS="--autounmask"
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"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news nodoc noinfo noman parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK="charset.alias locale.alias"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j40"
PKGDIR="/packages/"
PORTAGE_CONFIGROOT="/"
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="/tmp/"
USE="acl big-endian bzip2 cli crypt dri fortran ibm iconv ipv6 libglvnd ncurses nls nptl openmp pcre ppc64 readline seccomp split-usr ssl tcpd unicode xattr zlib" ABI_PPC="64" ADA_TARGET="gnat_2018" 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" ELIBC="musl" 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" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2 php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python2_7 python3_7" RUBY_TARGETS="ruby25 ruby26" USERLAND="GNU" VIDEO_CARDS="fbdev mga nv r128 radeon dummy v4l" 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"
Unset:  CC, CPPFLAGS, CTARGET, CXX, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 2 Larry the Git Cow gentoo-dev 2020-10-23 07:39:42 UTC
The bug has been referenced in the following commit(s):

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

commit 12ed6f3bc7710b4cc6ff625b43e03ea575573218
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2020-10-23 07:39:12 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2020-10-23 07:39:37 +0000

    app-shells/tcsh-6.22.02: version bump, enabling sysmalloc for everyone
    
    Bug: https://bugs.gentoo.org/750563
    Package-Manager: Portage-3.0.8, Repoman-3.0.2
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 app-shells/tcsh/Manifest            |   1 +
 app-shells/tcsh/tcsh-6.22.02.ebuild | 105 ++++++++++++++++++++++++++++++++++++
 2 files changed, 106 insertions(+)
Comment 3 Fabian Groffen gentoo-dev 2020-10-23 07:45:16 UTC
Can you test if 6.22.02 compiles/runs for you?  If so, I think we should aim for stabilising 6.22.02.  I can create a -r1 for 6.20.00, but that would require the same stabilisation path if you're using stable keywords.
Comment 4 Marcus Comstedt 2020-10-23 15:10:32 UTC
Yes, 6.22.02 ebuild is fine without user patches.

--8<--
hakua(musl):~% echo $version
tcsh 6.22.02 (Astron) 2019-12-04 (ppc64-apple-linux) options wide,nls,dl,al,kan,sm,rh,color,filec
hakua(musl):~% eselect profile show
Current /etc/portage/make.profile symlink:
  default/linux/ppc64/17.0/musl
hakua(musl):~% 
--8<--

Thanks!
Comment 5 Fabian Groffen gentoo-dev 2020-12-24 08:19:26 UTC
thanks for confirming