From fe1e3bbca60a6b4b9a1889f5252e02c27b459f63 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 14 Jan 2024 07:13:52 +0000 Subject: gentoo auto-resync : 14:01:2024 - 07:13:52 --- app-shells/Manifest.gz | Bin 9962 -> 9958 bytes app-shells/bash/Manifest | 12 + app-shells/bash/bash-5.2_p26.ebuild | 375 +++++++++++++++++++++ .../bash/files/bash-5.2_p26-memory-leaks.patch | 136 ++++++++ 4 files changed, 523 insertions(+) create mode 100644 app-shells/bash/bash-5.2_p26.ebuild create mode 100644 app-shells/bash/files/bash-5.2_p26-memory-leaks.patch (limited to 'app-shells') diff --git a/app-shells/Manifest.gz b/app-shells/Manifest.gz index 1f5d29f6e7ca..9525f3d46d07 100644 Binary files a/app-shells/Manifest.gz and b/app-shells/Manifest.gz differ diff --git a/app-shells/bash/Manifest b/app-shells/bash/Manifest index 53bb2526feef..59e80b08eb75 100644 --- a/app-shells/bash/Manifest +++ b/app-shells/bash/Manifest @@ -5,6 +5,7 @@ AUX bash-5.2_p15-random-ub.patch 451 BLAKE2B adab09c3f2ce3697e3659e0126612015571 AUX bash-5.2_p21-configure-strtold.patch 910 BLAKE2B 83ec6ff756543ee44c18902f2d30dd662a84237b9594a7e0cfc21a1c16fce49e37cf67729b3a17d59cc978cb6675e04457e3b6b0909d94cb234a1dde96f7c9ea SHA512 d8f0487db08dc7ba3f42075067556757142b13f739ca765d851e51ce09d11d4cce02ad016b724e70dd418d9bb37166c4c4ebb98e874cd89920661470486d252e AUX bash-5.2_p21-memory-leak.patch 439 BLAKE2B 135b8a52fa507a729d86289915e2d4d7c40695814ff7118e9def781ea1caab81c848311988866f73701bce3389ad727afd208f2420f032ae32071d411d954034 SHA512 3836297ff12c45c78ec6f55a7beb7d7ae158639beb2839df18b8700df3a4fe54f54eadbb4cd4edfa64b68da2a438ec835df68e822f14c83e884001b01ad44b59 AUX bash-5.2_p21-wpointer-to-int.patch 512 BLAKE2B 0c7f5eb5b697abf15c1d17888a973e44d0ead1f095778b41841a6a1937a5b9e7ce5fa6a05e4404504990b0a244fdecfc12ce7c33ee7d67b4c837435e9bfe2b57 SHA512 61bc7f96a1f3f782f0502c660f7578f4c97b3aae244c95ce3810815fcf9c81734cd19599dc9c8b0707d4f2bbb50497ef85c02e66fdd360d49befe0fed0ca4985 +AUX bash-5.2_p26-memory-leaks.patch 4357 BLAKE2B 1b9f08054b28fa0e73b7b3d4da2674efd75b3ce11392a078d5072ba8e466f4a9c504892f9a1f2f62e4dc39b22050e68d42bcbae8ebe537df699d0c884c89a0b9 SHA512 ad30a74b7f4ecf5f7446867baf9b177fb1036e384b61a2ed73b121b17b7f686f9bdf9295c5c251b11d165f80e6110a2768257a2460c7e93abe78a5f763b972e8 AUX bash_logout 205 BLAKE2B b8c0266c3d1e31a714304a2b3b33389f042ae5bd497379f9b15ce31d47d1e3da73ba6536023953b00efe27b687e2ff45d94e3f01a13acc824dc12e31552c5b94 SHA512 7234250c03fc920996a381f9daef9e2d8ab1e1a29acdebed6669d8e0fe1c872a7fa343adf7d9ddc81225b0cd9eb223ba7ad1ff42448aff057fc6d6baa8f04a7d AUX bashrc 3494 BLAKE2B e9379c18fca85666cd347d1d8cf5c9859c5865ad7a3ded1ac5724bad6117924231e89dcc21f1a80931591e9a39c1acc3f7be8b2afe38986ea34b3b8fc12f5814 SHA512 a8fa416ab9265055e778fad3e4190ab5f57da0823c12d60a915bb77ba701fe93df8d16e041dd5747ed9db899a2516451b803db648aed0f85f0abb6d98c9414b8 AUX dot-bash_logout 127 BLAKE2B 8290778aea3426f4c56e5a9e7328faa76f99001fc7ce3eeb3ec26624edcd918d7e946da9a63ffcd0cf0f739b528ccb9e764d448276fe4344b69ef2036fdd9921 SHA512 e0248b5087656a4dd3a4790ed8e6101866b922ccab36b510b3bf408dc0c583e70f323fbad0392e4ea6ca5dcbe73568733e0c0aa9c8ce6b00ff5f72bf3e9fd8fd @@ -427,6 +428,16 @@ DIST bash52-020 1459 BLAKE2B de3e38dbb2395c765767aed516ae3d143e3187a44964f90c587 DIST bash52-020.sig 95 BLAKE2B 8fd778b381cc14d17de8f2b7e215fa0d35c569a90d46fac77c0a94bea525bd62428663f0a908e64ff773bd4caf0aab7f92c2dda1f4158aacbd53f053be91d16d SHA512 0ae6d9189329e560a89af9f42f0f98126faeb15d29bd327e6bd7694870a9bcfae3d3d545e42baf4223dcc732a50d46e4c22477c41b98be85736bb05a359eeeec DIST bash52-021 1890 BLAKE2B cc2d886da8c51eb7bdbed694423eae29dc05dc2c7bd0cd41b9ee3acbc56ef135043bb48275c4162d33d2d4051a0a8b27f3aec097335b9d15e38fd841a6793f71 SHA512 c3a61e975819919d7ba120f322fc5e9a420b21f03d7bf989a5e7b6a99bfe35372744277040e88361ee383ab53b05d607d52ff2000b401de038af67c91728b48f DIST bash52-021.sig 95 BLAKE2B 79572b14f423f0a96e89d106c5ed448c2b447760e99c743354bd6315132325c19312cfcad98f94c42d3094bb4283c1f7753ac4d3c600d46c63e49d0f7cc3befd SHA512 4063559edade78d1510c12b825aa29925e515807b447e50fe564770ee26ddf34e18b47132e5154a4c883043cc80b3d6415e4ba370bad308a17dc0f6b53fc61c5 +DIST bash52-022 1305 BLAKE2B 2e0cc2255c0313ab85547363d7dd060d460db44131b698235275413c51e79cdc33b77064f84d56e75a0951fc62f947482c2f317a0d4f732822a4ffaed943a9cd SHA512 12a669f3b6ba936be31a85c50bfe52689f3deea02eedb31100ab113b1e74d8104934e615965b4bf7f3b1cf5ad71870211b0bd910bf0862e8ce603505b4b1db3f +DIST bash52-022.sig 95 BLAKE2B 423bcd005987dae027e29c873edecda0cf51cdcb4bb652b1577c28258602e2a34cfecbc38383068fc95f6e1e0e558bc6de64a225a9e7392f05518a9190237d3f SHA512 f3af8e4ea507b53dd979f597cfde69bd59bf4b7229fd0058c299a2c1abb36182b3a38b8630a81e0654f8da8bc47725459ddf32031ab1a5615105651c14640167 +DIST bash52-023 1817 BLAKE2B 9727ad8cf219ba906021f833cacbbccf6c5b9c94decf861a5f40627680ac3d19d65eaeafecd575545dc7eb538f27b0ecc55a7462b49d226751ad14fb2f40e825 SHA512 59a2e9e4ee4938ba868552eecdbed5f5d797e143bf6f69fde5c50a4e478c19ce36d562b9f51f65d7da5fe216050276bfe1eb430c151c845cffa77d3fdc9ce771 +DIST bash52-023.sig 95 BLAKE2B 84621d203ab68da6a6e5a36fe31160e463fda864620a94fec99f0be3c18df6c465adf2179f3bc99cae2627058d174e3b3d35d473836609252ae41527857e6464 SHA512 b17a8718467e1aee6d47d01b8bcad0892b3c7369f17794604481b655b3404b6f0970aabf5d29b6898e598530946ccdf3e2bddbfb02a7e033927a9be2686aa246 +DIST bash52-024 2298 BLAKE2B f9113fcb1b8ee8d96744e45f020fd8ec49546d6a29883544f4d4a4ef1087b764de6e7c37c760ac709370cdace9619aec84f03713be5e6bc9a9e90d97dd35caa0 SHA512 ff77920ba4c8df7cb8841d94f483a5678a65ff2aab3f03b02b21eba7daaea15d05af26d2fc7f468509c2047f682908d78cd94254e0688496280e345d010aac24 +DIST bash52-024.sig 95 BLAKE2B 412b7f3aad7f6eeb49abfafd428bd9dbc72c5b80be0b8908d8284befa29c62c6460f883142145a2eefb157fc53030ea391d6ff50706f387a2ef933b3c89a9895 SHA512 d56fc42b92a9c0d2de32a0365c3f83913e0fe37d60a57254ac773d5ee12793694d078ee8de207718a2166631f8269bdb91fb5d386fec09fd19e7f4e6d2008b97 +DIST bash52-025 1454 BLAKE2B 5d18e00cc44710f078037f25c61741a078bb0fc906d6d5555e581e093d9e99be71f7f06fc0d139f4f25d40f5f854378031aff6e63d26ead55fe6cca626df50bd SHA512 20e708ff483ae2ba655c069fbaccdef59d81f52ba787d97fd1b997522248e9e7e1d7773a35f3a6e44c4521a7a5be273ffa25c580533e6d1d1bfb5e49040530c3 +DIST bash52-025.sig 95 BLAKE2B aff63f1a0a753b632f0d2ce4cf8f4117689469150d41dd0e0d7f76fca973d52fb16f3957b12709826e50705f921fe141108b1046de05d17b40216ed5d4a00893 SHA512 079888adce1cb8583b547d67005f179614f1c42756de20acdb9e24763dec145a421c68e7ceb48d42b853ae7fcb07e051cc1ca56f9dfd337c9a1b001618df2828 +DIST bash52-026 1372 BLAKE2B ebe3bc47dadf5d689258c5ccf9883838d3383dc43bec68d2a6767b6348cf1515a98ec9e445c3110e8eb0d87e742c20a0d4ddb70649ec94217f55aad7d18552af SHA512 571993da2b8067ef5b7b705aee65dd414ee70b216ffbcb9fab7c08807b87a72465594c3f1576c795ae86bf951911cdde70ad1037e851b88ee379c4237ccff6fe +DIST bash52-026.sig 95 BLAKE2B 175df0703ee5374094d41761ebc2827d34cb97328ea8e486cc9e5c946e482a7d0a16a7ac45e11296500cff8ac4c013e60b07d34abf8b3478527a80f742fbe85e SHA512 6db725ffcf429e04551b2fde329067696b20bef9418b57cff56a62f31c262d0b800061284469eb9f809ca49516516735213dc05defab52ff864ac3b214336559 EBUILD bash-2.05b_p13.ebuild 5246 BLAKE2B a428bfdebf5a98f8a45f2fb6127a132708ec0efc5bbd9cf6fa5c7bb70e565ae12e6b61248c80fda686da3706f957216aff2b5870ca13e1a0a86edfcf50648049 SHA512 72002267b10db0258c1912d5b665d4ca41054210197b4617822a4888ac7a2ff66a0a0354456a947333df5000272a54f70f75ccbcd24e137efe0a0058a4055f25 EBUILD bash-3.0_p22.ebuild 5384 BLAKE2B a011f5d6d7c8428ffaabfff4f4ced9908876fb3cd198c4f72c2be7fb6b9c8cae37c333c6ad31e8506694c2945e83d0fe8fd6b8bd172f4c6092f74354b9e5fb65 SHA512 e56eedddbbe76d0c96fbbc8b6b1f95c183b1b3fe45fb32ea5ded646cfaff7ab14af4813cfb7ad20a6ce81b75118055aa606bba665e88d4dab55cec7ec6e5acdd EBUILD bash-3.1_p23.ebuild 5061 BLAKE2B 30640571e07e149a1a087c139c9f891922e9660a23033fdec6be3258a47812ef3280d72f68ec4521b2b6cb0c136cfce515f40c6ca1f2fafdac1205c7b8ac4067 SHA512 1137f8f69407ce2829681e932a534daff6a2f64c9b79c39e49766223719dae21503467e726dcaab729c10be9b887a947dda2d78d9f958b170168e2bcc2bfef5d @@ -441,5 +452,6 @@ EBUILD bash-5.1_p16-r6.ebuild 8844 BLAKE2B 11fffeaad92d1f30c0818232f3f2a79b7066d EBUILD bash-5.1_p16-r7.ebuild 8906 BLAKE2B 5db7108b49a5dd2366aa3d06a35433fb82f6d5ee61134d277a2e811bfeaa5ba92b3192b33c211d0d26aed0e380d95670df396d6672635f6c335d77fbca06ec4c SHA512 415ce1a83da7784cc3543da6bbd01c8f07b82a4b6bdb24bcfc7518a402830d3c12788f5b911ed52ad6441b4a6b4928de4c1eb06bc3d0cf3a7e57fa34bbd889f9 EBUILD bash-5.2_p21-r1.ebuild 10718 BLAKE2B d49eb8e9362ee4cef81e1b18fc6bdb7def0574f519426996cbfb7d372464d293dfb051839344e254a29bfd4bba9455b9691cd31d9e1f4406a56293ae54278233 SHA512 5b577395e20e8b10d26d9b9282fa606320567761179573764a67a35f27125cf6999f3ab925e6314598ee908198709fbd043e28408121958024a628f966dc790f EBUILD bash-5.2_p21-r2.ebuild 10765 BLAKE2B 0adc36a9231d84369bb268e192ea18135fe8132823ee9fb72cfffbf832283ee7fc139178893b00b28984384d8e1c3fcedb2ac57e143f920234a932c6087f6202 SHA512 76e04aab4397a84e418de0df20fe6441b46f9c838422b3d9f30e7b2efcf75032f765b0d8b264ca5318cefbd872f17e86c93499ce01b7f19d624414568ee0d17b +EBUILD bash-5.2_p26.ebuild 10766 BLAKE2B 9ba3f7d2cf9cf217c3632ce940bb21f7af94ab7fa9a6e5a90a73d3cdb82d0102fa624a786465f0b22c018d76542c740aace840ec8cdea663f071565e9deabf05 SHA512 2668927ab8ac0a0ea4b271efa87a56d2ecc61eb4827c12e0a361c6c17f0e7fae8035df6735e2b7327ab59caea08ac08d5ed5eb4e460a9998274234481f8e9573 EBUILD bash-9999.ebuild 10533 BLAKE2B 71b66f51269d4810aedd89aa6371762fcece77ebd2e4e3de6f1139e73b15aad166c7802a755249b26502eb65ca707c9e54c5c5ef620fa590fbe9333c28b8730b SHA512 5235dc057c497b3aed582217a4d0ecf244240f8c005db4a448aa5877fbe0a6ad2fc5ccc9f96436f380020b9ee899c3543c4c2cf71fda6f3f893e4a6008ecd90d MISC metadata.xml 1009 BLAKE2B f71587b0a6d05b907f82b26be93b071290d91dc8f612f7b008a05eaa94d45be2ef8c1d992b7ac886648a9dcf964c30e8d9a7aff90d44835beb452e0d635b9533 SHA512 8aa1cb4c3206a76d10181394a91c315967fd9d3b359194f430f075fdd5a0b4b32149eec36b85412ef7e84b55e7b01955c75486b2df82b392a5acb3df8229a88d diff --git a/app-shells/bash/bash-5.2_p26.ebuild b/app-shells/bash/bash-5.2_p26.ebuild new file mode 100644 index 000000000000..1bee48a4a941 --- /dev/null +++ b/app-shells/bash/bash-5.2_p26.ebuild @@ -0,0 +1,375 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/chetramey.asc +inherit flag-o-matic toolchain-funcs prefix verify-sig + +# Uncomment if we have a patchset +#GENTOO_PATCH_DEV="sam" +#GENTOO_PATCH_VER="${PV}" + +# Official patchlevel +# See ftp://ftp.cwru.edu/pub/bash/bash-5.1-patches/ +PLEVEL="${PV##*_p}" +MY_PV="${PV/_p*}" +MY_PV="${MY_PV/_/-}" +MY_P="${PN}-${MY_PV}" +MY_PATCHES=() + +is_release() { + case ${PV} in + 9999|*_alpha*|*_beta*|*_rc*) + return 1 + ;; + *) + return 0 + ;; + esac +} + +[[ ${PV} != *_p* ]] && PLEVEL=0 + +# The version of readline this bash normally ships with. +# Note: right now, we don't use the system copy of readline for bash for non-releases. +READLINE_VER="8.2_p1" + +DESCRIPTION="The standard GNU Bourne again shell" +HOMEPAGE="https://tiswww.case.edu/php/chet/bash/bashtop.html https://git.savannah.gnu.org/cgit/bash.git" + +if [[ ${PV} == 9999 ]] ; then + EGIT_REPO_URI="https://git.savannah.gnu.org/git/bash.git" + EGIT_BRANCH=devel + inherit git-r3 +elif is_release ; then + SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz" + SRC_URI+=" verify-sig? ( mirror://gnu/bash/${MY_P}.tar.gz.sig )" + + if [[ ${PLEVEL} -gt 0 ]] ; then + # bash-5.1 -> bash51 + my_p=${PN}$(ver_rs 1-2 '' $(ver_cut 1-2)) + + patch_url= + my_patch_index= + + upstream_url_base="mirror://gnu/bash" + mirror_url_base="ftp://ftp.cwru.edu/pub/bash" + + for ((my_patch_index=1; my_patch_index <= ${PLEVEL} ; my_patch_index++)) ; do + printf -v mangled_patch_ver ${my_p}-%03d ${my_patch_index} + patch_url="${upstream_url_base}/${MY_P}-patches/${mangled_patch_ver}" + + SRC_URI+=" ${patch_url}" + SRC_URI+=" verify-sig? ( ${patch_url}.sig )" + + # Add in the mirror URL too. + SRC_URI+=" ${patch_url/${upstream_url_base}/${mirror_url_base}}" + SRC_URI+=" verify-sig? ( ${patch_url/${upstream_url_base}/${mirror_url_base}} )" + + MY_PATCHES+=( "${DISTDIR}"/${mangled_patch_ver} ) + done + + unset my_p patch_url my_patch_index upstream_url_base mirror_url_base + fi +else + SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz" + SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${MY_P}.tar.gz.sig ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz.sig )" +fi + +if [[ -n ${GENTOO_PATCH_VER} ]] ; then + SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${GENTOO_PATCH_VER}-patches.tar.xz" +fi + +LICENSE="GPL-3+" +SLOT="0" +if is_release ; then + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" +fi +IUSE="afs bashlogger examples mem-scramble +net nls plugins pgo +readline" + +DEPEND=" + >=sys-libs/ncurses-5.2-r2:= + nls? ( virtual/libintl ) +" +if is_release ; then + DEPEND+=" readline? ( >=sys-libs/readline-${READLINE_VER}:= )" +fi +RDEPEND=" + ${DEPEND} +" +# We only need bison (yacc) when the .y files get patched (bash42-005, bash51-011) +BDEPEND=" + pgo? ( dev-util/gperf ) + verify-sig? ( sec-keys/openpgp-keys-chetramey ) +" + +S="${WORKDIR}/${MY_P}" + +# EAPI 8 tries to append it but it doesn't exist here +QA_CONFIGURE_OPTIONS="--disable-static" + +PATCHES=( + #"${WORKDIR}"/${PN}-${GENTOO_PATCH_VER}/ + + # Patches from Chet sent to bash-bug ml + "${FILESDIR}"/${PN}-5.0-syslog-history-extern.patch + "${FILESDIR}"/${PN}-5.2_p15-random-ub.patch + "${FILESDIR}"/${PN}-5.2_p15-configure-clang16.patch + "${FILESDIR}"/${PN}-5.2_p21-wpointer-to-int.patch + "${FILESDIR}"/${PN}-5.2_p21-configure-strtold.patch + "${FILESDIR}"/${PN}-5.2_p26-memory-leaks.patch +) + +pkg_setup() { + # bug #7332 + if is-flag -malign-double ; then + eerror "Detected bad CFLAGS '-malign-double'. Do not use this" + eerror "as it breaks LFS (struct stat64) on x86." + die "remove -malign-double from your CFLAGS mr ricer" + fi + + if use bashlogger ; then + ewarn "The logging patch should ONLY be used in restricted (i.e. honeypot) envs." + ewarn "This will log ALL output you enter into the shell, you have been warned." + fi +} + +src_unpack() { + if [[ ${PV} == 9999 ]] ; then + git-r3_src_unpack + else + if use verify-sig ; then + verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.gz{,.sig} + + local patch + for patch in "${MY_PATCHES[@]}" ; do + verify-sig_verify_detached ${patch}{,.sig} + done + fi + + unpack ${MY_P}.tar.gz + + if [[ -n ${GENTOO_PATCH_VER} ]] ; then + unpack ${PN}-${GENTOO_PATCH_VER}-patches.tar.xz + fi + fi +} + +src_prepare() { + # Include official patches + [[ ${PLEVEL} -gt 0 ]] && eapply -p0 "${MY_PATCHES[@]}" + + # Clean out local libs so we know we use system ones w/releases. + if is_release ; then + rm -rf lib/{readline,termcap}/* || die + touch lib/{readline,termcap}/Makefile.in || die # for config.status + sed -ri -e 's:\$[{(](RL|HIST)_LIBSRC[)}]/[[:alpha:]_-]*\.h::g' Makefile.in || die + fi + + # Prefixify hardcoded path names. No-op for non-prefix. + hprefixify pathnames.h.in + + # Avoid regenerating docs after patches, bug #407985 + sed -i -r '/^(HS|RL)USER/s:=.*:=:' doc/Makefile.in || die + touch -r . doc/* || die + + # Sometimes hangs (more noticeable w/ pgo), bug #907403. + rm tests/run-jobs || die + + eapply -p0 "${PATCHES[@]}" + eapply_user +} + +src_configure() { + # Upstream only test with Bison and require GNUisms like YYEOF and + # YYERRCODE. The former at least may be in POSIX soon: + # https://www.austingroupbugs.net/view.php?id=1269. + # configure warns on use of non-Bison but doesn't abort. The result + # may misbehave at runtime. + unset YACC + + local myconf=( + --disable-profiling + + # Force linking with system curses ... the bundled termcap lib + # sucks bad compared to ncurses. For the most part, ncurses + # is here because readline needs it. But bash itself calls + # ncurses in one or two small places :(. + --with-curses + + $(use_enable mem-scramble) + $(use_enable net net-redirections) + $(use_enable readline) + $(use_enable readline bang-history) + $(use_enable readline history) + $(use_with afs) + $(use_with mem-scramble bash-malloc) + ) + + # For descriptions of these, see config-top.h + # bashrc/#26952 bash_logout/#90488 ssh/#24762 mktemp/#574426 + append-cppflags \ + -DDEFAULT_PATH_VALUE=\'\""${EPREFIX}"/usr/local/sbin:"${EPREFIX}"/usr/local/bin:"${EPREFIX}"/usr/sbin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/bin\"\' \ + -DSTANDARD_UTILS_PATH=\'\""${EPREFIX}"/bin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/sbin:"${EPREFIX}"/usr/sbin\"\' \ + -DSYS_BASHRC=\'\""${EPREFIX}"/etc/bash/bashrc\"\' \ + -DSYS_BASH_LOGOUT=\'\""${EPREFIX}"/etc/bash/bash_logout\"\' \ + -DNON_INTERACTIVE_LOGIN_SHELLS \ + -DSSH_SOURCE_BASHRC \ + $(use bashlogger && echo -DSYSLOG_HISTORY) + + # Don't even think about building this statically without + # reading bug #7714 first. If you still build it statically, + # don't come crying to us with bugs ;). + #use static && export LDFLAGS="${LDFLAGS} -static" + use nls || myconf+=( --disable-nls ) + + if is_release ; then + # Historically, we always used the builtin readline, but since + # our handling of SONAME upgrades has gotten much more stable + # in the PM (and the readline ebuild itself preserves the old + # libs during upgrades), linking against the system copy should + # be safe. + # Exact cached version here doesn't really matter as long as it + # is at least what's in the DEPEND up above. + export ac_cv_rl_version=${READLINE_VER%%_*} + + # Use system readline only with released versions. + myconf+=( --with-installed-readline=. ) + fi + + if use plugins ; then + append-ldflags -Wl,-rpath,"${EPREFIX}"/usr/$(get_libdir)/bash + else + # Disable the plugins logic by hand since bash doesn't + # provide a way of doing it. + export ac_cv_func_dl{close,open,sym}=no \ + ac_cv_lib_dl_dlopen=no ac_cv_header_dlfcn_h=no + + sed -i \ + -e '/LOCAL_LDFLAGS=/s:-rdynamic::' \ + configure || die + fi + + # bug #444070 + tc-export AR + + econf "${myconf[@]}" +} + +src_compile() { + # -fprofile-partial-training because upstream note the test suite isn't super comprehensive + # See https://documentation.suse.com/sbp/all/html/SBP-GCC-10/index.html#sec-gcc10-pgo + local pgo_generate_flags=$(usev pgo "-fprofile-update=atomic -fprofile-dir=${T}/pgo -fprofile-generate=${T}/pgo $(test-flags-CC -fprofile-partial-training)") + local pgo_use_flags=$(usev pgo "-fprofile-use=${T}/pgo -fprofile-dir=${T}/pgo $(test-flags-CC -fprofile-partial-training)") + + emake CFLAGS="${CFLAGS} ${pgo_generate_flags}" + use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} ${pgo_generate_flags}" all others + + # Build Bash and run its tests to generate profiles. + if use pgo ; then + # Used in test suite. + unset A + + emake CFLAGS="${CFLAGS} ${pgo_generate_flags}" -k check + + if tc-is-clang; then + llvm-profdata merge "${T}"/pgo --output="${T}"/pgo/default.profdata || die + fi + + # Rebuild Bash using the profiling data we just generated. + emake clean + emake CFLAGS="${CFLAGS} ${pgo_use_flags}" + use plugins && emake -C examples/loadables CFLAGS="${CFLAGS} ${pgo_use_flags}" all others + fi +} + +src_test() { + # Used in test suite. + unset A + + default +} + +src_install() { + local d f + + default + + dodir /bin + mv "${ED}"/usr/bin/bash "${ED}"/bin/ || die + dosym bash /bin/rbash + + insinto /etc/bash + doins "${FILESDIR}"/bash_logout + doins "$(prefixify_ro "${FILESDIR}"/bashrc)" + + keepdir /etc/bash/bashrc.d + + insinto /etc/skel + for f in bash{_logout,_profile,rc} ; do + newins "${FILESDIR}"/dot-${f} .${f} + done + + local sed_args=( + -e 's:#GNU#@::' + -e '/#@/d' + ) + + if ! use readline ; then + # bug #432338 + sed_args+=( + -e '/^shopt -s histappend/s:^:#:' + -e 's:use_color=true:use_color=false:' + ) + fi + + sed -i \ + "${sed_args[@]}" \ + "${ED}"/etc/skel/.bashrc \ + "${ED}"/etc/bash/bashrc || die + + if use plugins ; then + exeinto /usr/$(get_libdir)/bash + doexe $(echo examples/loadables/*.o | sed 's:\.o::g') + + insinto /usr/include/bash-plugins + doins *.h builtins/*.h include/*.h lib/{glob/glob.h,tilde/tilde.h} + fi + + if use examples ; then + for d in examples/{functions,misc,scripts,startup-files} ; do + exeinto /usr/share/doc/${PF}/${d} + docinto ${d} + for f in ${d}/* ; do + if [[ ${f##*/} != PERMISSION ]] && [[ ${f##*/} != *README ]] ; then + doexe ${f} + else + dodoc ${f} + fi + done + done + fi + + # Install bash_builtins.1 and rbash.1 + emake -C doc DESTDIR="${D}" install_builtins + sed 's:bash\.1:man1/&:' doc/rbash.1 > "${T}"/rbash.1 || die + doman "${T}"/rbash.1 + + newdoc CWRU/changelog ChangeLog + dosym bash.info /usr/share/info/bashref.info +} + +pkg_preinst() { + if [[ -e ${EROOT}/etc/bashrc ]] && [[ ! -d ${EROOT}/etc/bash ]] ; then + mkdir -p "${EROOT}"/etc/bash + mv -f "${EROOT}"/etc/bashrc "${EROOT}"/etc/bash/ + fi +} + +pkg_postinst() { + # If /bin/sh does not exist, provide it + if [[ ! -e ${EROOT}/bin/sh ]] ; then + ln -sf bash "${EROOT}"/bin/sh + fi +} diff --git a/app-shells/bash/files/bash-5.2_p26-memory-leaks.patch b/app-shells/bash/files/bash-5.2_p26-memory-leaks.patch new file mode 100644 index 000000000000..10a5deb18192 --- /dev/null +++ b/app-shells/bash/files/bash-5.2_p26-memory-leaks.patch @@ -0,0 +1,136 @@ +https://lists.gnu.org/archive/html/bug-bash/2024-01/msg00036.html +https://lists.gnu.org/archive/html/bug-bash/2024-01/txtm8yNNPR9RQ.txt + +For evalstring.c: +* https://lists.gnu.org/archive/html/bug-bash/2024-01/msg00011.html +* https://git.savannah.gnu.org/cgit/bash.git/diff/builtins/evalstring.c?h=devel&id=81f7b44564cd1510788035cea7c59631865a7db2&dt=1#n766 + +From 711ab85262884f2b91f09eceb9aefd0e2426ce67 Mon Sep 17 00:00:00 2001 +From: Grisha Levit +Date: Sat, 3 Jun 2023 16:51:26 -0400 +Subject: [PATCH] various leaks + +Found mostly by normal usage running a no-bash-malloc build with clang's +LeakSanitizer enabled. So far seems to provide very accurate results. + +* arrayfunc.c +- quote_compound_array_word: make sure to free VALUE +- bind_assoc_var_internal: if assigning to a dynamic variable, make sure + to free the key (usually assoc_insert would do it) + +* bashline.c +- bash_command_name_stat_hook: free original *NAME if we are going to + change what it points to (what the callers seem to expect) + +* builtins/evalstring.c +- parse_and_execute: make sure to dispose of the parsed command + resulting from a failed function import attempt +- open_redir_file: if we did not get a pointer to pass back the expanded + filename, make sure to free the name + +* examples/loadables/stat.c +- loadstat: bind_assoc_variable does not free its VALUE argument so make + sure to do it + +* subst.c +- param_expand: free temp1 value for codepaths that don't do it +--- + arrayfunc.c | 6 +++++- + bashline.c | 1 + + builtins/evalstring.c | 4 ++++ + examples/loadables/stat.c | 1 + + subst.c | 2 ++ + 5 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/arrayfunc.c b/arrayfunc.c +index 2c05d15b..8ba64084 100644 +--- arrayfunc.c ++++ arrayfunc.c +@@ -208,7 +208,10 @@ bind_assoc_var_internal (entry, hash, key, value, flags) + newval = make_array_variable_value (entry, 0, key, value, flags); + + if (entry->assign_func) +- (*entry->assign_func) (entry, newval, 0, key); ++ { ++ (*entry->assign_func) (entry, newval, 0, key); ++ FREE (key); ++ } + else + assoc_insert (hash, key, newval); + +@@ -985,6 +988,7 @@ quote_compound_array_word (w, type) + if (t != w+ind) + free (t); + strcpy (nword + i, value); ++ free (value); + + return nword; + } +diff --git a/bashline.c b/bashline.c +index c85b05b6..bd7548cc 100644 +--- bashline.c ++++ bashline.c +@@ -1928,6 +1928,7 @@ bash_command_name_stat_hook (name) + result = search_for_command (cname, 0); + if (result) + { ++ FREE (*name); + *name = result; + return 1; + } +diff --git a/builtins/evalstring.c b/builtins/evalstring.c +index df3dd68e..20c6a4a7 100644 +--- builtins/evalstring.c ++++ builtins/evalstring.c +@@ -461,6 +461,8 @@ parse_and_execute (string, from_file, flags) + should_jump_to_top_level = 0; + last_result = last_command_exit_value = EX_BADUSAGE; + set_pipestatus_from_exit (last_command_exit_value); ++ dispose_command(command); ++ global_command = (COMMAND *)NULL; + reset_parser (); + break; + } +@@ -762,6 +764,8 @@ open_redir_file (r, fnp) + + if (fnp) + *fnp = fn; ++ else ++ free (fn); + return fd; + } + +diff --git a/examples/loadables/stat.c b/examples/loadables/stat.c +index 1e60e7b6..ed5c9764 100644 +--- examples/loadables/stat.c ++++ examples/loadables/stat.c +@@ -349,6 +349,7 @@ loadstat (vname, var, fname, flags, fmt, sp) + key = savestring (arraysubs[i]); + value = statval (i, fname, flags, fmt, sp); + v = bind_assoc_variable (var, vname, key, value, ASS_FORCE); ++ free (value); + } + return 0; + } +diff --git a/subst.c b/subst.c +index 1ac6eb2d..ff0602da 100644 +--- subst.c ++++ subst.c +@@ -10727,6 +10727,7 @@ comsub: + { + chk_atstar (temp, quoted, pflags, quoted_dollar_at_p, contains_dollar_at); + tdesc = parameter_brace_expand_word (temp, SPECIAL_VAR (temp, 0), quoted, pflags, 0); ++ free (temp1); + if (tdesc == &expand_wdesc_error || tdesc == &expand_wdesc_fatal) + return (tdesc); + ret = tdesc; +@@ -10739,6 +10740,7 @@ comsub: + { + set_exit_status (EXECUTION_FAILURE); + report_error (_("%s: invalid variable name for name reference"), temp); ++ free (temp1); + return (&expand_wdesc_error); /* XXX */ + } + else +-- +2.43.0 -- cgit v1.2.3