Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wofi: do not follow symlinks in PATH #95984

Merged
merged 1 commit into from
Aug 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkgs/applications/misc/wofi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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*
'';
Expand Down
39 changes: 39 additions & 0 deletions pkgs/applications/misc/wofi/do_not_follow_symlinks.patch
Original file line number Diff line number Diff line change
@@ -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);
}