diff --git a/pkgs/by-name/am/amber-lang/fix_gnused_detection.patch b/pkgs/by-name/am/amber-lang/fix_gnused_detection.patch deleted file mode 100644 index a4d2e99ea729..000000000000 --- a/pkgs/by-name/am/amber-lang/fix_gnused_detection.patch +++ /dev/null @@ -1,29 +0,0 @@ -From cae2ad70d6202bc97623be8c7c123ee2736a4644 Mon Sep 17 00:00:00 2001 -From: aleksana -Date: Sun, 9 Mar 2025 21:19:27 +0800 -Subject: [PATCH] replace_regex: remove bash word boundary when detecting - gnused - -Bash linked against C libraries other than GLibc may not support GNU -extensions of POSIX Extended Regular Regex. For example, - -> re='\bx'; [[ 'x' =~ $re ]] && echo "1" - -does not output the same result on Linux/GLibc and macOS. ---- - src/std/text.ab | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/std/text.ab b/src/std/text.ab -index fe071e33..82449a02 100644 ---- a/src/std/text.ab -+++ b/src/std/text.ab -@@ -19,7 +19,7 @@ pub fun replace_regex(source: Text, search: Text, replace: Text, extended: Bool - // GNU sed versions 4.0 through 4.2 support extended regex syntax, - // but only via the "-r" option; use that if the version information - // contains "GNU sed". -- $ re='\bCopyright\b.+\bFree Software Foundation\b'; [[ \$(sed --version 2>/dev/null) =~ \$re ]] $ -+ $ re='Copyright.+Free Software Foundation'; [[ \$(sed --version 2>/dev/null) =~ \$re ]] $ - let flag = status == 0 then "-r" else "-E" - return $ echo "{source}" | sed "{flag}" -e "s/{search}/{replace}/g" $ - } else { diff --git a/pkgs/by-name/am/amber-lang/fix_word_boundaries.patch b/pkgs/by-name/am/amber-lang/fix_word_boundaries.patch new file mode 100644 index 000000000000..ec73631eccae --- /dev/null +++ b/pkgs/by-name/am/amber-lang/fix_word_boundaries.patch @@ -0,0 +1,38 @@ +From efdbecaf721ccb217ece34a5105eaac68e27aa51 Mon Sep 17 00:00:00 2001 +From: Max Karou +Date: Sun, 4 Jan 2026 01:47:51 +0100 +Subject: [PATCH] sed_version: remove word boundary assertions + +Word boundary assertions (\b) are GNU regex extensions that may fail +on systems using non-glibc C libraries (e.g., musl, macOS). + +This was previously fixed in replace_regex() via NixOS/nixpkgs#388412, +which was subsequently upstreamed in amber-lang/amber#686. + +Changes in amber-lang/amber#717 reintroduced the same portability issue. +--- + src/std/text.ab | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/std/text.ab b/src/std/text.ab +index 5f2d935..a5dac3f 100644 +--- a/src/std/text.ab ++++ b/src/std/text.ab +@@ -51,12 +51,12 @@ const SED_VERSION_BUSYBOX = 2 + fun sed_version(): Int { + // We can't match against a word "GNU" because + // alpine's busybox sed returns "This is not GNU sed version" +- trust $ re='\bCopyright\b.+\bFree Software Foundation\b'; [[ \$(sed --version 2>/dev/null) =~ \$re ]] $ ++ trust $ re='Copyright.+Free Software Foundation'; [[ \$(sed --version 2>/dev/null) =~ \$re ]] $ + if status == 0 { + return SED_VERSION_GNU + } + // On BSD single `sed` waits for stdin. We must use `sed --help` to avoid this. +- trust $ re='\bBusyBox\b'; [[ \$(sed --help 2>&1) =~ \$re ]] $ ++ trust $ re='BusyBox'; [[ \$(sed --help 2>&1) =~ \$re ]] $ + if status == 0 { + return SED_VERSION_BUSYBOX + } +-- +2.51.2 + diff --git a/pkgs/by-name/am/amber-lang/package.nix b/pkgs/by-name/am/amber-lang/package.nix index e3180bf19415..a704fbd47fa1 100644 --- a/pkgs/by-name/am/amber-lang/package.nix +++ b/pkgs/by-name/am/amber-lang/package.nix @@ -15,21 +15,22 @@ rustPlatform.buildRustPackage rec { pname = "amber-lang"; - version = "0.4.0-alpha"; + version = "0.5.1-alpha"; src = fetchFromGitHub { owner = "amber-lang"; repo = "amber"; tag = version; - hash = "sha256-N9G/2G8+vrpr1/K7XLwgW+X2oAyAaz4qvN+EbLOCU1Q="; + hash = "sha256-v1uJe3vVGKXaZcQzdoYzu/bJKMQnS4IYET4QLPW+J8Y="; }; patches = [ - # https://github.com/amber-lang/amber/pull/686 - ./fix_gnused_detection.patch + # Upstreamed in #995, can be removed in >= 0.5.2 + # github.com/amber-lang/amber/pull/995 + ./fix_word_boundaries.patch ]; - cargoHash = "sha256-e5+L7Qgd6hyqT1Pb9X7bVtRr+xm428Z5J4hhsYNnGtU="; + cargoHash = "sha256-aXcxlmmDYLFbyRJYyGE1gbQMbdysHx4iWXsrUj10Eco="; preConfigure = '' substituteInPlace src/compiler.rs \