From 2b6bf950e71b6537c81597bcc102a339424270a2 Mon Sep 17 00:00:00 2001 From: cidkidnix Date: Fri, 23 Sep 2022 09:47:53 -0500 Subject: [PATCH 1/4] bash: fix android cross-compile --- pkgs/shells/bash/5.1.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/shells/bash/5.1.nix b/pkgs/shells/bash/5.1.nix index 7cd7fb6905cb..c0b7d87e71c8 100644 --- a/pkgs/shells/bash/5.1.nix +++ b/pkgs/shells/bash/5.1.nix @@ -33,7 +33,9 @@ stdenv.mkDerivation rec { sha256 = "1alv68wplnfdm6mh39hm57060xgssb9vqca4yr1cyva0c342n0fc"; }; - hardeningDisable = [ "format" ]; + hardeningDisable = [ "format" ] + # https://android.googlesource.com/platform/bionic/+/1342527b5791a53bf441322ab9adf41c8e060a1e%5E2..1342527b5791a53bf441322ab9adf41c8e060a1e/ + ++ optional (stdenv.hostPlatform.useAndroidPrebuilt or false) "fortify"; outputs = [ "out" "dev" "man" "doc" "info" ]; From 2870a5e506c82e538e591e96bd1f1f6c8aafd6c1 Mon Sep 17 00:00:00 2001 From: Dylan Green <67574902+cidkidnix@users.noreply.github.com> Date: Fri, 23 Sep 2022 14:07:04 -0500 Subject: [PATCH 2/4] match libc, instead of useAndroidPrebuilt Co-authored-by: John Ericson --- pkgs/shells/bash/5.1.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/shells/bash/5.1.nix b/pkgs/shells/bash/5.1.nix index c0b7d87e71c8..d6ec8268ea68 100644 --- a/pkgs/shells/bash/5.1.nix +++ b/pkgs/shells/bash/5.1.nix @@ -35,7 +35,7 @@ stdenv.mkDerivation rec { hardeningDisable = [ "format" ] # https://android.googlesource.com/platform/bionic/+/1342527b5791a53bf441322ab9adf41c8e060a1e%5E2..1342527b5791a53bf441322ab9adf41c8e060a1e/ - ++ optional (stdenv.hostPlatform.useAndroidPrebuilt or false) "fortify"; + ++ optional (stdenv.hostPlatform.libc == "bionic") "fortify"; outputs = [ "out" "dev" "man" "doc" "info" ]; From 0bf33f0e83d771f2ff819c543df2061a48e06d4d Mon Sep 17 00:00:00 2001 From: cidkidnix Date: Fri, 23 Sep 2022 14:50:09 -0500 Subject: [PATCH 3/4] bash: make android comment more clear --- pkgs/shells/bash/5.1.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/shells/bash/5.1.nix b/pkgs/shells/bash/5.1.nix index d6ec8268ea68..05f7ba850b80 100644 --- a/pkgs/shells/bash/5.1.nix +++ b/pkgs/shells/bash/5.1.nix @@ -34,7 +34,8 @@ stdenv.mkDerivation rec { }; hardeningDisable = [ "format" ] - # https://android.googlesource.com/platform/bionic/+/1342527b5791a53bf441322ab9adf41c8e060a1e%5E2..1342527b5791a53bf441322ab9adf41c8e060a1e/ + # 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 ++ optional (stdenv.hostPlatform.libc == "bionic") "fortify"; outputs = [ "out" "dev" "man" "doc" "info" ]; From db31db7e84a0546882e92a4c4d47de286d2a476e Mon Sep 17 00:00:00 2001 From: cidkidnix Date: Thu, 29 Sep 2022 08:51:21 -0500 Subject: [PATCH 4/4] bash: give bionic file with comment about "fortify" --- pkgs/shells/bash/5.1.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/shells/bash/5.1.nix b/pkgs/shells/bash/5.1.nix index 05f7ba850b80..390dab12c947 100644 --- a/pkgs/shells/bash/5.1.nix +++ b/pkgs/shells/bash/5.1.nix @@ -36,6 +36,7 @@ stdenv.mkDerivation rec { 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 ++ optional (stdenv.hostPlatform.libc == "bionic") "fortify"; outputs = [ "out" "dev" "man" "doc" "info" ];