[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[glibc] 01/01: hurd: Use upstream-commited exec_paths patches



This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch sid
in repository glibc.

commit 75e0d7fd9ada54e6156fe31ce85baef6bcb79851
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Tue Jan 9 00:41:07 2018 +0000

    hurd: Use upstream-commited exec_paths patches
    
      * debian/patches/hurd-i386/submitted-exec_filename.diff: Update submitted
        patch into commited git-exec_filename.diff.
      * debian/patches/hurd-i386/local-exec_filename.diff: New patch to keep
        compatibility with previous submission.
      * debian/patches/hurd-i386/tg-io_select_timeout.diff: Refresh.
      * debian/control: Bump hurd-dev build-dependency to get exec_paths RPC
        definitions.
      * debian/libc0.3.symbols.hurd-i386: Update accordingly.
---
 debian/changelog                                   |   8 +
 debian/control                                     |   4 +-
 debian/control.in/main                             |   4 +-
 debian/libc0.3.symbols.hurd-i386                   |   4 +
 ...d-exec_filename.diff => git-exec_filename.diff} | 400 +++++++++------------
 debian/patches/hurd-i386/local-exec_filename.diff  | 126 +++++++
 debian/patches/hurd-i386/tg-io_select_timeout.diff |   6 +-
 debian/patches/series                              |   3 +-
 8 files changed, 315 insertions(+), 240 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 1062756..7df43ba 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,14 @@ glibc (2.26-3) UNRELEASED; urgency=medium
   [ Samuel Thibault ]
   * debian/patches/hurd-i386/submitted-malloc-setstate.diff: Disable for now, it
     actually introduces issues.
+  * debian/patches/hurd-i386/submitted-exec_filename.diff: Update submitted
+    patch into commited git-exec_filename.diff.
+  * debian/patches/hurd-i386/local-exec_filename.diff: New patch to keep
+    compatibility with previous submission.
+  * debian/patches/hurd-i386/tg-io_select_timeout.diff: Refresh.
+  * debian/control: Bump hurd-dev build-dependency to get exec_paths RPC
+    definitions.
+  * debian/libc0.3.symbols.hurd-i386: Update accordingly.
 
  -- Aurelien Jarno <aurel32@debian.org>  Sat, 06 Jan 2018 09:44:29 +0100
 
diff --git a/debian/control b/debian/control
index 75f8aef..9dc2598 100644
--- a/debian/control
+++ b/debian/control
@@ -6,8 +6,8 @@ Build-Depends: gettext, dpkg (>= 1.18.7), dpkg-dev (>= 1.17.14), xz-utils, file,
  linux-libc-dev (>= 3.9) [linux-any],
  libaudit-dev [linux-any], libcap-dev [linux-any], libselinux-dev [linux-any],
  mig (>= 1.5-3) [hurd-i386], gnumach-dev (>= 2:1.8+git20170102-1~) [hurd-i386],
- hurd-dev (>= 1:0.9.git20171119-2~) [hurd-i386] | hurd-headers-dev [hurd-i386],
- hurd-dev (>= 1:0.9.git20171119-2~) [hurd-i386] <!stage1> | libihash-dev [hurd-i386] <!stage1>,
+ hurd-dev (>= 1:0.9.git20171119-4~) [hurd-i386] | hurd-headers-dev [hurd-i386],
+ hurd-dev (>= 1:0.9.git20171119-4~) [hurd-i386] <!stage1> | libihash-dev [hurd-i386] <!stage1>,
  kfreebsd-kernel-headers [kfreebsd-any],
  binutils (>= 2.25),
  g++-7, g++-7-multilib [amd64 i386 kfreebsd-amd64 mips mipsel mipsn32 mipsn32el mips64 mips64el mipsr6 mipsr6el mipsn32r6 mipsn32r6el mips64r6 mips64r6el powerpc ppc64 s390x sparc sparc64 x32],
diff --git a/debian/control.in/main b/debian/control.in/main
index 45b16b0..f0f3029 100644
--- a/debian/control.in/main
+++ b/debian/control.in/main
@@ -6,8 +6,8 @@ Build-Depends: gettext, dpkg (>= 1.18.7), dpkg-dev (>= 1.17.14), xz-utils, file,
  linux-libc-dev (>= 3.9) [linux-any],
  libaudit-dev [linux-any], libcap-dev [linux-any], libselinux-dev [linux-any],
  mig (>= 1.5-3) [hurd-i386], gnumach-dev (>= 2:1.8+git20170102-1~) [hurd-i386],
- hurd-dev (>= 1:0.9.git20171119-2~) [hurd-i386] | hurd-headers-dev [hurd-i386],
- hurd-dev (>= 1:0.9.git20171119-2~) [hurd-i386] <!stage1> | libihash-dev [hurd-i386] <!stage1>,
+ hurd-dev (>= 1:0.9.git20171119-4~) [hurd-i386] | hurd-headers-dev [hurd-i386],
+ hurd-dev (>= 1:0.9.git20171119-4~) [hurd-i386] <!stage1> | libihash-dev [hurd-i386] <!stage1>,
  kfreebsd-kernel-headers [kfreebsd-any],
  binutils (>= 2.25),
  g++-7, g++-7-multilib [amd64 i386 kfreebsd-amd64 mips mipsel mipsn32 mipsn32el mips64 mips64el mipsr6 mipsr6el mipsn32r6 mipsn32r6el mips64r6 mips64r6el powerpc ppc64 s390x sparc sparc64 x32],
diff --git a/debian/libc0.3.symbols.hurd-i386 b/debian/libc0.3.symbols.hurd-i386
index 84b7744..3e84791 100644
--- a/debian/libc0.3.symbols.hurd-i386
+++ b/debian/libc0.3.symbols.hurd-i386
@@ -85,6 +85,7 @@ libhurduser.so.0.3 #PACKAGE# #MINVER#
  __dir_unlink@Base 2.11
  __exec_exec@Base 2.11
  __exec_exec_file_name@Base 2.13-33~
+ __exec_exec_paths@Base 2.26-3~
  __exec_init@Base 2.11
  __exec_setexecdata@Base 2.11
  __exec_startup_get_info@Base 2.11
@@ -95,6 +96,7 @@ libhurduser.so.0.3 #PACKAGE# #MINVER#
  __file_chown@Base 2.11
  __file_exec@Base 2.11
  __file_exec_file_name@Base 2.13-33~
+ __file_exec_paths@Base 2.26-3~
  __file_get_fs_options@Base 2.11
  __file_get_storage_info@Base 2.11
  __file_get_translator@Base 2.11
@@ -454,6 +456,7 @@ libhurduser.so.0.3 #PACKAGE# #MINVER#
  dir_unlink@Base 2.11
  exec_exec@Base 2.11
  exec_exec_file_name@Base 2.13-33~
+ exec_exec_paths@Base 2.26-3~
  exec_init@Base 2.11
  exec_setexecdata@Base 2.11
  exec_startup_get_info@Base 2.11
@@ -464,6 +467,7 @@ libhurduser.so.0.3 #PACKAGE# #MINVER#
  file_chown@Base 2.11
  file_exec@Base 2.11
  file_exec_file_name@Base 2.13-33~
+ file_exec_paths@Base 2.26-3~
  file_get_fs_options@Base 2.11
  file_get_storage_info@Base 2.11
  file_get_translator@Base 2.11
diff --git a/debian/patches/hurd-i386/submitted-exec_filename.diff b/debian/patches/hurd-i386/git-exec_filename.diff
similarity index 55%
rename from debian/patches/hurd-i386/submitted-exec_filename.diff
rename to debian/patches/hurd-i386/git-exec_filename.diff
index cbc08b7..8b8ac00 100644
--- a/debian/patches/hurd-i386/submitted-exec_filename.diff
+++ b/debian/patches/hurd-i386/git-exec_filename.diff
@@ -1,28 +1,29 @@
-2.13-33 dates when this was added
+From d1793416cf8bf6fccd42679a8ec30b0058823ab8 Mon Sep 17 00:00:00 2001
+From: Emilio Pozuelo Monfort <pochu27@gmail.com>
+Date: Sat, 22 May 2010 18:26:29 +0200
+Subject: [hurd,PATCH] Use the new file_exec_paths RPC
 
-TODO: _DEBIAN_ in versions however pose problem. Remove the _DEBIAN_ version
-once packages are rebuilt against 2.21.
+Pass the file paths of executable to the exec server, both relative and
+absolute, which exec needs to properly execute and avertise #!-scripts.
+Previously, the exec server tried to guess the name from argv[0] but argv[0]
+only contains the executable name by convention.
 
 2010-08-04  Emilio Pozuelo Monfort  <pochu27@gmail.com>
 2017-09-26  Svante Signell  <svante.signell@gmail.com>
-	* hurd/hurdexec.c (_hurd_exec): Deprecate it.
-	(_hurd_exec_file_name): New function.
-	* hurd/hurd.h (_hurd_exec): Deprecate it.
-	(_hurd_exec_file_name): Declare it.
-	* hurd/Versions: Export it.
-	* sysdeps/mach/hurd/execve.c: Use it.
-	* sysdeps/mach/hurd/fexecve.c: Likewise.
-	* sysdeps/mach/hurd/spawni.c: Likewise.
 
+	* hurd/hurdexec.c (_hurd_exec): Deprecate function.
+	(_hurd_exec_paths): New function.
+	* hurd/hurd.h (_hurd_exec): Deprecate function.
+	(_hurd_exec_paths): Declare function.
+	* hurd/Versions: Export _hurd_exec_paths.
+	* sysdeps/mach/hurd/execve.c: Include <stdlib.h> and <stdio.h>
+	(__execve): Use __getcwd to build absolute path, and use
+	_hurd_exec_paths instead of _hurd_exec.
+	* sysdeps/mach/hurd/spawni.c: Likewise.
+	* sysdeps/mach/hurd/fexecve.c: Use _hurd_exec_paths instead of
+	_hurd_exec.
 
-From d1793416cf8bf6fccd42679a8ec30b0058823ab8 Mon Sep 17 00:00:00 2001
-From: Emilio Pozuelo Monfort <pochu27@gmail.com>
-Date: Sat, 22 May 2010 18:26:29 +0200
-Subject: [PATCH] Use the new file_exec_file_name RPC
 
-Pass the file name of executable to the exec server, which it needs to
-execute #!-scripts.  Currently, the exec server tries to guess the name
-from argv[0] but argv[0] only contains the executable name by convention.
 ---
  hurd/Makefile               |    4 -
  hurd/Versions               |    8 +++
@@ -33,112 +34,52 @@ from argv[0] but argv[0] only contains the executable name by convention.
  sysdeps/mach/hurd/spawni.c  |  100 +++++++++++++++++++++++++++++++++-----------
  7 files changed, 184 insertions(+), 42 deletions(-)
 
---- a/hurd/Versions
-+++ b/hurd/Versions
-@@ -140,6 +140,14 @@ libc {
-     _hurd_sigstate_unlock;
-     _hurd_sigstate_delete;
-   }
-+  GLIBC_2.13_DEBIAN_33 {
-+    # "quasi-internal" functions
-+    _hurd_exec_file_name;
-+  }
-+  GLIBC_2.21 {
-+    # "quasi-internal" functions
-+    _hurd_exec_file_name;
-+  }
- 
-   HURD_CTHREADS_0.3 {
-     # weak refs to libthreads functions that libc calls iff libthreads in use
---- a/hurd/Makefile
-+++ b/hurd/Makefile
-@@ -32,8 +32,8 @@ user-interfaces		:= $(addprefix hurd/,\
- 				       auth auth_request auth_reply startup \
- 				       process process_request \
- 				       msg msg_reply msg_request \
--				       exec exec_startup crash interrupt \
--				       fs fsys io term tioctl socket ifsock \
-+				       exec exec_experimental exec_startup crash interrupt \
-+				       fs fs_experimental fsys io term tioctl socket ifsock \
- 				       login password pfinet \
- 				       )
- server-interfaces	:= hurd/msg faultexc
---- a/hurd/hurd.h
-+++ b/hurd/hurd.h
-@@ -241,12 +241,20 @@ extern FILE *fopenport (io_t port, const
- extern FILE *__fopenport (io_t port, const char *mode);
- 
- 
--/* Execute a file, replacing TASK's current program image.  */
-+/* Deprecated: use _hurd_exec_file_name instead.  */
- 
- extern error_t _hurd_exec (task_t task,
- 			   file_t file,
- 			   char *const argv[],
--			   char *const envp[]);
-+			   char *const envp[]) __attribute_deprecated__;
-+
-+/* Execute a file, replacing TASK's current program image.  */
-+
-+extern error_t _hurd_exec_file_name (task_t task,
-+				     file_t file,
-+				     const char *filename,
-+				     char *const argv[],
-+				     char *const envp[]);
- 
- 
- /* Inform the proc server we have exited with STATUS, and kill the
---- a/hurd/hurdexec.c
-+++ b/hurd/hurdexec.c
-@@ -25,16 +25,37 @@
- #include <hurd/fd.h>
- #include <hurd/signal.h>
- #include <hurd/id.h>
-+#include <hurd/fs_experimental.h>
- #include <assert.h>
- #include <argz.h>
+Index: glibc-2.26/hurd/hurdexec.c
+===================================================================
+--- glibc-2.26.orig/hurd/hurdexec.c
++++ glibc-2.26/hurd/hurdexec.c
+@@ -30,11 +30,30 @@
  
-+#include <shlib-compat.h>
-+
  /* Overlay TASK, executing FILE with arguments ARGV and environment ENVP.
     If TASK == mach_task_self (), some ports are dealloc'd by the exec server.
 -   ARGV and ENVP are terminated by NULL pointers.  */
 +   ARGV and ENVP are terminated by NULL pointers.
-+   Deprecated: use _hurd_exec_file_name instead.  */
++   Deprecated: use _hurd_exec_paths instead.  */
  error_t
  _hurd_exec (task_t task, file_t file,
  	    char *const argv[], char *const envp[])
  {
-+  return _hurd_exec_file_name (task, file, NULL, argv, envp);
++  return _hurd_exec_paths (task, file, NULL, NULL, argv, envp);
 +}
 +
 +link_warning (_hurd_exec,
-+	      "_hurd_exec is deprecated, use _hurd_exec_file_name instead");
++	      "_hurd_exec is deprecated, use _hurd_exec_paths instead");
 +
 +/* Overlay TASK, executing FILE with arguments ARGV and environment ENVP.
 +   If TASK == mach_task_self (), some ports are dealloc'd by the exec server.
-+   ARGV and ENVP are terminated by NULL pointers.  FILENAME is the path
-+   (either absolute or relative) to FILE.  Passing NULL, though possible,
++   ARGV and ENVP are terminated by NULL pointers.  PATH is the relative path to
++   FILE and ABSPATH is the absolute path to FILE. Passing NULL, though possible,
 +   should be avoided, since then the exec server may not know the path to
 +   FILE if FILE is a script, and will then pass /dev/fd/N to the
 +   interpreter.  */
 +error_t
-+__hurd_exec_file_name (task_t task, file_t file, const char *filename,
-+		      char *const argv[], char *const envp[])
++_hurd_exec_paths (task_t task, file_t file,
++		   const char *path, const char *abspath,
++		   char *const argv[], char *const envp[])
 +{
    error_t err;
    char *args, *env;
    size_t argslen, envlen;
-@@ -216,7 +237,7 @@ _hurd_exec (task_t task, file_t file,
+@@ -216,7 +235,7 @@ _hurd_exec (task_t task, file_t file,
        /* We have euid != svuid or egid != svgid.  POSIX.1 says that exec
  	 sets svuid = euid and svgid = egid.  So we must get a new auth
  	 port and reauthenticate everything with it.  We'll pass the new
 -	 ports in file_exec instead of our own ports.  */
-+	 ports in file_exec_file_name instead of our own ports.  */
++	 ports in file_exec_paths instead of our own ports.  */
  
        auth_t newauth;
  
-@@ -360,13 +381,27 @@ _hurd_exec (task_t task, file_t file,
+@@ -360,13 +379,28 @@ _hurd_exec (task_t task, file_t file,
        if (__sigismember (&_hurdsig_traced, SIGKILL))
  	flags |= EXEC_SIGTRAP;
  #endif
@@ -149,16 +90,17 @@ from argv[0] but argv[0] only contains the executable name by convention.
 -			 ints, INIT_INT_MAX,
 -			 please_dealloc, pdp - please_dealloc,
 -			 &_hurd_msgport, task == __mach_task_self () ? 1 : 0);
-+      err = __file_exec_file_name (file, task, flags,
-+				   filename ? filename : "",
-+				   args, argslen, env, envlen,
-+				   dtable, MACH_MSG_TYPE_COPY_SEND, dtablesize,
-+				   ports, MACH_MSG_TYPE_COPY_SEND,
-+				   _hurd_nports,
-+				   ints, INIT_INT_MAX,
-+				   please_dealloc, pdp - please_dealloc,
-+				   &_hurd_msgport,
-+				   task == __mach_task_self () ? 1 : 0);
++      err = __file_exec_paths (file, task, flags,
++			       path ? path : "",
++			       abspath ? abspath : "",
++			       args, argslen, env, envlen,
++			       dtable, MACH_MSG_TYPE_COPY_SEND, dtablesize,
++			       ports, MACH_MSG_TYPE_COPY_SEND,
++			       _hurd_nports,
++			       ints, INIT_INT_MAX,
++			       please_dealloc, pdp - please_dealloc,
++			       &_hurd_msgport,
++			       task == __mach_task_self () ? 1 : 0);
 +      /* Fall back for backwards compatibility.  This can just be removed
 +         when __file_exec goes away.  */
 +      if (err == MIG_BAD_ID)
@@ -173,22 +115,53 @@ from argv[0] but argv[0] only contains the executable name by convention.
      }
  
    /* Release references to the standard ports.  */
-@@ -401,3 +436,13 @@ _hurd_exec (task_t task, file_t file,
-   free (env);
-   return err;
- }
-+versioned_symbol (libc, __hurd_exec_file_name, _hurd_exec_file_name, GLIBC_2_21);
-+#if SHLIB_COMPAT (libc, GLIBC_2_13, GLIBC_2_21)
-+error_t
-+__hurd_exec_file_name_2_13 (task_t task, file_t file, const char *filename,
-+		      char *const argv[], char *const envp[])
-+{
-+  return __hurd_exec_file_name (task, file, filename, argv, envp);
-+}
-+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
+Index: glibc-2.26/hurd/hurd.h
+===================================================================
+--- glibc-2.26.orig/hurd/hurd.h
++++ glibc-2.26/hurd/hurd.h
+@@ -240,12 +240,21 @@ extern FILE *fopenport (io_t port, const
+ extern FILE *__fopenport (io_t port, const char *mode);
+ 
+ 
+-/* Execute a file, replacing TASK's current program image.  */
++/* Deprecated: use _hurd_exec_paths instead.  */
+ 
+ extern error_t _hurd_exec (task_t task,
+ 			   file_t file,
+ 			   char *const argv[],
+-			   char *const envp[]);
++			   char *const envp[]) __attribute_deprecated__;
++
++/* Execute a file, replacing TASK's current program image.  */
++
++extern error_t _hurd_exec_paths (task_t task,
++				 file_t file,
++				 const char *path,
++				 const char *abspath,
++				 char *const argv[],
++				 char *const envp[]);
+ 
+ 
+ /* Inform the proc server we have exited with STATUS, and kill the
+Index: glibc-2.26/hurd/Versions
+===================================================================
+--- glibc-2.26.orig/hurd/Versions
++++ glibc-2.26/hurd/Versions
+@@ -140,6 +140,10 @@ libc {
+     _hurd_sigstate_unlock;
+     _hurd_sigstate_delete;
+   }
++  GLIBC_2.27 {
++    # "quasi-internal" functions
++    _hurd_exec_paths;
++  }
+ 
+   HURD_CTHREADS_0.3 {
+     # weak refs to libthreads functions that libc calls iff libthreads in use
+Index: glibc-2.26/sysdeps/mach/hurd/execve.c
+===================================================================
+--- glibc-2.26.orig/sysdeps/mach/hurd/execve.c
++++ glibc-2.26/sysdeps/mach/hurd/execve.c
 @@ -18,6 +18,8 @@
  #include <unistd.h>
  #include <hurd.h>
@@ -198,13 +171,13 @@ from argv[0] but argv[0] only contains the executable name by convention.
  
  /* Replace the current process, executing FILE_NAME with arguments ARGV and
     environment ENVP.  ARGV and ENVP are terminated by NULL pointers.  */
-@@ -25,17 +27,45 @@ int
+@@ -25,16 +27,46 @@ 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 *concat_name = NULL;
-+  const char *abs_name;
++  const char *abs_path;
  
 +  file_t file = __file_name_lookup (file_name, O_EXEC, 0);
    if (file == MACH_PORT_NULL)
@@ -212,8 +185,8 @@ from argv[0] but argv[0] only contains the executable name by convention.
  
 +  if (file_name[0] == '/')
 +    {
-+      /* Absolute path */
-+      abs_name = file_name;
++      /* Already an absolute path */
++      abs_path = file_name;
 +    }
 +  else
 +    {
@@ -224,6 +197,7 @@ from argv[0] but argv[0] only contains the executable name by convention.
 +	  __mach_port_deallocate (__mach_task_self (), file);
 +	  return -1;
 +	}
++
 +      int res = __asprintf (&concat_name, "%s/%s", cwd, file_name);
 +      free (cwd);
 +      if (res == -1)
@@ -231,37 +205,25 @@ from argv[0] but argv[0] only contains the executable name by convention.
 +	  __mach_port_deallocate (__mach_task_self (), file);
 +	  return -1;
 +	}
-+      abs_name = concat_name;
++
++      abs_path = concat_name;
 +    }
 +
    /* Hopefully this will not return.  */
 -  err = _hurd_exec (__mach_task_self (), file, argv, envp);
-+  err = _hurd_exec_file_name (__mach_task_self (), file,
-+			      abs_name, argv, envp);
++  err = _hurd_exec_paths (__mach_task_self (), file,
++			  file_name, abs_path, argv, envp);
  
    /* Oh well.  Might as well be tidy.  */
    __mach_port_deallocate (__mach_task_self (), file);
- 
 +  free (concat_name);
-   return __hurd_fail (err);
- }
  
---- a/sysdeps/mach/hurd/fexecve.c
-+++ b/sysdeps/mach/hurd/fexecve.c
-@@ -25,8 +25,9 @@
- int
- fexecve (int fd, char *const argv[], char *const envp[])
- {
--  error_t err = HURD_DPORT_USE (fd, _hurd_exec (__mach_task_self (), port,
--						argv, envp));
-+  error_t err = HURD_DPORT_USE (fd, _hurd_exec_file_name (__mach_task_self (),
-+							  port, NULL,
-+							  argv, envp));
-   if (! err)
-     err = EGRATUITOUS;
    return __hurd_fail (err);
---- a/sysdeps/mach/hurd/spawni.c
-+++ b/sysdeps/mach/hurd/spawni.c
+ }
+Index: glibc-2.26/sysdeps/mach/hurd/spawni.c
+===================================================================
+--- glibc-2.26.orig/sysdeps/mach/hurd/spawni.c
++++ glibc-2.26/sysdeps/mach/hurd/spawni.c
 @@ -22,6 +22,7 @@
  #include <spawn.h>
  #include <stdlib.h>
@@ -270,26 +232,15 @@ from argv[0] but argv[0] only contains the executable name by convention.
  #include <unistd.h>
  #include <hurd.h>
  #include <hurd/signal.h>
-@@ -29,6 +30,7 @@
- #include <hurd/id.h>
- #include <hurd/lookup.h>
- #include <hurd/resource.h>
-+#include <hurd/fs_experimental.h>
- #include <assert.h>
- #include <argz.h>
- #include "spawn_int.h"
-@@ -44,8 +46,9 @@ __spawni (pid_t *pid, const char *file,
+@@ -44,6 +45,8 @@ __spawni (pid_t *pid, const char *file,
  {
    pid_t new_pid;
    char *path, *p, *name;
--  size_t len;
--  size_t pathlen;
-+  char *concat_name = NULL, *filename;
++  char *concat_name = NULL, *relpath, *abspath;
 +  int res;
-+  size_t len, pathlen;
+   size_t len;
+   size_t pathlen;
    short int flags;
- 
-   /* The generic POSIX.1 implementation of posix_spawn uses fork and exec.
 @@ -59,14 +62,14 @@ __spawni (pid_t *pid, const char *file,
       that remains visible after an exec is registration with the proc
       server, and the inheritance of various values and ports.  All those
@@ -302,95 +253,62 @@ from argv[0] but argv[0] only contains the executable name by convention.
 -     FILE_ACTIONS), and make the file_exec RPC on the requested executable
 -     file with the child process's task port rather than our own.  This
 -     should be indistinguishable from the fork + exec implementation,
-+     file_exec_file_name RPC by an exec call.  So we do the proc server
++     file_exec_paths RPC by an exec call.  So we do the proc server
 +     registration here, following the model of fork (see fork.c).  We then
 +     collect up the inherited values and ports from this (parent) process
 +     following the model of exec (see hurd/hurdexec.c), modify or replace each
 +     value that fork would (plus the specific changes demanded by ATTRP and
-+     FILE_ACTIONS), and make the file_exec_file_name RPC on the requested
++     FILE_ACTIONS), and make the file_exec_paths RPC on the requested
 +     executable file with the child process's task port rather than our own.
 +     This should be indistinguishable from the fork + exec implementation,
       except that all errors will be detected here (in the parent process)
       and return proper errno codes rather than the child dying with 127.
  
-@@ -545,8 +548,29 @@ __spawni (pid_t *pid, const char *file,
-      etc) can be observed before what errors.  */
+@@ -549,7 +552,7 @@ __spawni (pid_t *pid, const char *file,
  
    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);
-+    {
-+      /* The FILE parameter is actually a path.  */
-+      if (file[0] == '/')
-+	{
-+	  /* Absolute path */
-+	  filename = file;
-+	}
-+      else
-+	{
-+	  /* Relative path */
-+	  char *cwd = getcwd (NULL, 0);
-+	  if (cwd == NULL)
-+	    goto out;
-+
-+	  res = __asprintf (&concat_name, "%s/%s", cwd, file);
-+	  free (cwd);
-+	  if (res == -1)
-+	    goto out;
-+
-+	  filename = concat_name;
-+	}
-+      err = child_lookup (filename, O_EXEC, 0, &execfile);
-+    }
++    err = child_lookup (relpath = file, O_EXEC, 0, &execfile);
    else
      {
        /* We have to search for FILE on the path.  */
-@@ -573,20 +597,18 @@ __spawni (pid_t *pid, const char *file,
-       p = path;
-       do
- 	{
--	  char *startp;
--
- 	  path = p;
- 	  p = __strchrnul (path, ':');
- 
- 	  if (p == path)
- 	    /* Two adjacent colons, or a colon at the beginning or the end
- 	       of `PATH' means to search the current directory.  */
--	    startp = name + 1;
-+	    filename = name + 1;
- 	  else
--	    startp = (char *) memcpy (name - (p - path), path, p - path);
-+	    filename = (char *) memcpy (name - (p - path), path, p - path);
- 
- 	  /* Try to open this file name.  */
--	  err = child_lookup (startp, O_EXEC, 0, &execfile);
-+	  err = child_lookup (filename, O_EXEC, 0, &execfile);
- 	  switch (err)
- 	    {
- 	    case EACCES:
-@@ -607,6 +629,20 @@ __spawni (pid_t *pid, const char *file,
+@@ -610,6 +613,7 @@ __spawni (pid_t *pid, const char *file,
  	    }
  
  	  // We only get here when we are done looking for the file.
-+	  if (filename[0] != '/')
-+	    {
-+	      /* Relative path */
-+	      char *cwd = getcwd (NULL, 0);
-+	      if (cwd == NULL)
-+		goto out;
-+
-+	      res = __asprintf (&concat_name, "%s/%s", cwd, filename);
-+	      free (cwd);
-+	      if (res == -1)
-+		goto out;
-+
-+	      filename = concat_name;
-+	    }
++	  relpath = startp;
  	  break;
  	}
        while (*p++ != '\0');
-@@ -623,14 +659,27 @@ __spawni (pid_t *pid, const char *file,
+@@ -617,6 +621,26 @@ __spawni (pid_t *pid, const char *file,
+   if (err)
+     goto out;
+ 
++  if (relpath[0] == '/')
++    {
++      /* Already an absolute path */
++      abspath = relpath;
++    }
++  else
++    {
++      /* Relative path */
++      char *cwd = __getcwd (NULL, 0);
++      if (cwd == NULL)
++	goto out;
++
++      res = __asprintf (&concat_name, "%s/%s", cwd, relpath);
++      free (cwd);
++      if (res == -1)
++	goto out;
++
++      abspath = concat_name;
++    }
++
+   /* Almost there!  */
+   {
+     mach_port_t ports[_hurd_nports];
+@@ -626,14 +650,28 @@ __spawni (pid_t *pid, const char *file,
  
      inline error_t exec (file_t file)
        {
@@ -402,13 +320,14 @@ from argv[0] but argv[0] only contains the executable name by convention.
 -			    ports, MACH_MSG_TYPE_COPY_SEND, _hurd_nports,
 -			    ints, INIT_INT_MAX,
 -			    NULL, 0, NULL, 0);
-+	error_t err = __file_exec_file_name
++	error_t err = __file_exec_paths
 +	  (file, task,
 +	   __sigismember (&_hurdsig_traced, SIGKILL) ? EXEC_SIGTRAP : 0,
-+	   filename, args, argslen, env, envlen,
++	   relpath, abspath, args, argslen, env, envlen,
 +	   dtable, MACH_MSG_TYPE_COPY_SEND, dtablesize,
 +	   ports, MACH_MSG_TYPE_COPY_SEND, _hurd_nports,
-+	   ints, INIT_INT_MAX, NULL, 0, NULL, 0);
++	   ints, INIT_INT_MAX,
++	   NULL, 0, NULL, 0);
 +
 +	/* Fallback for backwards compatibility.  This can just be removed
 +	   when __file_exec goes away.  */
@@ -426,11 +345,28 @@ from argv[0] but argv[0] only contains the executable name by convention.
        }
  
      /* Now we are out of things that can fail before the file_exec RPC,
-@@ -749,6 +798,7 @@ __spawni (pid_t *pid, const char *file,
+@@ -752,6 +790,8 @@ __spawni (pid_t *pid, const char *file,
  	    _hurd_port_free (dtable_cells[i], &ulink_dtable[i], dtable[i]);
  	}
  
 +  free (concat_name);
++
    if (err)
      /* This hack canonicalizes the error code that we return.  */
      err = (__hurd_fail (err), errno);
+Index: glibc-2.26/sysdeps/mach/hurd/fexecve.c
+===================================================================
+--- glibc-2.26.orig/sysdeps/mach/hurd/fexecve.c
++++ glibc-2.26/sysdeps/mach/hurd/fexecve.c
+@@ -25,8 +25,9 @@
+ int
+ fexecve (int fd, char *const argv[], char *const envp[])
+ {
+-  error_t err = HURD_DPORT_USE (fd, _hurd_exec (__mach_task_self (), port,
+-						argv, envp));
++  error_t err = HURD_DPORT_USE (fd, _hurd_exec_paths (__mach_task_self (),
++						      port, NULL, NULL,
++						      argv, envp));
+   if (! err)
+     err = EGRATUITOUS;
+   return __hurd_fail (err);
diff --git a/debian/patches/hurd-i386/local-exec_filename.diff b/debian/patches/hurd-i386/local-exec_filename.diff
new file mode 100644
index 0000000..fe110ed
--- /dev/null
+++ b/debian/patches/hurd-i386/local-exec_filename.diff
@@ -0,0 +1,126 @@
+Keep compatibility with experimental implementation
+
+Index: glibc-2.26/hurd/Makefile
+===================================================================
+--- glibc-2.26.orig/hurd/Makefile
++++ glibc-2.26/hurd/Makefile
+@@ -32,8 +32,8 @@ user-interfaces		:= $(addprefix hurd/,\
+ 				       auth auth_request auth_reply startup \
+ 				       process process_request \
+ 				       msg msg_reply msg_request \
+-				       exec exec_startup crash interrupt \
+-				       fs fsys io io_reply io_request \
++				       exec exec_experimental exec_startup crash interrupt \
++				       fs fs_experimental fsys io io_reply io_request \
+ 				       term tioctl socket ifsock \
+ 				       login password pfinet \
+ 				       )
+Index: glibc-2.26/hurd/Versions
+===================================================================
+--- glibc-2.26.orig/hurd/Versions
++++ glibc-2.26/hurd/Versions
+@@ -140,7 +140,11 @@ libc {
+     _hurd_sigstate_unlock;
+     _hurd_sigstate_delete;
+   }
+-  GLIBC_2.27 {
++  GLIBC_2.21 {
++    # "quasi-internal" functions
++    _hurd_exec_file_name;
++  }
++  GLIBC_2.26 {
+     # "quasi-internal" functions
+     _hurd_exec_paths;
+   }
+Index: glibc-2.26/hurd/hurdexec.c
+===================================================================
+--- glibc-2.26.orig/hurd/hurdexec.c
++++ glibc-2.26/hurd/hurdexec.c
+@@ -25,9 +25,12 @@
+ #include <hurd/fd.h>
+ #include <hurd/signal.h>
+ #include <hurd/id.h>
++#include <hurd/fs_experimental.h>
+ #include <assert.h>
+ #include <argz.h>
+ 
++#include <shlib-compat.h>
++
+ /* Overlay TASK, executing FILE with arguments ARGV and environment ENVP.
+    If TASK == mach_task_self (), some ports are dealloc'd by the exec server.
+    ARGV and ENVP are terminated by NULL pointers.
+@@ -39,6 +42,13 @@ _hurd_exec (task_t task, file_t file,
+   return _hurd_exec_paths (task, file, NULL, NULL, argv, envp);
+ }
+ 
++error_t
++__hurd_exec_file_name (task_t task, file_t file, const char *filename,
++	    char *const argv[], char *const envp[])
++{
++  return _hurd_exec_paths (task, file, filename, filename, argv, envp);
++}
++
+ link_warning (_hurd_exec,
+ 	      "_hurd_exec is deprecated, use _hurd_exec_paths instead");
+ 
+@@ -393,6 +403,19 @@ _hurd_exec_paths (task_t task, file_t fi
+       /* Fall back for backwards compatibility.  This can just be removed
+          when __file_exec goes away.  */
+       if (err == MIG_BAD_ID)
++	err = __file_exec_file_name (file, task, flags,
++				    path ? path : "",
++				    args, argslen, env, envlen,
++				    dtable, MACH_MSG_TYPE_COPY_SEND, dtablesize,
++				    ports, MACH_MSG_TYPE_COPY_SEND,
++				    _hurd_nports,
++				    ints, INIT_INT_MAX,
++				    please_dealloc, pdp - please_dealloc,
++				    &_hurd_msgport,
++				    task == __mach_task_self () ? 1 : 0);
++      /* Fall back for backwards compatibility.  This can just be removed
++         when __file_exec goes away.  */
++      if (err == MIG_BAD_ID)
+ 	err = __file_exec (file, task, flags,
+ 			   args, argslen, env, envlen,
+ 			   dtable, MACH_MSG_TYPE_COPY_SEND, dtablesize,
+@@ -435,3 +458,9 @@ _hurd_exec_paths (task_t task, file_t fi
+   free (env);
+   return err;
+ }
++extern error_t _hurd_exec_file_name (task_t task,
++				     file_t file,
++				     const char *filename,
++				     char *const argv[],
++				     char *const envp[]);
++versioned_symbol (libc, __hurd_exec_file_name, _hurd_exec_file_name, GLIBC_2_21);
+Index: glibc-2.26/sysdeps/mach/hurd/spawni.c
+===================================================================
+--- glibc-2.26.orig/sysdeps/mach/hurd/spawni.c
++++ glibc-2.26/sysdeps/mach/hurd/spawni.c
+@@ -30,6 +30,7 @@
+ #include <hurd/id.h>
+ #include <hurd/lookup.h>
+ #include <hurd/resource.h>
++#include <hurd/fs_experimental.h>
+ #include <assert.h>
+ #include <argz.h>
+ #include "spawn_int.h"
+@@ -673,6 +674,18 @@ __spawni (pid_t *pid, const char *file,
+ 	   ports, MACH_MSG_TYPE_COPY_SEND, _hurd_nports,
+ 	   ints, INIT_INT_MAX,
+ 	   NULL, 0, NULL, 0);
++
++	/* Fallback for backwards compatibility.  This can just be removed
++	   when __file_exec goes away.  */
++	if (err == MIG_BAD_ID)
++	  err = __file_exec_file_name
++	  (file, task,
++	   __sigismember (&_hurdsig_traced, SIGKILL) ? EXEC_SIGTRAP : 0,
++	   relpath, args, argslen, env, envlen,
++	   dtable, MACH_MSG_TYPE_COPY_SEND, dtablesize,
++	   ports, MACH_MSG_TYPE_COPY_SEND, _hurd_nports,
++	   ints, INIT_INT_MAX,
++	   NULL, 0, NULL, 0);
+ 
+ 	/* Fallback for backwards compatibility.  This can just be removed
+ 	   when __file_exec goes away.  */
diff --git a/debian/patches/hurd-i386/tg-io_select_timeout.diff b/debian/patches/hurd-i386/tg-io_select_timeout.diff
index 476c067..43b2605 100644
--- a/debian/patches/hurd-i386/tg-io_select_timeout.diff
+++ b/debian/patches/hurd-i386/tg-io_select_timeout.diff
@@ -26,9 +26,9 @@ the timeout locally when there is no file descriptor.
 @@ -37,7 +37,8 @@ user-interfaces		:= $(addprefix hurd/,\
  				       process process_request \
  				       msg msg_reply msg_request \
- 				       exec exec_experimental exec_startup crash interrupt \
--				       fs fs_experimental fsys io term tioctl socket ifsock \
-+				       fs fs_experimental fsys io io_reply io_request \
+ 				       exec exec_startup crash interrupt \
+-				       fs fsys io term tioctl socket ifsock \
++				       fs fsys io io_reply io_request \
 +				       term tioctl socket ifsock \
  				       login password pfinet \
  				       )
diff --git a/debian/patches/series b/debian/patches/series
index f7c0210..d73b637 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -79,7 +79,7 @@ hurd-i386/cvs-libpthread.diff
 hurd-i386/libpthread_build.diff
 hurd-i386/tg-libpthread_depends.diff
 hurd-i386/libpthread_version.diff
-hurd-i386/submitted-exec_filename.diff
+hurd-i386/git-exec_filename.diff
 hurd-i386/unsubmitted-gnumach.defs.diff
 hurd-i386/tg-hurdsig-boot-fix.diff
 hurd-i386/tg-single-select-timeout.diff
@@ -168,6 +168,7 @@ hurd-i386/git-seekdir-linknamespace.diff
 hurd-i386/git-ifaddrs-linknamespace.diff
 hurd-i386/git-NO_HIDDEN.diff
 hurd-i386/git-mount_namespace.diff
+hurd-i386/local-exec_filename.diff
 
 i386/local-biarch.diff
 i386/unsubmitted-quiet-ldconfig.diff

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-glibc/glibc.git


Reply to: