summary refs log tree commit diff
diff options
context:
space:
mode:
authorGabriel Ebner <gebner@gebner.org>2020-08-22 13:41:01 +0200
committerGabriel Ebner <gebner@gebner.org>2020-08-22 14:01:05 +0200
commit9b742a6a1bcecd51332fecd56bb4757f74f34793 (patch)
tree0d3c70a4348a157d5a30642299b4cad0a8cbc535
parent280147c510a31ff0356b8a7d089b991520dc20ef (diff)
downloadnixpkgs-9b742a6a1bcecd51332fecd56bb4757f74f34793.tar
nixpkgs-9b742a6a1bcecd51332fecd56bb4757f74f34793.tar.gz
nixpkgs-9b742a6a1bcecd51332fecd56bb4757f74f34793.tar.bz2
nixpkgs-9b742a6a1bcecd51332fecd56bb4757f74f34793.tar.lz
nixpkgs-9b742a6a1bcecd51332fecd56bb4757f74f34793.tar.xz
nixpkgs-9b742a6a1bcecd51332fecd56bb4757f74f34793.tar.zst
nixpkgs-9b742a6a1bcecd51332fecd56bb4757f74f34793.zip
wofi: do not follow symlinks in PATH
-rw-r--r--pkgs/applications/misc/wofi/default.nix5
-rw-r--r--pkgs/applications/misc/wofi/do_not_follow_symlinks.patch39
2 files changed, 44 insertions, 0 deletions
diff --git a/pkgs/applications/misc/wofi/default.nix b/pkgs/applications/misc/wofi/default.nix
index 69ec8fffaa1..4aeff6c9ec8 100644
--- a/pkgs/applications/misc/wofi/default.nix
+++ b/pkgs/applications/misc/wofi/default.nix
@@ -13,6 +13,11 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config meson ninja wrapGAppsHook installShellFiles ];
   buildInputs = [ wayland gtk3 ];
 
+  patches = [
+    # https://todo.sr.ht/~scoopta/wofi/121
+    ./do_not_follow_symlinks.patch
+  ];
+
   postInstall = ''
     installManPage man/wofi*
   '';
diff --git a/pkgs/applications/misc/wofi/do_not_follow_symlinks.patch b/pkgs/applications/misc/wofi/do_not_follow_symlinks.patch
new file mode 100644
index 00000000000..f917c4c1685
--- /dev/null
+++ b/pkgs/applications/misc/wofi/do_not_follow_symlinks.patch
@@ -0,0 +1,39 @@
+diff -r 3414ab984249 modes/run.c
+--- a/modes/run.c	Tue Aug 11 19:07:49 2020 -0700
++++ b/modes/run.c	Sat Aug 22 13:39:52 2020 +0200
+@@ -91,23 +91,10 @@
+ 
+ 	char* path = strdup(getenv("PATH"));
+ 
+-	struct map* paths = map_init();
+-
+ 	char* save_ptr;
+ 	char* str = strtok_r(path, ":", &save_ptr);
+ 	do {
+ 
+-		str = realpath(str, NULL);
+-		if(str == NULL) {
+-			continue;
+-		}
+-		if(map_contains(paths, str)) {
+-			free(str);
+-			continue;
+-		}
+-
+-		map_put(paths, str, "true");
+-
+ 		DIR* dir = opendir(str);
+ 		if(dir == NULL) {
+ 			continue;
+@@ -132,11 +119,9 @@
+ 			}
+ 			free(full_path);
+ 		}
+-		free(str);
+ 		closedir(dir);
+ 	} while((str = strtok_r(NULL, ":", &save_ptr)) != NULL);
+ 	free(path);
+-	map_free(paths);
+ 	map_free(cached);
+ 	map_free(entries);
+ }