git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #95984 from gebner/wofi_do_not_follow_symlink

wofi: do not follow symlinks in PATH

commit9562573d26bd95f1486d7df93fc036d16c94c6c3 authorGabriel Ebner <gebner@gebner.org> dateSat 22 Aug 2020, 18:19 (6 years ago) parent50269599b742a6
2 files changed+44
pkgs/applications/misc/wofi/default.nix+5 pkgs/applications/misc/wofi/do_not_follow_symlinks.patch+39
pkgs/applications/misc/wofi/default.nix+5
@@ -13,6 +13,11 @@ stdenv.mkDerivation rec {
1313 nativeBuildInputs = [ pkg-config meson ninja wrapGAppsHook installShellFiles ];
1414 buildInputs = [ wayland gtk3 ];
1515
16+ patches = [
17+ # https://todo.sr.ht/~scoopta/wofi/121
18+ ./do_not_follow_symlinks.patch
19+ ];
20+
1621 postInstall = ''
1722 installManPage man/wofi*
1823 '';
pkgs/applications/misc/wofi/do_not_follow_symlinks.patchnew file+39
@@ -0,0 +1,39 @@
1+diff -r 3414ab984249 modes/run.c
2+--- a/modes/run.c Tue Aug 11 19:07:49 2020 -0700
3++++ b/modes/run.c Sat Aug 22 13:39:52 2020 +0200
4+@@ -91,23 +91,10 @@
5+
6+ char* path = strdup(getenv("PATH"));
7+
8+- struct map* paths = map_init();
9+-
10+ char* save_ptr;
11+ char* str = strtok_r(path, ":", &save_ptr);
12+ do {
13+
14+- str = realpath(str, NULL);
15+- if(str == NULL) {
16+- continue;
17+- }
18+- if(map_contains(paths, str)) {
19+- free(str);
20+- continue;
21+- }
22+-
23+- map_put(paths, str, "true");
24+-
25+ DIR* dir = opendir(str);
26+ if(dir == NULL) {
27+ continue;
28+@@ -132,11 +119,9 @@
29+ }
30+ free(full_path);
31+ }
32+- free(str);
33+ closedir(dir);
34+ } while((str = strtok_r(NULL, ":", &save_ptr)) != NULL);
35+ free(path);
36+- map_free(paths);
37+ map_free(cached);
38+ map_free(entries);
39+ }