summary refs log tree commit diff
diff options
context:
space:
mode:
authorYurii Rashkovskii <yrashk@gmail.com>2017-11-14 11:21:45 +0700
committerYurii Rashkovskii <yrashk@gmail.com>2017-11-14 16:15:58 +0700
commitedfdc1d81898a39a5be4b91f41b13ebe5e150b78 (patch)
tree6e4c57a31a0728cb7b1d88337e47f170a0f60288
parentce8dea6bdd18846579d32d0bcec94717bf616b41 (diff)
downloadnixlib-edfdc1d81898a39a5be4b91f41b13ebe5e150b78.tar
nixlib-edfdc1d81898a39a5be4b91f41b13ebe5e150b78.tar.gz
nixlib-edfdc1d81898a39a5be4b91f41b13ebe5e150b78.tar.bz2
nixlib-edfdc1d81898a39a5be4b91f41b13ebe5e150b78.tar.lz
nixlib-edfdc1d81898a39a5be4b91f41b13ebe5e150b78.tar.xz
nixlib-edfdc1d81898a39a5be4b91f41b13ebe5e150b78.tar.zst
nixlib-edfdc1d81898a39a5be4b91f41b13ebe5e150b78.zip
fish-foreign-env: suppress additional harmless warnings
As per #30645, fish with fish-foreign-env prints this
(harmless) warning:

```
set: Tried to change the read-only variable “_”
```

This patch was developed by @rnhmjoj in the aforementioned
issue discussion
-rw-r--r--pkgs/shells/fish-foreign-env/default.nix2
-rw-r--r--pkgs/shells/fish-foreign-env/suppress-harmless-warnings.patch (renamed from pkgs/shells/fish-foreign-env/hide-path-warnings.patch)17
2 files changed, 13 insertions, 6 deletions
diff --git a/pkgs/shells/fish-foreign-env/default.nix b/pkgs/shells/fish-foreign-env/default.nix
index 76a979bcda1b..445e961c6499 100644
--- a/pkgs/shells/fish-foreign-env/default.nix
+++ b/pkgs/shells/fish-foreign-env/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
         -i $out/share/fish-foreign-env/functions/*
   '';
 
-  patches = [ ./hide-path-warnings.patch ];
+  patches = [ ./suppress-harmless-warnings.patch ];
 
   meta = with stdenv.lib; {
     description = "A foreign environment interface for Fish shell";
diff --git a/pkgs/shells/fish-foreign-env/hide-path-warnings.patch b/pkgs/shells/fish-foreign-env/suppress-harmless-warnings.patch
index b7ac4edc5189..5e4569f0a15c 100644
--- a/pkgs/shells/fish-foreign-env/hide-path-warnings.patch
+++ b/pkgs/shells/fish-foreign-env/suppress-harmless-warnings.patch
@@ -1,16 +1,23 @@
 diff --git a/functions/fenv.apply.fish b/functions/fenv.apply.fish
-index 34a25e3..6837e7f 100644
+index 34a25e3..3d94135 100644
 --- a/functions/fenv.apply.fish
 +++ b/functions/fenv.apply.fish
-@@ -30,8 +30,9 @@ function fenv.apply
+@@ -27,11 +27,17 @@ function fenv.apply
+     for variable in $variables
+         set key (echo $variable | sed 's/=.*//')
+         set value (echo $variable | sed 's/[^=]*=//')
++        set ignore PATH _
  
          if test "$key" = 'PATH'
            set value (echo $value | tr ':' '\n')
+         end
+ 
+-        set -g -x $key $value
++        if contains $key $ignore
 +          set -g -x $key $value ^/dev/null
 +        else
 +          set -g -x $key $value
-         end
--
--        set -g -x $key $value
++        end
++
      end
  end