--- ../submitted-exec_filename.diff.orig 2017-09-11 09:28:18.000000000 +0200 +++ ../submitted-exec_filename.diff 2017-09-11 09:22:09.000000000 +0200 @@ -199,16 +199,43 @@ =================================================================== --- glibc-2.24-17.1x.orig/sysdeps/mach/hurd/execve.c +++ glibc-2.24-17.1x/sysdeps/mach/hurd/execve.c -@@ -31,7 +31,8 @@ __execve (const char *file_name, char *c +@@ -19,23 +19,32 @@ + #include + #include + +-/* Replace the current process, executing FILE_NAME with arguments ARGV and +- environment ENVP. ARGV and ENVP are terminated by NULL pointers. */ ++/* Replace the current process, executing FILENAME, a canonicalized ++ absolute pathname from FILE_NAME, with arguments ARGV and ++ environment ENVP. ARGV and ENVP are terminated by NULL ++ pointers. */ + int + __execve (const char *file_name, char *const argv[], char *const envp[]) + { + error_t err; +- file_t file = __file_name_lookup (file_name, O_EXEC, 0); ++ char *filename = NULL; + ++ filename = realpath (file_name, NULL); ++ if (filename == NULL) ++ return -1; ++ ++ file_t file = __file_name_lookup (filename, O_EXEC, 0); + if (file == MACH_PORT_NULL) return -1; /* Hopefully this will not return. */ - err = _hurd_exec (__mach_task_self (), file, argv, envp); + err = _hurd_exec_file_name (__mach_task_self (), file, -+ file_name, argv, envp); ++ filename, argv, envp); /* Oh well. Might as well be tidy. */ __mach_port_deallocate (__mach_task_self (), file); + ++ free (filename); + return __hurd_fail (err); + } + Index: glibc-2.24-17.1x/sysdeps/mach/hurd/fexecve.c =================================================================== --- glibc-2.24-17.1x.orig/sysdeps/mach/hurd/fexecve.c @@ -268,16 +295,31 @@ except that all errors will be detected here (in the parent process) and return proper errno codes rather than the child dying with 127. -@@ -546,7 +548,7 @@ __spawni (pid_t *pid, const char *file, +@@ -545,8 +547,21 @@ __spawni (pid_t *pid, const char *file, + etc) can be observed before what errors. */ if ((xflags & SPAWN_XFLAGS_USE_PATH) == 0 || strchr (file, '/') != NULL) - /* The FILE parameter is actually a path. */ +- /* The FILE parameter is actually a path. */ - err = child_lookup (file, O_EXEC, 0, &execfile); -+ err = child_lookup (filename = file, O_EXEC, 0, &execfile); ++ { ++ /* The FILE parameter is actually a path. */ ++ ++ /* path is not absolute */ ++ if (strchr (file, '/') == NULL) ++ { ++ char *file_name = realpath (file, NULL); ++ if (file_name == NULL) ++ return -1; ++ err = child_lookup (filename = file_name, O_EXEC, 0, &execfile); ++ free (file_name); ++ } ++ else ++ err = child_lookup (filename = file, O_EXEC, 0, &execfile); ++ } else { /* We have to search for FILE on the path. */ -@@ -573,20 +575,18 @@ __spawni (pid_t *pid, const char *file, +@@ -573,20 +588,18 @@ __spawni (pid_t *pid, const char *file, p = path; do { @@ -301,7 +343,7 @@ switch (err) { case EACCES: -@@ -623,14 +623,27 @@ __spawni (pid_t *pid, const char *file, +@@ -623,14 +636,27 @@ __spawni (pid_t *pid, const char *file, inline error_t exec (file_t file) {