push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

197
pkgs/shells/bash/5.nix Normal file
View File

@@ -0,0 +1,197 @@
{
lib,
stdenv,
buildPackages,
fetchurl,
updateAutotoolsGnuConfigScriptsHook,
bison,
util-linux,
interactive ? true,
readline,
withDocs ? null,
forFHSEnv ? false,
pkgsStatic,
}:
let
upstreamPatches = import ./bash-5.3-patches.nix (
nr: sha256:
fetchurl {
url = "mirror://gnu/bash/bash-5.3-patches/bash53-${nr}";
inherit sha256;
}
);
in
lib.warnIf (withDocs != null)
''
bash: `.override { withDocs = true; }` is deprecated, the docs are always included.
''
stdenv.mkDerivation
rec {
pname = "bash${lib.optionalString interactive "-interactive"}";
version = "5.3${patch_suffix}";
patch_suffix = "p${toString (builtins.length upstreamPatches)}";
src = fetchurl {
url = "mirror://gnu/bash/bash-${lib.removeSuffix patch_suffix version}.tar.gz";
hash = "sha256-DVzYaWX4aaJs9k9Lcb57lvkKO6iz104n6OnZ1VUPMbo=";
};
hardeningDisable = [
"format"
]
# bionic libc is super weird and has issues with fortify outside of its own libc, check this comment:
# https://github.com/NixOS/nixpkgs/pull/192630#discussion_r978985593
# or you can check libc/include/sys/cdefs.h in bionic source code
++ lib.optional (stdenv.hostPlatform.libc == "bionic") "fortify";
outputs = [
"out"
"dev"
"man"
"doc"
"info"
];
separateDebugInfo = true;
env.NIX_CFLAGS_COMPILE = ''
-DSYS_BASHRC="/etc/bashrc"
-DSYS_BASH_LOGOUT="/etc/bash_logout"
''
+ lib.optionalString (!forFHSEnv) ''
-DDEFAULT_PATH_VALUE="/no-such-path"
-DSTANDARD_UTILS_PATH="/no-such-path"
-DDEFAULT_LOADABLE_BUILTINS_PATH="${placeholder "out"}/lib/bash:."
''
+ ''
-DNON_INTERACTIVE_LOGIN_SHELLS
-DSSH_SOURCE_BASHRC
'';
patchFlags = [ "-p0" ];
patches = upstreamPatches ++ [
# Enable PGRP_PIPE independently of the kernel of the build machine.
# This doesn't seem to be upstreamed despite such a mention of in https://github.com/NixOS/nixpkgs/pull/77196,
# which originally introduced the patch
# Some related discussion can be found in
# https://lists.gnu.org/archive/html/bug-bash/2015-05/msg00071.html
./pgrp-pipe-5.patch
];
configureFlags = [
# At least on Linux bash memory allocator has pathological performance
# in scenarios involving use of larger memory:
# https://lists.gnu.org/archive/html/bug-bash/2023-08/msg00052.html
# Various distributions default to system allocator. Let's nixpkgs
# do the same.
"--without-bash-malloc"
(if interactive then "--with-installed-readline" else "--disable-readline")
]
++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"bash_cv_job_control_missing=nomissing"
"bash_cv_sys_named_pipes=nomissing"
"bash_cv_getcwd_malloc=yes"
# This check cannot be performed when cross compiling. The "yes"
# default is fine for static linking on Linux (weak symbols?) but
# not with BSDs, when it does clash with the regular `getenv`.
"bash_cv_getenv_redef=${
if !(with stdenv.hostPlatform; isStatic && (isOpenBSD || isFreeBSD)) then "yes" else "no"
}"
]
++ lib.optionals stdenv.hostPlatform.isCygwin [
"--without-libintl-prefix"
"--without-libiconv-prefix"
"--with-installed-readline"
"bash_cv_dev_stdin=present"
"bash_cv_dev_fd=standard"
"bash_cv_termcap_lib=libncurses"
]
++ lib.optionals (stdenv.hostPlatform.libc == "musl") [
"--disable-nls"
]
++ lib.optionals stdenv.hostPlatform.isFreeBSD [
# /dev/fd is optional on FreeBSD. we need it to work when built on a system
# with it and transferred to a system without it! This includes linux cross.
"bash_cv_dev_fd=absent"
];
strictDeps = true;
# Note: Bison is needed because the patches above modify parse.y.
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [
updateAutotoolsGnuConfigScriptsHook
bison
]
++ lib.optional stdenv.hostPlatform.isDarwin stdenv.cc.bintools;
buildInputs = lib.optional interactive readline;
enableParallelBuilding = true;
makeFlags = lib.optionals stdenv.hostPlatform.isCygwin [
"LOCAL_LDFLAGS=-Wl,--export-all,--out-implib,libbash.dll.a"
"SHOBJ_LIBS=-lbash"
];
nativeCheckInputs = [ util-linux ];
doCheck = false; # dependency cycle, needs to be interactive
postInstall = ''
ln -s bash "$out/bin/sh"
rm -f $out/lib/bash/Makefile.inc
'';
postFixup =
if interactive then
''
substituteInPlace "$out/bin/bashbug" \
--replace '#!/bin/sh' "#!$out/bin/bash"
''
# most space is taken by locale data
else
''
rm -rf "$out/share" "$out/bin/bashbug"
'';
passthru = {
shellPath = "/bin/bash";
tests.static = pkgsStatic.bash;
};
meta = with lib; {
homepage = "https://www.gnu.org/software/bash/";
description =
"GNU Bourne-Again Shell, the de facto standard shell on Linux"
+ lib.optionalString interactive " (for interactive use)";
longDescription = ''
Bash is the shell, or command language interpreter, that will
appear in the GNU operating system. Bash is an sh-compatible
shell that incorporates useful features from the Korn shell
(ksh) and C shell (csh). It is intended to conform to the IEEE
POSIX P1003.2/ISO 9945.2 Shell and Tools standard. It offers
functional improvements over sh for both programming and
interactive use. In addition, most sh scripts can be run by
Bash without modification.
'';
license = licenses.gpl3Plus;
platforms = platforms.all;
# https://github.com/NixOS/nixpkgs/issues/333338
badPlatforms = [ lib.systems.inspect.patterns.isMinGW ];
maintainers = [ ];
mainProgram = "bash";
identifiers.cpeParts =
let
versionSplit = lib.split "p" version;
in
{
vendor = "gnu";
product = "bash";
version = lib.elemAt versionSplit 0;
update = lib.elemAt versionSplit 2;
};
};
}

View File

@@ -0,0 +1,7 @@
# Automatically generated by `update-patch-set.sh'; do not edit.
patch: [
(patch "001" "0zr8wgg1gb67vxn7ws971n1znrdinczymc688ndnpy2a6qs88q0z")
(patch "002" "009051z55plsy4jmmjdb3ys7li2jraynz99qg7n6a1qk025591g3")
(patch "003" "1vb0gnrkmz49rcfpxjcxy0v0k5278wrlkljk9gc20nizvk3xjigj")
]

View File

@@ -0,0 +1,15 @@
--- ./configure 2022-12-20 17:13:17.804045620 +0100
+++ ./configure-fixed 2022-12-20 17:16:00.444114824 +0100
@@ -21723,11 +21723,7 @@
solaris2*) LOCAL_CFLAGS=-DSOLARIS ;;
lynxos*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
- case "`uname -r`" in
- 1.*|2.[0123]*) : ;;
- *) printf "%s\n" "#define PGRP_PIPE 1" >>confdefs.h
- ;;
- esac ;;
+ printf "%s\n" "#define PGRP_PIPE 1" >>confdefs.h ;;
netbsd*|openbsd*) LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
freebsd*|midnightbsd*) LOCAL_CFLAGS='-DHEREDOC_PIPESIZE=4096' ;;
*qnx[67]*) LOCAL_LIBS="-lncurses" ;;

View File

@@ -0,0 +1,54 @@
#!/usr/bin/env nix-shell
#!nix-shell --pure -i bash -p wget -p gnupg -p cacert -p nix
# Update patch set for GNU Bash or Readline.
if [ $# -ne 2 ]
then
echo "Usage: $(basename "$0") PROJECT VERSION"
echo ""
echo "Update the patch set for PROJECT (one of \`bash' or \`readline') for"
echo "the given version (e.g., \`4.0'). Produce \`PROJECT-patches.nix'."
exit 1
fi
PROJECT="$1"
VERSION="$2"
DIR=$(dirname "$0")
VERSION_CONDENSED="$(echo "$VERSION" | sed -es/\\.//g)"
PATCH_LIST="$DIR/$PROJECT-$VERSION-patches.nix"
set -e
rm -vf "$PATCH_LIST"
# https://savannah.gnu.org/projects/bash/: Group Admins: Chet Ramey
# https://savannah.gnu.org/users/chet: Download GPG Key
wget "https://savannah.gnu.org/people/viewgpg.php?user_id=2590" -O gpgkey.asc
echo "db4041b4d3896b9f21250e6c29861958bd5d4781f521f06beda849a9ed79fae8 gpgkey.asc" > gpgkey.asc.sha256
sha256sum -c gpgkey.asc.sha256
gpg --import ./gpgkey.asc
rm gpgkey.asc{,.sha256}
( echo "# Automatically generated by \`$(basename "$0")'; do not edit." ; \
echo "" ; \
echo "patch: [" ) \
>> "$PATCH_LIST"
for i in {001..100}
do
wget -P "$DIR" "ftp.gnu.org/gnu/$PROJECT/$PROJECT-$VERSION-patches/$PROJECT$VERSION_CONDENSED-$i" || break
wget -P "$DIR" "ftp.gnu.org/gnu/$PROJECT/$PROJECT-$VERSION-patches/$PROJECT$VERSION_CONDENSED-$i.sig"
gpg --verify "$DIR/$PROJECT$VERSION_CONDENSED-$i.sig"
hash=$(nix-hash --flat --type sha256 --base32 "$DIR/$PROJECT$VERSION_CONDENSED-$i")
echo " (patch \"$i\" \"$hash\")" \
>> "$PATCH_LIST"
rm -f "$DIR/$PROJECT$VERSION_CONDENSED-$i"{,.sig}
done
echo "]" >> "$PATCH_LIST"
# bash interprets numbers starting with 0 as octals
echo "Got $((10#$i - 1)) patches."
echo "Patch list has been written to \`$PATCH_LIST'."