--- a/debian/patches/hurd-i386/submitted-exec_filename.diff.orig 2017-08-20 13:48:36.000000000 +0200 +++ b/debian/patches/hurd-i386/submitted-exec_filename.diff 2017-09-14 13:45:51.000000000 +0200 @@ -33,8 +33,10 @@ sysdeps/mach/hurd/spawni.c | 59 ++++++++++++++++++++++++++------------------ 8 files changed, 102 insertions(+), 43 deletions(-) ---- a/hurd/Versions -+++ b/hurd/Versions +Index: glibc-2.24-17.2/hurd/Versions +=================================================================== +--- glibc-2.24-17.2.orig/hurd/Versions ++++ glibc-2.24-17.2/hurd/Versions @@ -140,6 +140,14 @@ libc { _hurd_sigstate_unlock; _hurd_sigstate_delete; @@ -50,8 +52,10 @@ HURD_CTHREADS_0.3 { # weak refs to libthreads functions that libc calls iff libthreads in use ---- a/hurd/Makefile -+++ b/hurd/Makefile +Index: glibc-2.24-17.2/hurd/Makefile +=================================================================== +--- glibc-2.24-17.2.orig/hurd/Makefile ++++ glibc-2.24-17.2/hurd/Makefile @@ -32,8 +32,8 @@ user-interfaces := $(addprefix hurd/,\ auth auth_request auth_reply startup \ process process_request \ @@ -63,9 +67,11 @@ login password pfinet \ ) server-interfaces := hurd/msg faultexc ---- a/hurd/hurd.h -+++ b/hurd/hurd.h -@@ -245,12 +245,20 @@ extern FILE *fopenport (io_t port, const +Index: glibc-2.24-17.2/hurd/hurd.h +=================================================================== +--- glibc-2.24-17.2.orig/hurd/hurd.h ++++ glibc-2.24-17.2/hurd/hurd.h +@@ -241,12 +241,20 @@ extern FILE *fopenport (io_t port, const extern FILE *__fopenport (io_t port, const char *mode); @@ -88,8 +94,10 @@ /* Inform the proc server we have exited with STATUS, and kill the ---- a/hurd/hurdexec.c -+++ b/hurd/hurdexec.c +Index: glibc-2.24-17.2/hurd/hurdexec.c +=================================================================== +--- glibc-2.24-17.2.orig/hurd/hurdexec.c ++++ glibc-2.24-17.2/hurd/hurdexec.c @@ -25,16 +25,37 @@ #include #include @@ -187,20 +195,56 @@ +} +compat_symbol (libc, __hurd_exec_file_name_2_13, _hurd_exec_file_name, GLIBC_2_13_DEBIAN_33); +#endif ---- a/sysdeps/mach/hurd/execve.c -+++ b/sysdeps/mach/hurd/execve.c -@@ -31,7 +31,8 @@ __execve (const char *file_name, char *c +Index: glibc-2.24-17.2/sysdeps/mach/hurd/execve.c +=================================================================== +--- glibc-2.24-17.2.orig/sysdeps/mach/hurd/execve.c ++++ glibc-2.24-17.2/sysdeps/mach/hurd/execve.c +@@ -18,24 +18,36 @@ + #include + #include + #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 path name of 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); + +- if (file == MACH_PORT_NULL) ++ char *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) ++ { ++ free (filename); ++ 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); ---- a/sysdeps/mach/hurd/fexecve.c -+++ b/sysdeps/mach/hurd/fexecve.c + ++ free (filename); + return __hurd_fail (err); + } + +Index: glibc-2.24-17.2/sysdeps/mach/hurd/fexecve.c +=================================================================== +--- glibc-2.24-17.2.orig/sysdeps/mach/hurd/fexecve.c ++++ glibc-2.24-17.2/sysdeps/mach/hurd/fexecve.c @@ -25,8 +25,9 @@ int fexecve (int fd, char *const argv[], char *const envp[]) @@ -213,8 +257,10 @@ if (! err) err = EGRATUITOUS; return __hurd_fail (err); ---- a/sysdeps/mach/hurd/spawni.c -+++ b/sysdeps/mach/hurd/spawni.c +Index: glibc-2.24-17.2/sysdeps/mach/hurd/spawni.c +=================================================================== +--- glibc-2.24-17.2.orig/sysdeps/mach/hurd/spawni.c ++++ glibc-2.24-17.2/sysdeps/mach/hurd/spawni.c @@ -29,6 +29,7 @@ #include #include @@ -227,7 +273,7 @@ { pid_t new_pid; char *path, *p, *name; -+ const char *filename; ++ const char *filename, *file_name; size_t len; size_t pathlen; short int flags; @@ -254,16 +300,23 @@ 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,13 @@ __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. */ ++ file_name = realpath (file, NULL); ++ if (file_name == NULL) ++ goto out; ++ err = child_lookup (filename = file_name, 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 +580,18 @@ __spawni (pid_t *pid, const char *file, p = path; do { @@ -287,7 +340,7 @@ switch (err) { case EACCES: -@@ -623,14 +623,27 @@ __spawni (pid_t *pid, const char *file, +@@ -623,14 +628,27 @@ __spawni (pid_t *pid, const char *file, inline error_t exec (file_t file) {