This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch, master, updated. glibc-2.14-229-gd96de96
- From: drepper at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 6 Sep 2011 00:25:28 -0000
- Subject: GNU C Library master sources branch, master, updated. glibc-2.14-229-gd96de96
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via d96de9634a334af16c0ac711074c15ac1762b23c (commit)
via 54b1f8b6bf88e34c55b77b2e4acb00776b4a5783 (commit)
from d48e586806e3a2a676c60b9b1bf321b0d097fab4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d96de9634a334af16c0ac711074c15ac1762b23c
commit d96de9634a334af16c0ac711074c15ac1762b23c
Author: Ulrich Drepper <drepper@gmail.com>
Date: Mon Sep 5 20:24:50 2011 -0400
Try shell in posix_spawn* only in compat mode
diff --git a/ChangeLog b/ChangeLog
index 8a45478..9dbb0cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
2011-09-05 Ulrich Drepper <drepper@gmail.com>
+ [BZ #13134]
+ * sysdeps/posix/spawni.c (script_execute): Define only for compatibility
+ before glibc 2.15.
+ (tryshell): Define.
+ (__spawni): Change last parameter to be flag. Test
+ SPAWN_XFLAGS_USE_PATH flag to use path or not.
+ Don't try to use shell unless SPAWN_XFLAGS_TRY_SHELL is set.
+ * sysdeps/mach/hurd/spawni.c: Change last parameter and adjust user.
+ * posix/spawni.c: Likewise.
+ * posix/spawn.c: Add compat version which passed SPAWN_XFLAGS_TRY_SHELL.
+ * posix/spawnp.c: Likewise. Change normal version to use
+ SPAWN_XFLAGS_USE_PATH.
+ * posix/spawn_int.c: Define SPAWN_XFLAGS_USE_PATH and
+ SPAWN_XFLAGS_TRY_SHELL.
+
[BZ #13150]
* posix/glob.h: Remove gcc 1.x support.
diff --git a/NEWS b/NEWS
index a9f951a..3eda9c1 100644
--- a/NEWS
+++ b/NEWS
@@ -10,7 +10,7 @@ Version 2.15
* The following bugs are resolved with this release:
9696, 12868, 12852, 12874, 12885, 12907, 12922, 12935, 13007, 13021,
- 13068, 13114, 13144, 13150
+ 13068, 13114, 13134, 13144, 13150
* New program pldd to list loaded object of a process
Implemented by Ulrich Drepper.
diff --git a/posix/spawn.c b/posix/spawn.c
index b93b320..dd68fbd 100644
--- a/posix/spawn.c
+++ b/posix/spawn.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -18,14 +18,31 @@
#include <spawn.h>
#include "spawn_int.h"
+#include <shlib-compat.h>
/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
Before running the process perform the actions described in FILE-ACTIONS. */
int
-posix_spawn (pid_t *pid, const char *path,
- const posix_spawn_file_actions_t *file_actions,
- const posix_spawnattr_t *attrp, char *const argv[],
- char *const envp[])
+__posix_spawn (pid_t *pid, const char *path,
+ const posix_spawn_file_actions_t *file_actions,
+ const posix_spawnattr_t *attrp, char *const argv[],
+ char *const envp[])
{
return __spawni (pid, path, file_actions, attrp, argv, envp, 0);
}
+versioned_symbol (libc, __posix_spawn, posix_spawn, GLIBC_2_15);
+
+
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_15)
+int
+attribute_compat_text_section
+__posix_spawn_compat (pid_t *pid, const char *file,
+ const posix_spawn_file_actions_t *file_actions,
+ const posix_spawnattr_t *attrp, char *const argv[],
+ char *const envp[])
+{
+ return __spawni (pid, file, file_actions, attrp, argv, envp,
+ SPAWN_XFLAGS_TRY_SHELL);
+}
+compat_symbol (libc, __posix_spawn_compat, posix_spawn, GLIBC_2_2);
+#endif
diff --git a/posix/spawn_int.h b/posix/spawn_int.h
index a3e9347..5609e58 100644
--- a/posix/spawn_int.h
+++ b/posix/spawn_int.h
@@ -29,10 +29,13 @@ struct __spawn_action
} action;
};
+#define SPAWN_XFLAGS_USE_PATH 0x1
+#define SPAWN_XFLAGS_TRY_SHELL 0x2
+
extern int __posix_spawn_file_actions_realloc (posix_spawn_file_actions_t *
file_actions);
extern int __spawni (pid_t *pid, const char *path,
const posix_spawn_file_actions_t *file_actions,
const posix_spawnattr_t *attrp, char *const argv[],
- char *const envp[], int use_path);
+ char *const envp[], int xflags);
diff --git a/posix/spawni.c b/posix/spawni.c
index c7d5f59..4e5f77f 100644
--- a/posix/spawni.c
+++ b/posix/spawni.c
@@ -1,5 +1,5 @@
/* Guts of POSIX spawn interface. Stub version.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -36,7 +36,7 @@ int
__spawni (pid_t *pid, const char *file,
const posix_spawn_file_actions_t *file_actions,
const posix_spawnattr_t *attrp, char *const argv[],
- char *const envp[], int use_path)
+ char *const envp[], int xflags)
{
__set_errno (ENOSYS);
return -1;
diff --git a/posix/spawnp.c b/posix/spawnp.c
index 2b15391..79886fb 100644
--- a/posix/spawnp.c
+++ b/posix/spawnp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -18,14 +18,32 @@
#include <spawn.h>
#include "spawn_int.h"
+#include <shlib-compat.h>
/* Spawn a new process executing FILE with the attributes describes in *ATTRP.
Before running the process perform the actions described in FILE-ACTIONS. */
int
-posix_spawnp (pid_t *pid, const char *file,
- const posix_spawn_file_actions_t *file_actions,
- const posix_spawnattr_t *attrp, char *const argv[],
- char *const envp[])
+__posix_spawnp (pid_t *pid, const char *file,
+ const posix_spawn_file_actions_t *file_actions,
+ const posix_spawnattr_t *attrp, char *const argv[],
+ char *const envp[])
{
- return __spawni (pid, file, file_actions, attrp, argv, envp, 1);
+ return __spawni (pid, file, file_actions, attrp, argv, envp,
+ SPAWN_XFLAGS_USE_PATH);
}
+versioned_symbol (libc, __posix_spawnp, posix_spawnp, GLIBC_2_15);
+
+
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_15)
+int
+attribute_compat_text_section
+__posix_spawnp_compat (pid_t *pid, const char *file,
+ const posix_spawn_file_actions_t *file_actions,
+ const posix_spawnattr_t *attrp, char *const argv[],
+ char *const envp[])
+{
+ return __spawni (pid, file, file_actions, attrp, argv, envp,
+ SPAWN_XFLAGS_USE_PATH | SPAWN_XFLAGS_TRY_SHELL);
+}
+compat_symbol (libc, __posix_spawnp_compat, posix_spawnp, GLIBC_2_2);
+#endif
diff --git a/sysdeps/mach/hurd/spawni.c b/sysdeps/mach/hurd/spawni.c
index 244ca2d..3d2b591 100644
--- a/sysdeps/mach/hurd/spawni.c
+++ b/sysdeps/mach/hurd/spawni.c
@@ -1,5 +1,5 @@
/* spawn a new process running an executable. Hurd version.
- Copyright (C) 2001,02,04 Free Software Foundation, Inc.
+ Copyright (C) 2001,02,04,11 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -41,7 +41,7 @@ __spawni (pid_t *pid, const char *file,
const posix_spawn_file_actions_t *file_actions,
const posix_spawnattr_t *attrp,
char *const argv[], char *const envp[],
- int use_path)
+ int xflags)
{
pid_t new_pid;
char *path, *p, *name;
@@ -391,7 +391,7 @@ __spawni (pid_t *pid, const char *file,
/* Make sure the dtable can hold NEWFD. */
#define EXPAND_DTABLE(newfd) \
- ({ \
+ ({ \
if ((unsigned int)newfd >= dtablesize \
&& newfd < _hurd_rlimits[RLIMIT_OFILE].rlim_cur) \
{ \
@@ -399,7 +399,7 @@ __spawni (pid_t *pid, const char *file,
NEW_TABLE (dtable, newfd); \
NEW_TABLE (ulink_dtable, newfd); \
NEW_TABLE (dtable_cells, newfd); \
- dtablesize = newfd + 1; \
+ dtablesize = newfd + 1; \
} \
((unsigned int)newfd < dtablesize ? 0 : EMFILE); \
})
@@ -543,7 +543,7 @@ __spawni (pid_t *pid, const char *file,
conditions are diagnosed first and what side effects (file creation,
etc) can be observed before what errors. */
- if (! use_path || strchr (file, '/') != NULL)
+ if ((xflags & SPAWN_XFLAGS_USE_PATH) == 0 || strchr (file, '/') != NULL)
/* The FILE parameter is actually a path. */
err = child_lookup (file, O_EXEC, 0, &execfile);
else
diff --git a/sysdeps/posix/spawni.c b/sysdeps/posix/spawni.c
index f19862f..129edcd 100644
--- a/sysdeps/posix/spawni.c
+++ b/sysdeps/posix/spawni.c
@@ -28,6 +28,7 @@
#include "spawn_int.h"
#include <not-cancel.h>
#include <local-setxid.h>
+#include <shlib-compat.h>
/* The Unix standard contains a long explanation of the way to signal
@@ -38,6 +39,7 @@
#define SPAWN_ERROR 127
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_15)
/* The file is accessible but it is not an executable file. Invoke
the shell to interpret it as a script. */
static void
@@ -64,6 +66,10 @@ script_execute (const char *file, char *const argv[], char *const envp[])
__execve (new_argv[0], new_argv, envp);
}
}
+# define tryshell (xflags & SPAWN_XFLAGS_TRY_SHELL)
+#else
+# define tryshell 0
+#endif
/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
@@ -72,7 +78,7 @@ int
__spawni (pid_t *pid, const char *file,
const posix_spawn_file_actions_t *file_actions,
const posix_spawnattr_t *attrp, char *const argv[],
- char *const envp[], int use_path)
+ char *const envp[], int xflags)
{
pid_t new_pid;
char *path, *p, *name;
@@ -226,12 +232,12 @@ __spawni (pid_t *pid, const char *file,
}
}
- if (! use_path || strchr (file, '/') != NULL)
+ if ((xflags & SPAWN_XFLAGS_USE_PATH) == 0 || strchr (file, '/') != NULL)
{
/* The FILE parameter is actually a path. */
__execve (file, argv, envp);
- if (errno == ENOEXEC)
+ if (tryshell && errno == ENOEXEC)
script_execute (file, argv, envp);
/* Oh, oh. `execve' returns. This is bad. */
@@ -277,7 +283,7 @@ __spawni (pid_t *pid, const char *file,
/* Try to execute this name. If it works, execv will not return. */
__execve (startp, argv, envp);
- if (errno == ENOEXEC)
+ if (tryshell && errno == ENOEXEC)
script_execute (startp, argv, envp);
switch (errno)
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=54b1f8b6bf88e34c55b77b2e4acb00776b4a5783
commit 54b1f8b6bf88e34c55b77b2e4acb00776b4a5783
Author: Ulrich Drepper <drepper@gmail.com>
Date: Mon Sep 5 20:06:01 2011 -0400
Fix last checkin
diff --git a/posix/glob.h b/posix/glob.h
index a5153e8..07f2ac7 100644
--- a/posix/glob.h
+++ b/posix/glob.h
@@ -29,6 +29,7 @@ __BEGIN_DECLS
typedef __SIZE_TYPE__ __size_t;
# if defined __USE_XOPEN || __USE_XOPEN2K8
typedef __SIZE_TYPE__ size_t;
+# endif
#else
/* The GNU CC stddef.h version defines __size_t as empty. We need a real
definition. */
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 15 +++++++++++++++
NEWS | 2 +-
posix/glob.h | 1 +
posix/spawn.c | 27 ++++++++++++++++++++++-----
posix/spawn_int.h | 5 ++++-
posix/spawni.c | 4 ++--
posix/spawnp.c | 30 ++++++++++++++++++++++++------
sysdeps/mach/hurd/spawni.c | 10 +++++-----
sysdeps/posix/spawni.c | 14 ++++++++++----
9 files changed, 84 insertions(+), 24 deletions(-)
hooks/post-receive
--
GNU C Library master sources