wofi: do not follow symlinks in PATH

+44
+5
pkgs/applications/misc/wofi/default.nix
··· 13 13 nativeBuildInputs = [ pkg-config meson ninja wrapGAppsHook installShellFiles ]; 14 14 buildInputs = [ wayland gtk3 ]; 15 15 16 + patches = [ 17 + # https://todo.sr.ht/~scoopta/wofi/121 18 + ./do_not_follow_symlinks.patch 19 + ]; 20 + 16 21 postInstall = '' 17 22 installManPage man/wofi* 18 23 '';
+39
pkgs/applications/misc/wofi/do_not_follow_symlinks.patch
··· 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 + }