[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Use the new __hurd_exec_file_name RPC
From: |
Carl Fredrik Hammar |
Subject: |
Re: [PATCH] Use the new __hurd_exec_file_name RPC |
Date: |
Mon, 19 Jul 2010 10:35:32 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Fri, Jul 16, 2010 at 12:21:16PM +0200, Emilio Pozuelo Monfort wrote:
> And here goes the glibc one.
>
> Regards,
> Emilio
>
> 2010-07-16 Emilio Pozuelo Monfort <pochu27@gmail.com>
> * hurd/hurdexec.c (_hurd_exec): Deprecate it.
> (_hurd_exec_file_name): New function.
> * hurd/hurd.h: 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.
So there is no confusion: leading tabs are correct here.
> >From cd7f63baaed855a619e630d622a5fc5cbd76e28d 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 __hurd_exec_file_name RPC
>
> This fixes problems when an script could end with /dev/fd/N
> in argv[0] because the exec server didn't know the file name.
Some errors here, this is a corrected version with some other small
improvements:
This fixes the problem that a script could end up with /dev/fd/N
in argv[0] because the exec server couldn't guess the file name.
> diff --git a/hurd/hurd.h b/hurd/hurd.h
> index 642ea43..a83c3fa 100644
> --- a/hurd/hurd.h
> +++ b/hurd/hurd.h
> @@ -1,4 +1,4 @@
> -/* Copyright (C) 1993,94,95,96,97,98,99,2001,2002,2007
> +/* Copyright (C) 1993,94,95,96,97,98,99,2001,2002,2007,2010
> Free Software Foundation, Inc.
> This file is part of the GNU C Library.
>
> @@ -243,13 +243,21 @@ extern FILE *fopenport (io_t port, const char *mode);
> 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[]);
Lets take Guillem's suggestion and put __attribute_deprecated on this.
> diff --git a/hurd/hurdexec.c b/hurd/hurdexec.c
> index beae869..f9ca29f 100644
> --- a/hurd/hurdexec.c
> +++ b/hurd/hurdexec.c
> @@ -1,4 +1,4 @@
> -/* Copyright (C) 1991,92,93,94,95,96,97,99,2001,02
> +/* Copyright (C) 1991,92,93,94,95,96,97,99,2001,02,10
> Free Software Foundation, Inc.
> This file is part of the GNU C Library.
>
> @@ -32,11 +32,26 @@
>
> /* 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. */
> 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);
> +}
> +
Here would be the proper place for a link_warning(), I think.
Also, please test this by trying to provoke the warnings.
> @@ -622,14 +620,27 @@ __spawni (pid_t *pid, const char *file,
>
> inline error_t exec (file_t file)
> {
> - return __file_exec (file, task,
> - (__sigismember (&_hurdsig_traced, SIGKILL)
> - ? EXEC_SIGTRAP : 0),
> - 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);
> + error_t err = __file_exec_file_name
> + (file, task,
> + __sigismember (&_hurdsig_traced, SIGKILL) ? EXEC_SIGTRAP : 0,
> + filename, 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);
These lines should line up with the opening parenthesis.
Regards,
Fredrik