Skip to content

Commit f7f6704

Browse files
andy5995claude
andcommitted
bugfix: use execvp to find mv at runtime, fixes AppImage portability
Using execvp("mv", ...) searches PATH at runtime instead of compiling in a build-time path, which also fixes the NixOS case without needing Meson to discover mv. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 99ff455 commit f7f6704

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

meson.build

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ foreach h : check_headers
6161
endif
6262
endforeach
6363

64-
mv_prog = find_program('mv', required: true)
65-
add_project_arguments('-DMV_PATH="' + mv_prog.full_path() + '"', language: 'c')
66-
6764
localedir = join_paths(get_option('prefix'), get_option('localedir'))
6865
subdir('po')
6966

src/utils.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -517,16 +517,11 @@ safe_mv_via_exec(const char *src, const char *dst, int *out_errno)
517517

518518
if (pid == 0)
519519
{
520-
/* child: exec mv using path discovered by Meson */
521-
char *const argv_mv[] = {
522-
MV_PATH, /* argv[0] should match the executed path */
523-
(char *) src,
524-
(char *) dst,
525-
NULL
526-
};
527-
528-
execv(MV_PATH, argv_mv);
529-
_exit(127); /* only reached on execv failure */
520+
/* child: exec mv, searching PATH at runtime so this works on
521+
non-FHS systems (e.g. NixOS) and in AppImages */
522+
char *const argv_mv[] = { "mv", (char *) src, (char *) dst, NULL };
523+
execvp("mv", argv_mv);
524+
_exit(127); /* only reached on execvp failure */
530525
}
531526

532527

0 commit comments

Comments
 (0)