create core package
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
--- bash-2.02-orig/parse.y Wed Mar 25 18:16:23 1998
|
||||
+++ bash-2.02/parse.y Sun Apr 19 16:46:34 1998
|
||||
@@ -923,7 +923,7 @@
|
||||
|
||||
#if defined (READLINE)
|
||||
char *current_readline_prompt = (char *)NULL;
|
||||
-char *current_readline_line = (char *)NULL;
|
||||
+unsigned char *current_readline_line = (unsigned char *)NULL;
|
||||
int current_readline_line_index = 0;
|
||||
|
||||
static int
|
||||
@@ -0,0 +1,11 @@
|
||||
--- bash-3.0/config-top.h.paths 2003-08-05 15:36:12.000000000 +0100
|
||||
+++ bash-3.0/config-top.h 2004-07-28 09:36:27.117205637 +0100
|
||||
@@ -66,7 +66,7 @@
|
||||
the Posix.2 confstr () function, or CS_PATH define are not present. */
|
||||
#ifndef STANDARD_UTILS_PATH
|
||||
#define STANDARD_UTILS_PATH \
|
||||
- "/bin:/usr/bin:/sbin:/usr/sbin:/etc:/usr/etc"
|
||||
+ "/bin:/usr/bin:/usr/sbin:/sbin"
|
||||
#endif
|
||||
|
||||
/* Default primary and secondary prompt strings. */
|
||||
@@ -0,0 +1,12 @@
|
||||
diff -up bash-3.2/config-top.h.profile bash-3.2/config-top.h
|
||||
--- bash-3.2/config-top.h.profile 2008-07-17 13:35:39.000000000 +0200
|
||||
+++ bash-3.2/config-top.h 2008-07-17 13:42:18.000000000 +0200
|
||||
@@ -26,6 +26,8 @@
|
||||
what POSIX.2 specifies. */
|
||||
#define CONTINUE_AFTER_KILL_ERROR
|
||||
|
||||
+#define NON_INTERACTIVE_LOGIN_SHELLS
|
||||
+
|
||||
/* Define BREAK_COMPLAINS if you want the non-standard, but useful
|
||||
error messages about `break' and `continue' out of context. */
|
||||
#define BREAK_COMPLAINS
|
||||
@@ -0,0 +1,219 @@
|
||||
diff -up bash-4.2-rc2/config.h.in.interpreter bash-4.2-rc2/config.h.in
|
||||
--- bash-4.2-rc2/config.h.in.interpreter 2011-02-09 07:59:21.000000000 +0100
|
||||
+++ bash-4.2-rc2/config.h.in 2011-02-09 07:59:21.000000000 +0100
|
||||
@@ -706,6 +706,9 @@
|
||||
/* Define if you have the pathconf function. */
|
||||
#undef HAVE_PATHCONF
|
||||
|
||||
+/* Define if you have the pread function. */
|
||||
+#undef HAVE_PREAD
|
||||
+
|
||||
/* Define if you have the putenv function. */
|
||||
#undef HAVE_PUTENV
|
||||
|
||||
@@ -898,6 +901,9 @@
|
||||
/* Define if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
+/* Define if you have the <elf.h> header file. */
|
||||
+#undef HAVE_ELF_H
|
||||
+
|
||||
/* Define if you have the <grp.h> header file. */
|
||||
#undef HAVE_GRP_H
|
||||
|
||||
diff -up bash-4.2-rc2/configure.in.interpreter bash-4.2-rc2/configure.in
|
||||
--- bash-4.2-rc2/configure.in.interpreter 2011-01-16 21:31:12.000000000 +0100
|
||||
+++ bash-4.2-rc2/configure.ac 2011-02-09 08:02:27.000000000 +0100
|
||||
@@ -659,7 +659,7 @@ BASH_HEADER_INTTYPES
|
||||
AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \
|
||||
memory.h locale.h termcap.h termio.h termios.h dlfcn.h \
|
||||
stdbool.h stddef.h stdint.h netdb.h pwd.h grp.h strings.h \
|
||||
- regex.h syslog.h ulimit.h)
|
||||
+ regex.h syslog.h ulimit.h elf.h)
|
||||
AC_CHECK_HEADERS(sys/pte.h sys/stream.h sys/select.h sys/file.h \
|
||||
sys/resource.h sys/param.h sys/socket.h sys/stat.h \
|
||||
sys/time.h sys/times.h sys/types.h sys/wait.h)
|
||||
@@ -723,7 +723,7 @@ dnl checks for system calls
|
||||
AC_CHECK_FUNCS(dup2 eaccess fcntl getdtablesize getgroups gethostname \
|
||||
getpagesize getpeername getrlimit getrusage gettimeofday \
|
||||
kill killpg lstat readlink sbrk select setdtablesize \
|
||||
- setitimer tcgetpgrp uname ulimit waitpid)
|
||||
+ setitimer tcgetpgrp uname ulimit waitpid pread)
|
||||
AC_REPLACE_FUNCS(rename)
|
||||
|
||||
dnl checks for c library functions
|
||||
diff -up bash-4.2-rc2/execute_cmd.c.interpreter bash-4.2-rc2/execute_cmd.c
|
||||
--- bash-4.2-rc2/execute_cmd.c.interpreter 2011-01-20 04:24:47.000000000 +0100
|
||||
+++ bash-4.2-rc2/execute_cmd.c 2011-02-09 07:59:21.000000000 +0100
|
||||
@@ -41,6 +41,10 @@
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
+#ifdef HAVE_ELF_H
|
||||
+# include <elf.h>
|
||||
+#endif
|
||||
+
|
||||
#include "posixtime.h"
|
||||
|
||||
#if defined (HAVE_SYS_RESOURCE_H) && !defined (RLIMTYPE)
|
||||
@@ -4975,14 +4979,22 @@ shell_execve (command, args, env)
|
||||
{
|
||||
/* The file has the execute bits set, but the kernel refuses to
|
||||
run it for some reason. See why. */
|
||||
+#if defined (HAVE_HASH_BANG_EXEC) || defined (HAVE_ELF_H)
|
||||
+ int fd = open (command, O_RDONLY);
|
||||
+
|
||||
+ if (fd >= 0)
|
||||
+ sample_len = read (fd, sample, sizeof (sample));
|
||||
+ else
|
||||
+ sample_len = -1;
|
||||
+#endif
|
||||
#if defined (HAVE_HASH_BANG_EXEC)
|
||||
- READ_SAMPLE_BUF (command, sample, sample_len);
|
||||
sample[sample_len - 1] = '\0';
|
||||
if (sample_len > 2 && sample[0] == '#' && sample[1] == '!')
|
||||
{
|
||||
char *interp;
|
||||
int ilen;
|
||||
|
||||
+ close (fd);
|
||||
interp = getinterp (sample, sample_len, (int *)NULL);
|
||||
ilen = strlen (interp);
|
||||
errno = i;
|
||||
@@ -4997,6 +5009,136 @@ shell_execve (command, args, env)
|
||||
return (EX_NOEXEC);
|
||||
}
|
||||
#endif
|
||||
+#if defined (HAVE_ELF_H)
|
||||
+ if (i == ENOENT
|
||||
+ && sample_len > EI_NIDENT
|
||||
+ && memcmp (sample, ELFMAG, SELFMAG) == 0)
|
||||
+ {
|
||||
+ off_t offset = -1;
|
||||
+
|
||||
+ /* It is an ELF file. Now determine whether it is dynamically
|
||||
+ linked and if yes, get the offset of the interpreter
|
||||
+ string. */
|
||||
+ if (sample[EI_CLASS] == ELFCLASS32
|
||||
+ && sample_len > sizeof (Elf32_Ehdr))
|
||||
+ {
|
||||
+ Elf32_Ehdr ehdr;
|
||||
+ Elf32_Phdr *phdr;
|
||||
+ int nphdr;
|
||||
+
|
||||
+ /* We have to copy the data since the sample buffer
|
||||
+ might not be aligned correctly to be accessed as
|
||||
+ an Elf32_Ehdr struct. */
|
||||
+ memcpy (&ehdr, sample, sizeof (Elf32_Ehdr));
|
||||
+
|
||||
+ nphdr = ehdr.e_phnum;
|
||||
+ phdr = (Elf32_Phdr *) malloc (nphdr * ehdr.e_phentsize);
|
||||
+ if (phdr != NULL)
|
||||
+ {
|
||||
+#ifdef HAVE_PREAD
|
||||
+ sample_len = pread (fd, phdr, nphdr * ehdr.e_phentsize,
|
||||
+ ehdr.e_phoff);
|
||||
+#else
|
||||
+ if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)
|
||||
+ sample_len = read (fd, phdr,
|
||||
+ nphdr * ehdr.e_phentsize);
|
||||
+ else
|
||||
+ sample_len = -1;
|
||||
+#endif
|
||||
+ if (sample_len == nphdr * ehdr.e_phentsize)
|
||||
+ while (nphdr-- > 0)
|
||||
+ if (phdr[nphdr].p_type == PT_INTERP)
|
||||
+ {
|
||||
+ offset = phdr[nphdr].p_offset;
|
||||
+ break;
|
||||
+ }
|
||||
+ free (phdr);
|
||||
+ }
|
||||
+ }
|
||||
+ else if (sample[EI_CLASS] == ELFCLASS64
|
||||
+ && sample_len > sizeof (Elf64_Ehdr))
|
||||
+ {
|
||||
+ Elf64_Ehdr ehdr;
|
||||
+ Elf64_Phdr *phdr;
|
||||
+ int nphdr;
|
||||
+
|
||||
+ /* We have to copy the data since the sample buffer
|
||||
+ might not be aligned correctly to be accessed as
|
||||
+ an Elf64_Ehdr struct. */
|
||||
+ memcpy (&ehdr, sample, sizeof (Elf64_Ehdr));
|
||||
+
|
||||
+ nphdr = ehdr.e_phnum;
|
||||
+ phdr = (Elf64_Phdr *) malloc (nphdr * ehdr.e_phentsize);
|
||||
+ if (phdr != NULL)
|
||||
+ {
|
||||
+#ifdef HAVE_PREAD
|
||||
+ sample_len = pread (fd, phdr, nphdr * ehdr.e_phentsize,
|
||||
+ ehdr.e_phoff);
|
||||
+#else
|
||||
+ if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)
|
||||
+ sample_len = read (fd, phdr,
|
||||
+ nphdr * ehdr.e_phentsize);
|
||||
+ else
|
||||
+ sample_len = -1;
|
||||
+#endif
|
||||
+ if (sample_len == nphdr * ehdr.e_phentsize)
|
||||
+ while (nphdr-- > 0)
|
||||
+ if (phdr[nphdr].p_type == PT_INTERP)
|
||||
+ {
|
||||
+ offset = phdr[nphdr].p_offset;
|
||||
+ break;
|
||||
+ }
|
||||
+ free (phdr);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (offset != -1)
|
||||
+ {
|
||||
+ size_t maxlen = 0;
|
||||
+ size_t actlen = 0;
|
||||
+ char *interp = NULL;
|
||||
+
|
||||
+ do
|
||||
+ {
|
||||
+ if (actlen == maxlen)
|
||||
+ {
|
||||
+ char *newinterp = realloc (interp, maxlen += 200);
|
||||
+ if (newinterp == NULL)
|
||||
+ {
|
||||
+ actlen = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+ interp = newinterp;
|
||||
+
|
||||
+#ifdef HAVE_PREAD
|
||||
+ actlen = pread (fd, interp, maxlen, offset);
|
||||
+#else
|
||||
+ if (lseek (fd, offset, SEEK_SET) != -1)
|
||||
+ actlen = read (fd, interp, maxlen);
|
||||
+ else
|
||||
+ actlen = -1;
|
||||
+#endif
|
||||
+ }
|
||||
+ }
|
||||
+ while (actlen > 0 && memchr (interp, '\0', actlen) == NULL);
|
||||
+
|
||||
+ if (actlen > 0)
|
||||
+ {
|
||||
+ close (fd);
|
||||
+ errno = i;
|
||||
+ sys_error ("%s: %s: bad ELF interpreter", command,
|
||||
+ interp);
|
||||
+ free (interp);
|
||||
+ return (EX_NOEXEC);
|
||||
+ }
|
||||
+
|
||||
+ free (interp);
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+#if defined (HAVE_HASH_BANG_EXEC) || defined (HAVE_ELF_H)
|
||||
+ close (fd);
|
||||
+#endif
|
||||
errno = i;
|
||||
file_error (command);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
--- bash-2.05b/builtins/Makefile.in.debuginfo 2003-03-25 17:25:21.000000000 +0000
|
||||
+++ bash-2.05b/builtins/Makefile.in 2003-03-25 17:25:49.000000000 +0000
|
||||
@@ -93,7 +93,6 @@
|
||||
$(RM) $@
|
||||
./$(MKBUILTINS) $(DIRECTDEFINE) $<
|
||||
$(CC) -c $(CCFLAGS) $*.c || ( $(RM) $*.c ; exit 1 )
|
||||
- $(RM) $*.c
|
||||
|
||||
# How to make a .c file from a .def file.
|
||||
.def.c:
|
||||
@@ -0,0 +1,10 @@
|
||||
--- bash-2.05b/doc/builtins.1.manso 2003-02-10 18:58:21.000000000 +0000
|
||||
+++ bash-2.05b/doc/builtins.1 2003-02-10 18:58:28.000000000 +0000
|
||||
@@ -10,6 +10,6 @@
|
||||
ulimit, umask, unalias, unset, wait \- bash built-in commands, see \fBbash\fR(1)
|
||||
.SH BASH BUILTIN COMMANDS
|
||||
.nr zZ 1
|
||||
-.so bash.1
|
||||
+.so man1/bash.1
|
||||
.SH SEE ALSO
|
||||
bash(1), sh(1)
|
||||
@@ -0,0 +1,11 @@
|
||||
--- bash-2.05b/aclocal.m4.pgrp_sync 2002-06-25 14:45:43.000000000 +0100
|
||||
+++ bash-2.05b/aclocal.m4 2003-01-15 18:17:35.000000000 +0000
|
||||
@@ -1255,7 +1255,7 @@
|
||||
wait(&status);
|
||||
exit(ok ? 0 : 5);
|
||||
}
|
||||
-], bash_cv_pgrp_pipe=no,bash_cv_pgrp_pipe=yes,
|
||||
+], bash_cv_pgrp_pipe=yes,bash_cv_pgrp_pipe=yes,
|
||||
[AC_MSG_WARN(cannot check pgrp synchronization if cross compiling -- defaulting to no)
|
||||
bash_cv_pgrp_pipe=no])
|
||||
])
|
||||
@@ -0,0 +1,11 @@
|
||||
--- bash-2.05b/lib/readline/readline.c.oom 2002-03-13 23:10:46.000000000 +0100
|
||||
+++ bash-2.05b/lib/readline/readline.c 2002-08-07 12:02:04.000000000 +0200
|
||||
@@ -817,7 +817,7 @@
|
||||
/* Special case rl_do_lowercase_version (). */
|
||||
if (func == rl_do_lowercase_version)
|
||||
/* Should we do anything special if key == ANYOTHERKEY? */
|
||||
- return (_rl_dispatch (_rl_to_lower (key), map));
|
||||
+ return (_rl_dispatch (_rl_to_lower ((unsigned char)key), map));
|
||||
|
||||
rl_executing_keymap = map;
|
||||
rl_executing_key = key;
|
||||
@@ -0,0 +1,19 @@
|
||||
--- bash-3.1/Makefile.in.xcc 2005-10-25 19:37:52.000000000 +0100
|
||||
+++ bash-3.1/Makefile.in 2005-12-23 16:11:09.000000000 +0000
|
||||
@@ -68,6 +68,7 @@
|
||||
ARFLAGS = @ARFLAGS@
|
||||
RANLIB = @RANLIB@
|
||||
SIZE = @SIZE@
|
||||
+STRIP = strip
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
@@ -535,7 +536,7 @@
|
||||
@chmod a+rx bashbug
|
||||
|
||||
strip: $(Program) .made
|
||||
- strip $(Program)
|
||||
+ $(STRIP) $(Program)
|
||||
ls -l $(Program)
|
||||
-$(SIZE) $(Program)
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
diff -up bash-4.2/config.h.in.audit bash-4.2/config.h.in
|
||||
--- bash-4.2/config.h.in.audit 2013-01-31 16:26:16.857698992 +0100
|
||||
+++ bash-4.2/config.h.in 2013-01-31 16:26:16.876699255 +0100
|
||||
@@ -1131,6 +1131,14 @@
|
||||
|
||||
/* End additions for lib/intl */
|
||||
|
||||
+
|
||||
+/* Additions for lib/readline */
|
||||
+
|
||||
+/* Define if you have <linux/audit.h> and it defines AUDIT_USER_TTY */
|
||||
+#undef HAVE_DECL_AUDIT_USER_TTY
|
||||
+
|
||||
+/* End additions for lib/readline */
|
||||
+
|
||||
#include "config-bot.h"
|
||||
|
||||
#endif /* _CONFIG_H_ */
|
||||
diff -up bash-4.2/configure.in.audit bash-4.2/configure.in
|
||||
--- bash-4.2/configure.in.audit 2013-01-31 16:26:16.858699005 +0100
|
||||
+++ bash-4.2/configure.ac 2013-01-31 16:26:16.877699269 +0100
|
||||
@@ -888,6 +888,8 @@ BASH_FUNC_DUP2_CLOEXEC_CHECK
|
||||
BASH_SYS_PGRP_SYNC
|
||||
BASH_SYS_SIGNAL_VINTAGE
|
||||
|
||||
+AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]])
|
||||
+
|
||||
dnl checking for the presence of certain library symbols
|
||||
BASH_SYS_ERRLIST
|
||||
BASH_SYS_SIGLIST
|
||||
diff -up bash-4.2/lib/readline/readline.c.audit bash-4.2/lib/readline/readline.c
|
||||
--- bash-4.2/lib/readline/readline.c.audit 2013-01-31 16:26:16.871699185 +0100
|
||||
+++ bash-4.2/lib/readline/readline.c 2013-01-31 17:24:23.902744860 +0100
|
||||
@@ -55,6 +55,12 @@
|
||||
extern int errno;
|
||||
#endif /* !errno */
|
||||
|
||||
+#if defined (HAVE_DECL_AUDIT_USER_TTY)
|
||||
+# include <sys/socket.h>
|
||||
+# include <linux/audit.h>
|
||||
+# include <linux/netlink.h>
|
||||
+#endif
|
||||
+
|
||||
/* System-specific feature definitions and include files. */
|
||||
#include "rldefs.h"
|
||||
#include "rlmbutil.h"
|
||||
@@ -301,7 +307,48 @@ rl_set_prompt (prompt)
|
||||
rl_visible_prompt_length = rl_expand_prompt (rl_prompt);
|
||||
return 0;
|
||||
}
|
||||
-
|
||||
+
|
||||
+#if defined (HAVE_DECL_AUDIT_USER_TTY)
|
||||
+/* Report STRING to the audit system. */
|
||||
+static void
|
||||
+audit_tty (char *string)
|
||||
+{
|
||||
+ struct sockaddr_nl addr;
|
||||
+ struct msghdr msg;
|
||||
+ struct nlmsghdr nlm;
|
||||
+ struct iovec iov[2];
|
||||
+ size_t size;
|
||||
+ int fd;
|
||||
+
|
||||
+ size = strlen (string) + 1;
|
||||
+ fd = socket (AF_NETLINK, SOCK_RAW, NETLINK_AUDIT);
|
||||
+ if (fd < 0)
|
||||
+ return;
|
||||
+ nlm.nlmsg_len = NLMSG_LENGTH (size);
|
||||
+ nlm.nlmsg_type = AUDIT_USER_TTY;
|
||||
+ nlm.nlmsg_flags = NLM_F_REQUEST;
|
||||
+ nlm.nlmsg_seq = 0;
|
||||
+ nlm.nlmsg_pid = 0;
|
||||
+ iov[0].iov_base = &nlm;
|
||||
+ iov[0].iov_len = sizeof (nlm);
|
||||
+ iov[1].iov_base = string;
|
||||
+ iov[1].iov_len = size;
|
||||
+ addr.nl_family = AF_NETLINK;
|
||||
+ addr.nl_pad = 0;
|
||||
+ addr.nl_pid = 0;
|
||||
+ addr.nl_groups = 0;
|
||||
+ msg.msg_name = &addr;
|
||||
+ msg.msg_namelen = sizeof (addr);
|
||||
+ msg.msg_iov = iov;
|
||||
+ msg.msg_iovlen = 2;
|
||||
+ msg.msg_control = NULL;
|
||||
+ msg.msg_controllen = 0;
|
||||
+ msg.msg_flags = 0;
|
||||
+ (void)sendmsg (fd, &msg, 0);
|
||||
+ close (fd);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/* Read a line of input. Prompt with PROMPT. An empty PROMPT means
|
||||
none. A return value of NULL means that EOF was encountered. */
|
||||
char *
|
||||
@@ -0,0 +1,12 @@
|
||||
diff -up bash-4.0/config-top.h.ssh_source_bash bash-4.0/config-top.h
|
||||
--- bash-4.0/config-top.h.ssh_source_bash 2009-01-21 15:20:06.000000000 +0100
|
||||
+++ bash-4.0/config-top.h 2009-01-21 15:25:46.000000000 +0100
|
||||
@@ -90,7 +90,7 @@
|
||||
sshd and source the .bashrc if so (like the rshd behavior). This checks
|
||||
for the presence of SSH_CLIENT or SSH2_CLIENT in the initial environment,
|
||||
which can be fooled under certain not-uncommon circumstances. */
|
||||
-/* #define SSH_SOURCE_BASHRC */
|
||||
+#define SSH_SOURCE_BASHRC
|
||||
|
||||
/* Define if you want the case-capitalizing operators (~[~]) and the
|
||||
`capcase' variable attribute (declare -c). */
|
||||
@@ -0,0 +1,154 @@
|
||||
diff -up bash-4.0/execute_cmd.c.nobits bash-4.0/execute_cmd.c
|
||||
--- bash-4.0/execute_cmd.c.nobits 2009-08-11 11:53:38.000000000 +0200
|
||||
+++ bash-4.0/execute_cmd.c 2009-08-14 16:18:18.000000000 +0200
|
||||
@@ -4747,6 +4747,7 @@ shell_execve (command, args, env)
|
||||
&& memcmp (sample, ELFMAG, SELFMAG) == 0)
|
||||
{
|
||||
off_t offset = -1;
|
||||
+ int dynamic_nobits = 0;
|
||||
|
||||
/* It is an ELF file. Now determine whether it is dynamically
|
||||
linked and if yes, get the offset of the interpreter
|
||||
@@ -4756,13 +4757,61 @@ shell_execve (command, args, env)
|
||||
{
|
||||
Elf32_Ehdr ehdr;
|
||||
Elf32_Phdr *phdr;
|
||||
- int nphdr;
|
||||
+ Elf32_Shdr *shdr;
|
||||
+ int nphdr, nshdr;
|
||||
|
||||
/* We have to copy the data since the sample buffer
|
||||
might not be aligned correctly to be accessed as
|
||||
an Elf32_Ehdr struct. */
|
||||
memcpy (&ehdr, sample, sizeof (Elf32_Ehdr));
|
||||
|
||||
+ nshdr = ehdr.e_shnum;
|
||||
+ shdr = (Elf32_Shdr *) malloc (nshdr * ehdr.e_shentsize);
|
||||
+
|
||||
+ if (shdr != NULL)
|
||||
+ {
|
||||
+#ifdef HAVE_PREAD
|
||||
+ sample_len = pread (fd, shdr, nshdr * ehdr.e_shentsize,
|
||||
+ ehdr.e_shoff);
|
||||
+#else
|
||||
+ if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)
|
||||
+ sample_len = read (fd, shdr,
|
||||
+ nshdr * ehdr.e_shentsize);
|
||||
+ else
|
||||
+ sample_len = -1;
|
||||
+#endif
|
||||
+ if (sample_len == nshdr * ehdr.e_shentsize)
|
||||
+ {
|
||||
+ char *strings = (char *) malloc (shdr[ehdr.e_shstrndx].sh_size);
|
||||
+ if (strings != NULL)
|
||||
+ {
|
||||
+#ifdef HAVE_PREAD
|
||||
+ sample_len = pread (fd, strings,
|
||||
+ shdr[ehdr.e_shstrndx].sh_size,
|
||||
+ shdr[ehdr.e_shstrndx].sh_offset);
|
||||
+#else
|
||||
+ if (lseek (fd, shdr[ehdr.e_shstrndx].sh_offset,
|
||||
+ SEEK_SET) != -1)
|
||||
+ sample_len = read (fd, strings,
|
||||
+ shdr[ehdr.e_shstrndx].sh_size);
|
||||
+ else
|
||||
+ sample_len = -1;
|
||||
+#endif
|
||||
+ if (sample_len == shdr[ehdr.e_shstrndx].sh_size)
|
||||
+ while (nshdr-- > 0)
|
||||
+ if (strcmp (strings + shdr[nshdr].sh_name,
|
||||
+ ".interp") == 0 &&
|
||||
+ shdr[nshdr].sh_type == SHT_NOBITS)
|
||||
+ {
|
||||
+ dynamic_nobits++;
|
||||
+ break;
|
||||
+ }
|
||||
+ free (strings);
|
||||
+ }
|
||||
+ }
|
||||
+ free (shdr);
|
||||
+ }
|
||||
+
|
||||
nphdr = ehdr.e_phnum;
|
||||
phdr = (Elf32_Phdr *) malloc (nphdr * ehdr.e_phentsize);
|
||||
if (phdr != NULL)
|
||||
@@ -4792,13 +4841,60 @@ shell_execve (command, args, env)
|
||||
{
|
||||
Elf64_Ehdr ehdr;
|
||||
Elf64_Phdr *phdr;
|
||||
- int nphdr;
|
||||
+ Elf64_Shdr *shdr;
|
||||
+ int nphdr, nshdr;
|
||||
|
||||
/* We have to copy the data since the sample buffer
|
||||
might not be aligned correctly to be accessed as
|
||||
an Elf64_Ehdr struct. */
|
||||
memcpy (&ehdr, sample, sizeof (Elf64_Ehdr));
|
||||
|
||||
+ nshdr = ehdr.e_shnum;
|
||||
+ shdr = (Elf64_Shdr *) malloc (nshdr * ehdr.e_shentsize);
|
||||
+ if (shdr != NULL)
|
||||
+ {
|
||||
+#ifdef HAVE_PREAD
|
||||
+ sample_len = pread (fd, shdr, nshdr * ehdr.e_shentsize,
|
||||
+ ehdr.e_shoff);
|
||||
+#else
|
||||
+ if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)
|
||||
+ sample_len = read (fd, shdr,
|
||||
+ nshdr * ehdr.e_shentsize);
|
||||
+ else
|
||||
+ sample_len = -1;
|
||||
+#endif
|
||||
+ if (sample_len == nshdr * ehdr.e_shentsize)
|
||||
+ {
|
||||
+ char *strings = (char *) malloc (shdr[ehdr.e_shstrndx].sh_size);
|
||||
+ if (strings != NULL)
|
||||
+ {
|
||||
+#ifdef HAVE_PREAD
|
||||
+ sample_len = pread (fd, strings,
|
||||
+ shdr[ehdr.e_shstrndx].sh_size,
|
||||
+ shdr[ehdr.e_shstrndx].sh_offset);
|
||||
+#else
|
||||
+ if (lseek (fd, shdr[ehdr.e_shstrndx].sh_offset,
|
||||
+ SEEK_SET) != -1)
|
||||
+ sample_len = read (fd, strings,
|
||||
+ shdr[ehdr.e_shstrndx].sh_size);
|
||||
+ else
|
||||
+ sample_len = -1;
|
||||
+#endif
|
||||
+ if (sample_len == shdr[ehdr.e_shstrndx].sh_size)
|
||||
+ while (nshdr-- > 0)
|
||||
+ if (strcmp (strings + shdr[nshdr].sh_name,
|
||||
+ ".interp") == 0 &&
|
||||
+ shdr[nshdr].sh_type == SHT_NOBITS)
|
||||
+ {
|
||||
+ dynamic_nobits++;
|
||||
+ break;
|
||||
+ }
|
||||
+ free (strings);
|
||||
+ }
|
||||
+ }
|
||||
+ free (shdr);
|
||||
+ }
|
||||
+
|
||||
nphdr = ehdr.e_phnum;
|
||||
phdr = (Elf64_Phdr *) malloc (nphdr * ehdr.e_phentsize);
|
||||
if (phdr != NULL)
|
||||
@@ -4858,8 +4954,15 @@ shell_execve (command, args, env)
|
||||
{
|
||||
close (fd);
|
||||
errno = i;
|
||||
- sys_error ("%s: %s: bad ELF interpreter", command,
|
||||
- interp);
|
||||
+ if (dynamic_nobits > 0)
|
||||
+ {
|
||||
+ sys_error ("%s: bad ELF interpreter", command);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ sys_error ("%s: %s: bad ELF interpreter", command,
|
||||
+ interp);
|
||||
+ }
|
||||
free (interp);
|
||||
return (EX_NOEXEC);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
diff -up bash-4.1/config-top.h.broken_pipe bash-4.1/config-top.h
|
||||
--- bash-4.1/config-top.h.broken_pipe 2011-01-06 18:01:30.000000000 +0100
|
||||
+++ bash-4.1/config-top.h 2011-01-06 18:02:14.000000000 +0100
|
||||
@@ -51,7 +51,7 @@
|
||||
/* Define DONT_REPORT_BROKEN_PIPE_WRITE_ERRORS if you don't want builtins
|
||||
like `echo' and `printf' to report errors when output does not succeed
|
||||
due to EPIPE. */
|
||||
-/* #define DONT_REPORT_BROKEN_PIPE_WRITE_ERRORS */
|
||||
+#define DONT_REPORT_BROKEN_PIPE_WRITE_ERRORS
|
||||
|
||||
/* The default value of the PATH variable. */
|
||||
#ifndef DEFAULT_PATH_VALUE
|
||||
@@ -0,0 +1,11 @@
|
||||
diff -pruN bash-4.1/jobs.c bash-4.1.patched/jobs.c
|
||||
--- bash-4.1/jobs.c 2009-11-30 03:42:05.000000000 +0530
|
||||
+++ bash-4.1.patched/jobs.c 2012-03-06 16:44:15.706595703 +0530
|
||||
@@ -3037,6 +3037,7 @@ waitchld (wpid, block)
|
||||
pid_t pid;
|
||||
|
||||
int call_set_current, last_stopped_job, job, children_exited, waitpid_flags;
|
||||
+ int called_from_sighand = sigchld;
|
||||
static int wcontinued = WCONTINUED; /* run-time fix for glibc problem */
|
||||
|
||||
call_set_current = children_exited = 0;
|
||||
@@ -0,0 +1,24 @@
|
||||
diff -up bash-4.1/examples/loadables/Makefile.in.examples bash-4.1/examples/loadables/Makefile.in
|
||||
--- bash-4.1/examples/loadables/Makefile.in.examples 2010-06-22 16:20:02.000000000 +0200
|
||||
+++ bash-4.1/examples/loadables/Makefile.in 2010-06-22 16:20:41.000000000 +0200
|
||||
@@ -43,7 +43,7 @@ host_os = @host_os@
|
||||
host_cpu = @host_cpu@
|
||||
host_vendor = @host_vendor@
|
||||
|
||||
-CFLAGS = @CFLAGS@
|
||||
+CFLAGS = -O2 -g
|
||||
LOCAL_CFLAGS = @LOCAL_CFLAGS@
|
||||
DEFS = @DEFS@
|
||||
LOCAL_DEFS = @LOCAL_DEFS@
|
||||
diff -up bash-4.1/examples/loadables/perl/Makefile.in.examples bash-4.1/examples/loadables/perl/Makefile.in
|
||||
--- bash-4.1/examples/loadables/perl/Makefile.in.examples 2010-06-22 16:20:46.000000000 +0200
|
||||
+++ bash-4.1/examples/loadables/perl/Makefile.in 2010-06-22 16:21:04.000000000 +0200
|
||||
@@ -42,7 +42,7 @@ SHELL = @MAKE_SHELL@
|
||||
|
||||
PERL5 = perl5
|
||||
|
||||
-CFLAGS = @CFLAGS@
|
||||
+CFLAGS = -O2 -g
|
||||
|
||||
#
|
||||
# These values are generated for configure by ${topdir}/support/shobj-conf.
|
||||
@@ -0,0 +1,99 @@
|
||||
diff -up bash-4.2/execute_cmd.c.coverity bash-4.2/execute_cmd.c
|
||||
--- bash-4.2/execute_cmd.c.coverity 2011-02-24 13:04:35.000000000 +0100
|
||||
+++ bash-4.2/execute_cmd.c 2011-02-24 13:49:13.000000000 +0100
|
||||
@@ -5036,7 +5036,7 @@ shell_execve (command, args, env)
|
||||
Elf32_Ehdr ehdr;
|
||||
Elf32_Phdr *phdr;
|
||||
Elf32_Shdr *shdr;
|
||||
- int nphdr, nshdr;
|
||||
+ Elf32_Half nphdr, nshdr;
|
||||
|
||||
/* We have to copy the data since the sample buffer
|
||||
might not be aligned correctly to be accessed as
|
||||
@@ -5044,12 +5044,12 @@ shell_execve (command, args, env)
|
||||
memcpy (&ehdr, sample, sizeof (Elf32_Ehdr));
|
||||
|
||||
nshdr = ehdr.e_shnum;
|
||||
- shdr = (Elf32_Shdr *) malloc (nshdr * ehdr.e_shentsize);
|
||||
+ shdr = (Elf32_Shdr *) malloc ((size_t)nshdr * (size_t)ehdr.e_shentsize);
|
||||
|
||||
if (shdr != NULL)
|
||||
{
|
||||
#ifdef HAVE_PREAD
|
||||
- sample_len = pread (fd, shdr, nshdr * ehdr.e_shentsize,
|
||||
+ sample_len = pread (fd, shdr, (size_t)nshdr * (size_t)ehdr.e_shentsize,
|
||||
ehdr.e_shoff);
|
||||
#else
|
||||
if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)
|
||||
@@ -5091,11 +5091,11 @@ shell_execve (command, args, env)
|
||||
}
|
||||
|
||||
nphdr = ehdr.e_phnum;
|
||||
- phdr = (Elf32_Phdr *) malloc (nphdr * ehdr.e_phentsize);
|
||||
+ phdr = (Elf32_Phdr *) malloc ((size_t)nphdr * (size_t)ehdr.e_phentsize);
|
||||
if (phdr != NULL)
|
||||
{
|
||||
#ifdef HAVE_PREAD
|
||||
- sample_len = pread (fd, phdr, nphdr * ehdr.e_phentsize,
|
||||
+ sample_len = pread (fd, phdr, (size_t)nphdr * (size_t)ehdr.e_phentsize,
|
||||
ehdr.e_phoff);
|
||||
#else
|
||||
if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)
|
||||
@@ -5120,7 +5120,7 @@ shell_execve (command, args, env)
|
||||
Elf64_Ehdr ehdr;
|
||||
Elf64_Phdr *phdr;
|
||||
Elf64_Shdr *shdr;
|
||||
- int nphdr, nshdr;
|
||||
+ Elf32_Half nphdr, nshdr;
|
||||
|
||||
/* We have to copy the data since the sample buffer
|
||||
might not be aligned correctly to be accessed as
|
||||
@@ -5128,11 +5128,11 @@ shell_execve (command, args, env)
|
||||
memcpy (&ehdr, sample, sizeof (Elf64_Ehdr));
|
||||
|
||||
nshdr = ehdr.e_shnum;
|
||||
- shdr = (Elf64_Shdr *) malloc (nshdr * ehdr.e_shentsize);
|
||||
+ shdr = (Elf64_Shdr *) malloc ((size_t)nshdr * (size_t)ehdr.e_shentsize);
|
||||
if (shdr != NULL)
|
||||
{
|
||||
#ifdef HAVE_PREAD
|
||||
- sample_len = pread (fd, shdr, nshdr * ehdr.e_shentsize,
|
||||
+ sample_len = pread (fd, shdr, (size_t)nshdr * (size_t)ehdr.e_shentsize,
|
||||
ehdr.e_shoff);
|
||||
#else
|
||||
if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)
|
||||
@@ -5174,11 +5174,11 @@ shell_execve (command, args, env)
|
||||
}
|
||||
|
||||
nphdr = ehdr.e_phnum;
|
||||
- phdr = (Elf64_Phdr *) malloc (nphdr * ehdr.e_phentsize);
|
||||
+ phdr = (Elf64_Phdr *) malloc ((size_t)nphdr * (size_t)ehdr.e_phentsize);
|
||||
if (phdr != NULL)
|
||||
{
|
||||
#ifdef HAVE_PREAD
|
||||
- sample_len = pread (fd, phdr, nphdr * ehdr.e_phentsize,
|
||||
+ sample_len = pread (fd, phdr, (size_t)nphdr * (size_t)ehdr.e_phentsize,
|
||||
ehdr.e_phoff);
|
||||
#else
|
||||
if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)
|
||||
@@ -5200,8 +5200,8 @@ shell_execve (command, args, env)
|
||||
|
||||
if (offset != -1)
|
||||
{
|
||||
- size_t maxlen = 0;
|
||||
- size_t actlen = 0;
|
||||
+ ssize_t maxlen = 0;
|
||||
+ ssize_t actlen = 0;
|
||||
char *interp = NULL;
|
||||
|
||||
do
|
||||
@@ -5250,7 +5250,8 @@ shell_execve (command, args, env)
|
||||
}
|
||||
#endif
|
||||
#if defined (HAVE_HASH_BANG_EXEC) || defined (HAVE_ELF_H)
|
||||
- close (fd);
|
||||
+ if (fd >= 0)
|
||||
+ close (fd);
|
||||
#endif
|
||||
errno = i;
|
||||
file_error (command);
|
||||
@@ -0,0 +1,12 @@
|
||||
diff -up bash-4.1/doc/bash.1.manpage_trap bash-4.1/doc/bash.1
|
||||
--- bash-4.1/doc/bash.1.manpage_trap 2012-08-28 10:06:00.561999092 +0200
|
||||
+++ bash-4.1/doc/bash.1 2012-08-28 10:06:24.225304505 +0200
|
||||
@@ -9251,7 +9251,7 @@ being inverted via
|
||||
These are the same conditions obeyed by the \fBerrexit\fP (\fB\-e\fP) option.
|
||||
.if t .sp 0.5
|
||||
.if n .sp 1
|
||||
-Signals ignored upon entry to the shell cannot be trapped or reset.
|
||||
+Signals ignored upon entry to the shell cannot be trapped, reset or listed.
|
||||
Trapped signals that are not being ignored are reset to their original
|
||||
values in a subshell or subshell environment when one is created.
|
||||
The return status is false if any
|
||||
@@ -0,0 +1,36 @@
|
||||
diff -up bash-3.2/config-top.h.logout bash-3.2/config-top.h
|
||||
--- bash-3.2/config-top.h.logout 2011-04-14 08:55:55.000000000 +0200
|
||||
+++ bash-3.2/config-top.h 2011-04-14 08:55:55.000000000 +0200
|
||||
@@ -78,7 +78,7 @@
|
||||
/* #define SYS_BASHRC "/etc/bash.bashrc" */
|
||||
|
||||
/* System-wide .bash_logout for login shells. */
|
||||
-/* #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" */
|
||||
+#define SYS_BASH_LOGOUT "/etc/bash.bash_logout"
|
||||
|
||||
/* Define this to make non-interactive shells begun with argv[0][0] == '-'
|
||||
run the startup files when not in posix mode. */
|
||||
diff -up bash-3.2/doc/bash.1.logout bash-3.2/doc/bash.1
|
||||
--- bash-3.2/doc/bash.1.logout 2011-04-14 09:16:32.000000000 +0200
|
||||
+++ bash-3.2/doc/bash.1 2011-04-14 11:59:33.000000000 +0200
|
||||
@@ -326,8 +326,8 @@ option may be used when the shell is sta
|
||||
.PP
|
||||
When a login shell exits,
|
||||
.B bash
|
||||
-reads and executes commands from the file \fI~/.bash_logout\fP, if it
|
||||
-exists.
|
||||
+reads and executes commands from the files \fI~/.bash_logout\fP
|
||||
+and \fI/etc/bash.bash_logout\fP, if the files exists.
|
||||
.PP
|
||||
When an interactive shell that is not a login shell is started,
|
||||
.B bash
|
||||
@@ -8814,6 +8814,9 @@ The \fBbash\fP executable
|
||||
.FN /etc/profile
|
||||
The systemwide initialization file, executed for login shells
|
||||
.TP
|
||||
+.FN /etc/bash.bash_logout
|
||||
+The systemwide login shell cleanup file, executed when a login shell exits
|
||||
+.TP
|
||||
.FN ~/.bash_profile
|
||||
The personal initialization file, executed for login shells
|
||||
.TP
|
||||
@@ -0,0 +1,14 @@
|
||||
diff -up bash-4.2/variables.h.size_type bash-4.2/variables.h
|
||||
--- bash-4.2/variables.h.size_type 2012-11-29 10:33:25.109036844 +0100
|
||||
+++ bash-4.2/variables.h 2012-11-29 10:46:12.718530162 +0100
|
||||
@@ -95,8 +95,8 @@ typedef struct variable {
|
||||
|
||||
typedef struct _vlist {
|
||||
SHELL_VAR **list;
|
||||
- int list_size; /* allocated size */
|
||||
- int list_len; /* current number of entries */
|
||||
+ size_t list_size; /* allocated size */
|
||||
+ size_t list_len; /* current number of entries */
|
||||
} VARLIST;
|
||||
|
||||
/* The various attributes that a given variable can have. */
|
||||
@@ -0,0 +1,60 @@
|
||||
commit 41d203e21f94c1b8bfc457606ee633c22da3cf04
|
||||
Author: Chet Ramey <chet.ramey@case.edu>
|
||||
Date: Wed Jun 12 09:29:51 2013 -0400
|
||||
|
||||
commit bash-20130523 snapshot
|
||||
|
||||
diff --git a/trap.c b/trap.c
|
||||
index 1e11d1f..da59b26 100644
|
||||
--- a/trap.c
|
||||
+++ b/trap.c
|
||||
@@ -286,6 +286,9 @@ run_pending_traps ()
|
||||
if (catch_flag == 0) /* simple optimization */
|
||||
return;
|
||||
|
||||
+ if (running_trap > 0)
|
||||
+ return; /* no recursive trap invocations */
|
||||
+
|
||||
catch_flag = trapped_signal_received = 0;
|
||||
|
||||
/* Preserve $? when running trap. */
|
||||
@@ -304,6 +307,8 @@ run_pending_traps ()
|
||||
|
||||
BLOCK_SIGNAL (sig, set, oset);
|
||||
|
||||
+ running_trap = sig + 1;
|
||||
+
|
||||
if (sig == SIGINT)
|
||||
{
|
||||
run_interrupt_trap ();
|
||||
@@ -324,6 +329,7 @@ run_pending_traps ()
|
||||
{
|
||||
/* This can happen when run_pending_traps is called while
|
||||
running a SIGCHLD trap handler. */
|
||||
+ running_trap = 0;
|
||||
UNBLOCK_SIGNAL (oset);
|
||||
continue; /* XXX */
|
||||
}
|
||||
@@ -359,7 +365,14 @@ run_pending_traps ()
|
||||
save_subst_varlist = subst_assign_varlist;
|
||||
subst_assign_varlist = 0;
|
||||
|
||||
+#if defined (JOB_CONTROL)
|
||||
+ save_pipeline (1); /* XXX only provides one save level */
|
||||
+#endif
|
||||
evalstring (savestring (trap_list[sig]), "trap", SEVAL_NONINT|SEVAL_NOHIST|SEVAL_RESETLINE);
|
||||
+#if defined (JOB_CONTROL)
|
||||
+ restore_pipeline (1);
|
||||
+#endif
|
||||
+
|
||||
restore_token_state (token_state);
|
||||
free (token_state);
|
||||
|
||||
@@ -367,6 +380,7 @@ run_pending_traps ()
|
||||
}
|
||||
|
||||
pending_traps[sig] = 0;
|
||||
+ running_trap = 0;
|
||||
|
||||
UNBLOCK_SIGNAL (oset);
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
diff -up bash-4.2-rc2/doc/bash.1.bashbug bash-4.2-rc2/doc/bash.1
|
||||
--- bash-4.2-rc2/doc/bash.1.bashbug 2011-01-16 21:31:39.000000000 +0100
|
||||
+++ bash-4.2-rc2/doc/bash.1 2011-02-09 08:52:14.000000000 +0100
|
||||
@@ -9857,7 +9857,7 @@ The latest version is always available f
|
||||
.PP
|
||||
Once you have determined that a bug actually exists, use the
|
||||
.I bashbug
|
||||
-command to submit a bug report.
|
||||
+command (from the source package) to submit a bug report.
|
||||
If you have a fix, you are encouraged to mail that as well!
|
||||
Suggestions and `philosophical' bug reports may be mailed
|
||||
to \fIbug-bash@gnu.org\fP or posted to the Usenet
|
||||
@@ -9879,10 +9879,6 @@ A description of the bug behaviour
|
||||
A short script or `recipe' which exercises the bug
|
||||
.PD
|
||||
.PP
|
||||
-.I bashbug
|
||||
-inserts the first three items automatically into the template
|
||||
-it provides for filing a bug report.
|
||||
-.PP
|
||||
Comments and bug reports concerning
|
||||
this manual page should be directed to
|
||||
.IR chet.ramey@case.edu .
|
||||
diff -up bash-4.2-rc2/doc/bashref.texi.bashbug bash-4.2-rc2/doc/bashref.texi
|
||||
--- bash-4.2-rc2/doc/bashref.texi.bashbug 2011-01-16 21:31:57.000000000 +0100
|
||||
+++ bash-4.2-rc2/doc/bashref.texi 2011-02-09 08:47:07.000000000 +0100
|
||||
@@ -7635,7 +7635,7 @@ The latest version of Bash is always ava
|
||||
@uref{ftp://ftp.gnu.org/pub/gnu/bash/}.
|
||||
|
||||
Once you have determined that a bug actually exists, use the
|
||||
-@code{bashbug} command to submit a bug report.
|
||||
+@code{bashbug} command (from the source package) to submit a bug report.
|
||||
If you have a fix, you are encouraged to mail that as well!
|
||||
Suggestions and `philosophical' bug reports may be mailed
|
||||
to @email{bug-bash@@gnu.org} or posted to the Usenet
|
||||
@@ -7657,9 +7657,6 @@ to reproduce it.
|
||||
@end itemize
|
||||
|
||||
@noindent
|
||||
-@code{bashbug} inserts the first three items automatically into
|
||||
-the template it provides for filing a bug report.
|
||||
-
|
||||
Please send all reports concerning this manual to
|
||||
@email{bug-bash@@gnu.org}.
|
||||
|
||||
diff -up bash-4.2-rc2/shell.c.bashbug bash-4.2-rc2/shell.c
|
||||
--- bash-4.2-rc2/shell.c.bashbug 2011-01-02 22:04:51.000000000 +0100
|
||||
+++ bash-4.2-rc2/shell.c 2011-02-09 08:47:07.000000000 +0100
|
||||
@@ -1823,7 +1823,6 @@ show_shell_usage (fp, extra)
|
||||
{
|
||||
fprintf (fp, _("Type `%s -c \"help set\"' for more information about shell options.\n"), shell_name);
|
||||
fprintf (fp, _("Type `%s -c help' for more information about shell builtin commands.\n"), shell_name);
|
||||
- fprintf (fp, _("Use the `bashbug' command to report bugs.\n"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
--- bash-3.1/doc/Makefile.in.infotags 2006-07-12 13:57:18.000000000 +0100
|
||||
+++ bash-3.1/doc/Makefile.in 2006-07-12 13:58:25.000000000 +0100
|
||||
@@ -69,7 +69,6 @@
|
||||
TEXI2HTML = ${SUPPORT_SRCDIR}/texi2html
|
||||
MAN2HTML = ${BUILD_DIR}/support/man2html
|
||||
HTMLPOST = ${srcdir}/htmlpost.sh
|
||||
-INFOPOST = ${srcdir}/infopost.sh
|
||||
QUIETPS = #set this to -q to shut up dvips
|
||||
PAPERSIZE = letter # change to a4 for A4-size paper
|
||||
PSDPI = 600 # could be 300 if you like
|
||||
@@ -146,7 +145,7 @@
|
||||
|
||||
PSFILES = bash.ps bashbug.ps article.ps builtins.ps rbash.ps
|
||||
DVIFILES = bashref.dvi bashref.ps
|
||||
-INFOFILES = bashref.info
|
||||
+INFOFILES = bashref.info bash.info
|
||||
MAN0FILES = bash.0 bashbug.0 builtins.0 rbash.0
|
||||
HTMLFILES = bashref.html bash.html
|
||||
PDFFILES = bash.pdf bashref.pdf article.pdf rose94.pdf
|
||||
@@ -167,8 +166,8 @@
|
||||
bashref.html: $(BASHREF_FILES) $(HSUSER) $(RLUSER)
|
||||
$(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/bashref.texi
|
||||
|
||||
-bash.info: bashref.info
|
||||
- ${SHELL} ${INFOPOST} < $(srcdir)/bashref.info > $@ ; \
|
||||
+bash.info: $(BASHREF_FILES) $(HSUSER) $(RLUSER)
|
||||
+ $(MAKEINFO) --no-split -I$(TEXINPUTDIR) $(srcdir)/bashref.texi -o $@
|
||||
|
||||
bash.txt: bash.1
|
||||
bash.ps: bash.1
|
||||
@@ -0,0 +1,311 @@
|
||||
diff -up bash-4.1/builtins.h.requires bash-4.1/builtins.h
|
||||
--- bash-4.1/builtins.h.requires 2009-01-04 20:32:23.000000000 +0100
|
||||
+++ bash-4.1/builtins.h 2010-08-02 17:42:41.000000000 +0200
|
||||
@@ -41,6 +41,8 @@
|
||||
#define SPECIAL_BUILTIN 0x08 /* This is a Posix `special' builtin. */
|
||||
#define ASSIGNMENT_BUILTIN 0x10 /* This builtin takes assignment statements. */
|
||||
#define POSIX_BUILTIN 0x20 /* This builtins is special in the Posix command search order. */
|
||||
+#define REQUIRES_BUILTIN 0x40 /* This builtin requires other files. */
|
||||
+
|
||||
|
||||
#define BASE_INDENT 4
|
||||
|
||||
diff -up bash-4.1/builtins/mkbuiltins.c.requires bash-4.1/builtins/mkbuiltins.c
|
||||
--- bash-4.1/builtins/mkbuiltins.c.requires 2009-01-04 20:32:23.000000000 +0100
|
||||
+++ bash-4.1/builtins/mkbuiltins.c 2010-08-02 17:42:41.000000000 +0200
|
||||
@@ -69,9 +69,15 @@ extern char *strcpy ();
|
||||
#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
|
||||
|
||||
/* Flag values that builtins can have. */
|
||||
+/* These flags are for the C code generator,
|
||||
+ the C which is produced (./builtin.c)
|
||||
+ includes the flags definitions found
|
||||
+ in ../builtins.h */
|
||||
#define BUILTIN_FLAG_SPECIAL 0x01
|
||||
#define BUILTIN_FLAG_ASSIGNMENT 0x02
|
||||
#define BUILTIN_FLAG_POSIX_BUILTIN 0x04
|
||||
+#define BUILTIN_FLAG_REQUIRES 0x08
|
||||
+
|
||||
|
||||
#define BASE_INDENT 4
|
||||
|
||||
@@ -163,10 +169,18 @@ char *posix_builtins[] =
|
||||
(char *)NULL
|
||||
};
|
||||
|
||||
+/* The builtin commands that cause requirements on other files. */
|
||||
+static char *requires_builtins[] =
|
||||
+{
|
||||
+ ".", "command", "exec", "source", "inlib",
|
||||
+ (char *)NULL
|
||||
+};
|
||||
+
|
||||
/* Forward declarations. */
|
||||
static int is_special_builtin ();
|
||||
static int is_assignment_builtin ();
|
||||
static int is_posix_builtin ();
|
||||
+static int is_requires_builtin ();
|
||||
|
||||
#if !defined (HAVE_RENAME)
|
||||
static int rename ();
|
||||
@@ -812,6 +826,9 @@ builtin_handler (self, defs, arg)
|
||||
new->flags |= BUILTIN_FLAG_ASSIGNMENT;
|
||||
if (is_posix_builtin (name))
|
||||
new->flags |= BUILTIN_FLAG_POSIX_BUILTIN;
|
||||
+ if (is_requires_builtin (name))
|
||||
+ new->flags |= BUILTIN_FLAG_REQUIRES;
|
||||
+
|
||||
|
||||
array_add ((char *)new, defs->builtins);
|
||||
building_builtin = 1;
|
||||
@@ -1229,11 +1246,12 @@ write_builtins (defs, structfile, extern
|
||||
else
|
||||
fprintf (structfile, "(sh_builtin_func_t *)0x0, ");
|
||||
|
||||
- fprintf (structfile, "%s%s%s%s, %s_doc,\n",
|
||||
+ fprintf (structfile, "%s%s%s%s%s, %s_doc,\n",
|
||||
"BUILTIN_ENABLED | STATIC_BUILTIN",
|
||||
(builtin->flags & BUILTIN_FLAG_SPECIAL) ? " | SPECIAL_BUILTIN" : "",
|
||||
(builtin->flags & BUILTIN_FLAG_ASSIGNMENT) ? " | ASSIGNMENT_BUILTIN" : "",
|
||||
(builtin->flags & BUILTIN_FLAG_POSIX_BUILTIN) ? " | POSIX_BUILTIN" : "",
|
||||
+ (builtin->flags & BUILTIN_FLAG_REQUIRES) ? " | REQUIRES_BUILTIN" : "",
|
||||
document_name (builtin));
|
||||
|
||||
if (inhibit_functions)
|
||||
@@ -1581,6 +1599,13 @@ is_posix_builtin (name)
|
||||
return (_find_in_table (name, posix_builtins));
|
||||
}
|
||||
|
||||
+static int
|
||||
+is_requires_builtin (name)
|
||||
+ char *name;
|
||||
+{
|
||||
+ return (_find_in_table (name, requires_builtins));
|
||||
+}
|
||||
+
|
||||
#if !defined (HAVE_RENAME)
|
||||
static int
|
||||
rename (from, to)
|
||||
diff -up bash-4.1/doc/bash.1.requires bash-4.1/doc/bash.1
|
||||
--- bash-4.1/doc/bash.1.requires 2010-08-02 17:42:41.000000000 +0200
|
||||
+++ bash-4.1/doc/bash.1 2010-08-02 18:09:27.000000000 +0200
|
||||
@@ -231,6 +231,14 @@ The shell becomes restricted (see
|
||||
.B "RESTRICTED SHELL"
|
||||
below).
|
||||
.TP
|
||||
+.B \-\-rpm-requires
|
||||
+Produce the list of files that are required for the
|
||||
+shell script to run. This implies '-n' and is subject
|
||||
+to the same limitations as compile time error checking checking;
|
||||
+Command substitutions, Conditional expressions and
|
||||
+.BR eval
|
||||
+builtin are not parsed so some dependencies may be missed.
|
||||
+.TP
|
||||
.B \-\-verbose
|
||||
Equivalent to \fB\-v\fP.
|
||||
.TP
|
||||
diff -up bash-4.1/doc/bashref.texi.requires bash-4.1/doc/bashref.texi
|
||||
--- bash-4.1/doc/bashref.texi.requires 2010-08-02 17:42:41.000000000 +0200
|
||||
+++ bash-4.1/doc/bashref.texi 2010-08-02 18:11:58.000000000 +0200
|
||||
@@ -5343,6 +5343,13 @@ standard. @xref{Bash POSIX Mode}, for a
|
||||
@item --restricted
|
||||
Make the shell a restricted shell (@pxref{The Restricted Shell}).
|
||||
|
||||
+@item --rpm-requires
|
||||
+Produce the list of files that are required for the
|
||||
+shell script to run. This implies '-n' and is subject
|
||||
+to the same limitations as compile time error checking checking;
|
||||
+Command substitutions, Conditional expressions and @command{eval}
|
||||
+are not parsed so some dependencies may be missed.
|
||||
+
|
||||
@item --verbose
|
||||
Equivalent to @option{-v}. Print shell input lines as they're read.
|
||||
|
||||
diff -up bash-4.1/eval.c.requires bash-4.1/eval.c
|
||||
--- bash-4.1/eval.c.requires 2009-01-04 20:32:26.000000000 +0100
|
||||
+++ bash-4.1/eval.c 2010-08-02 17:42:41.000000000 +0200
|
||||
@@ -53,6 +53,7 @@ extern int last_command_exit_value, stdi
|
||||
extern int need_here_doc;
|
||||
extern int current_command_number, current_command_line_count, line_number;
|
||||
extern int expand_aliases;
|
||||
+extern int rpm_requires;
|
||||
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
extern sigset_t top_level_mask;
|
||||
@@ -136,7 +137,7 @@ reader_loop ()
|
||||
|
||||
if (read_command () == 0)
|
||||
{
|
||||
- if (interactive_shell == 0 && read_but_dont_execute)
|
||||
+ if (interactive_shell == 0 && (read_but_dont_execute && !rpm_requires))
|
||||
{
|
||||
last_command_exit_value = EXECUTION_SUCCESS;
|
||||
dispose_command (global_command);
|
||||
diff -up bash-4.1/execute_cmd.c.requires bash-4.1/execute_cmd.c
|
||||
--- bash-4.1/execute_cmd.c.requires 2010-08-02 17:42:41.000000000 +0200
|
||||
+++ bash-4.1/execute_cmd.c 2010-08-02 17:42:41.000000000 +0200
|
||||
@@ -503,6 +503,8 @@ async_redirect_stdin ()
|
||||
|
||||
#define DESCRIBE_PID(pid) do { if (interactive) describe_pid (pid); } while (0)
|
||||
|
||||
+extern int rpm_requires;
|
||||
+
|
||||
/* Execute the command passed in COMMAND, perhaps doing it asynchronously.
|
||||
COMMAND is exactly what read_command () places into GLOBAL_COMMAND.
|
||||
ASYNCHROUNOUS, if non-zero, says to do this command in the background.
|
||||
@@ -534,7 +536,13 @@ execute_command_internal (command, async
|
||||
|
||||
if (breaking || continuing)
|
||||
return (last_command_exit_value);
|
||||
- if (command == 0 || read_but_dont_execute)
|
||||
+ if (command == 0 || (read_but_dont_execute && !rpm_requires))
|
||||
+ return (EXECUTION_SUCCESS);
|
||||
+ if (rpm_requires && command->type == cm_function_def)
|
||||
+ return last_command_exit_value =
|
||||
+ execute_intern_function (command->value.Function_def->name,
|
||||
+ command->value.Function_def->command);
|
||||
+ if (read_but_dont_execute)
|
||||
return (EXECUTION_SUCCESS);
|
||||
|
||||
QUIT;
|
||||
@@ -5066,7 +5074,7 @@ execute_intern_function (name, function)
|
||||
|
||||
if (check_identifier (name, posixly_correct) == 0)
|
||||
{
|
||||
- if (posixly_correct && interactive_shell == 0)
|
||||
+ if (posixly_correct && interactive_shell == 0 && rpm_requires == 0)
|
||||
{
|
||||
last_command_exit_value = EX_BADUSAGE;
|
||||
jump_to_top_level (ERREXIT);
|
||||
diff -up bash-4.1/execute_cmd.h.requires bash-4.1/execute_cmd.h
|
||||
--- bash-4.1/execute_cmd.h.requires 2009-01-16 22:20:15.000000000 +0100
|
||||
+++ bash-4.1/execute_cmd.h 2010-08-02 17:42:41.000000000 +0200
|
||||
@@ -22,6 +22,8 @@
|
||||
#define _EXECUTE_CMD_H_
|
||||
|
||||
#include "stdc.h"
|
||||
+#include "variables.h"
|
||||
+#include "command.h"
|
||||
|
||||
extern struct fd_bitmap *new_fd_bitmap __P((int));
|
||||
extern void dispose_fd_bitmap __P((struct fd_bitmap *));
|
||||
diff -up bash-4.1/make_cmd.c.requires bash-4.1/make_cmd.c
|
||||
--- bash-4.1/make_cmd.c.requires 2009-09-11 23:26:12.000000000 +0200
|
||||
+++ bash-4.1/make_cmd.c 2010-08-02 17:42:41.000000000 +0200
|
||||
@@ -42,11 +42,15 @@
|
||||
#include "flags.h"
|
||||
#include "make_cmd.h"
|
||||
#include "dispose_cmd.h"
|
||||
+#include "execute_cmd.h"
|
||||
#include "variables.h"
|
||||
#include "subst.h"
|
||||
#include "input.h"
|
||||
#include "ocache.h"
|
||||
#include "externs.h"
|
||||
+#include "builtins.h"
|
||||
+
|
||||
+#include "builtins/common.h"
|
||||
|
||||
#if defined (JOB_CONTROL)
|
||||
#include "jobs.h"
|
||||
@@ -56,6 +60,10 @@
|
||||
|
||||
extern int line_number, current_command_line_count, parser_state;
|
||||
extern int last_command_exit_value;
|
||||
+extern int rpm_requires;
|
||||
+
|
||||
+static char *alphabet_set = "abcdefghijklmnopqrstuvwxyz"
|
||||
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
/* Object caching */
|
||||
sh_obj_cache_t wdcache = {0, 0, 0};
|
||||
@@ -820,6 +828,27 @@ make_coproc_command (name, command)
|
||||
return (make_command (cm_coproc, (SIMPLE_COM *)temp));
|
||||
}
|
||||
|
||||
+static void
|
||||
+output_requirement (deptype, filename)
|
||||
+const char *deptype;
|
||||
+char *filename;
|
||||
+{
|
||||
+ if (strchr(filename, '$') || (filename[0] != '/' && strchr(filename, '/')))
|
||||
+ return;
|
||||
+
|
||||
+ /*
|
||||
+ if the executable is called via variable substitution we can
|
||||
+ not dermine what it is at compile time.
|
||||
+
|
||||
+ if the executable consists only of characters not in the
|
||||
+ alphabet we do not consider it a dependency just an artifact
|
||||
+ of shell parsing (ex "exec < ${infile}").
|
||||
+ */
|
||||
+
|
||||
+ if (strpbrk(filename, alphabet_set))
|
||||
+ printf ("%s(%s)\n", deptype, filename);
|
||||
+}
|
||||
+
|
||||
/* Reverse the word list and redirection list in the simple command
|
||||
has just been parsed. It seems simpler to do this here the one
|
||||
time then by any other method that I can think of. */
|
||||
@@ -837,6 +866,27 @@ clean_simple_command (command)
|
||||
REVERSE_LIST (command->value.Simple->redirects, REDIRECT *);
|
||||
}
|
||||
|
||||
+ if (rpm_requires && command->value.Simple->words)
|
||||
+ {
|
||||
+ char *cmd0;
|
||||
+ char *cmd1;
|
||||
+ struct builtin *b;
|
||||
+
|
||||
+ cmd0 = command->value.Simple->words->word->word;
|
||||
+ b = builtin_address_internal (cmd0, 0);
|
||||
+ cmd1 = 0;
|
||||
+ if (command->value.Simple->words->next)
|
||||
+ cmd1 = command->value.Simple->words->next->word->word;
|
||||
+
|
||||
+ if (b) {
|
||||
+ if ( (b->flags & REQUIRES_BUILTIN) && cmd1)
|
||||
+ output_requirement ("executable", cmd1);
|
||||
+ } else {
|
||||
+ if (!assignment(cmd0, 0))
|
||||
+ output_requirement (find_function(cmd0) ? "function" : "executable", cmd0);
|
||||
+ }
|
||||
+ } /*rpm_requires*/
|
||||
+
|
||||
parser_state &= ~PST_REDIRLIST;
|
||||
return (command);
|
||||
}
|
||||
diff -up bash-4.1/shell.c.requires bash-4.1/shell.c
|
||||
--- bash-4.1/shell.c.requires 2010-08-02 17:42:41.000000000 +0200
|
||||
+++ bash-4.1/shell.c 2010-08-02 17:42:41.000000000 +0200
|
||||
@@ -193,6 +193,9 @@ int have_devfd = 0;
|
||||
/* The name of the .(shell)rc file. */
|
||||
static char *bashrc_file = "~/.bashrc";
|
||||
|
||||
+/* Non-zero if we are finding the scripts requirements. */
|
||||
+int rpm_requires;
|
||||
+
|
||||
/* Non-zero means to act more like the Bourne shell on startup. */
|
||||
static int act_like_sh;
|
||||
|
||||
@@ -251,6 +254,7 @@ static const struct {
|
||||
{ "protected", Int, &protected_mode, (char **)0x0 },
|
||||
#endif
|
||||
{ "rcfile", Charp, (int *)0x0, &bashrc_file },
|
||||
+ { "rpm-requires", Int, &rpm_requires, (char **)0x0 },
|
||||
#if defined (RESTRICTED_SHELL)
|
||||
{ "restricted", Int, &restricted, (char **)0x0 },
|
||||
#endif
|
||||
@@ -485,6 +489,12 @@ main (argc, argv, env)
|
||||
if (dump_translatable_strings)
|
||||
read_but_dont_execute = 1;
|
||||
|
||||
+ if (rpm_requires)
|
||||
+ {
|
||||
+ read_but_dont_execute = 1;
|
||||
+ initialize_shell_builtins ();
|
||||
+ }
|
||||
+
|
||||
if (running_setuid && privileged_mode == 0)
|
||||
disable_priv_mode ();
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--- bash-3.0/builtins/setattr.def.setlocale 2005-08-08 12:22:42.000000000 +0100
|
||||
+++ bash-3.0/builtins/setattr.def 2005-08-08 12:25:16.000000000 +0100
|
||||
@@ -423,4 +423,7 @@
|
||||
|
||||
if (var && (exported_p (var) || (attribute & att_exported)))
|
||||
array_needs_making++; /* XXX */
|
||||
+
|
||||
+ if (var)
|
||||
+ stupidly_hack_special_variables (name);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
diff -up bash-4.2-rc2/tests/exec.right.tty_tests bash-4.2-rc2/tests/exec.right
|
||||
--- bash-4.2-rc2/tests/exec.right.tty_tests 2011-02-09 10:42:48.000000000 +0100
|
||||
+++ bash-4.2-rc2/tests/exec.right 2011-02-09 10:42:59.000000000 +0100
|
||||
@@ -50,7 +50,6 @@ this is ohio-state
|
||||
0
|
||||
1
|
||||
testb
|
||||
-expand_aliases on
|
||||
1
|
||||
1
|
||||
1
|
||||
diff -up bash-4.2-rc2/tests/execscript.tty_tests bash-4.2-rc2/tests/execscript
|
||||
--- bash-4.2-rc2/tests/execscript.tty_tests 2010-12-27 22:01:02.000000000 +0100
|
||||
+++ bash-4.2-rc2/tests/execscript 2011-02-09 10:42:34.000000000 +0100
|
||||
@@ -107,8 +107,6 @@ ${THIS_SH} ./exec6.sub
|
||||
# checks for properly deciding what constitutes an executable file
|
||||
${THIS_SH} ./exec7.sub
|
||||
|
||||
-${THIS_SH} -i ./exec8.sub
|
||||
-
|
||||
${THIS_SH} ./exec9.sub
|
||||
|
||||
true | `echo true` &
|
||||
diff -up bash-4.2-rc2/tests/read.right.tty_tests bash-4.2-rc2/tests/read.right
|
||||
--- bash-4.2-rc2/tests/read.right.tty_tests 2010-12-21 16:49:00.000000000 +0100
|
||||
+++ bash-4.2-rc2/tests/read.right 2011-02-09 10:42:34.000000000 +0100
|
||||
@@ -33,14 +33,6 @@ a = abcdefg
|
||||
a = xyz
|
||||
a = -xyz 123-
|
||||
a = abc
|
||||
-timeout 1: ok
|
||||
-
|
||||
-timeout 2: ok
|
||||
-
|
||||
-./read2.sub: line 23: read: -3: invalid timeout specification
|
||||
-1
|
||||
-
|
||||
-abcde
|
||||
./read3.sub: line 4: read: -1: invalid number
|
||||
abc
|
||||
ab
|
||||
diff -up bash-4.2-rc2/tests/read.tests.tty_tests bash-4.2-rc2/tests/read.tests
|
||||
--- bash-4.2-rc2/tests/read.tests.tty_tests 2008-09-06 19:09:11.000000000 +0200
|
||||
+++ bash-4.2-rc2/tests/read.tests 2011-02-09 10:42:34.000000000 +0100
|
||||
@@ -82,9 +82,6 @@ echo " foo" | { IFS=$':' ; read line; re
|
||||
# test read -d delim behavior
|
||||
${THIS_SH} ./read1.sub
|
||||
|
||||
-# test read -t timeout behavior
|
||||
-${THIS_SH} ./read2.sub
|
||||
-
|
||||
# test read -n nchars behavior
|
||||
${THIS_SH} ./read3.sub
|
||||
|
||||
Reference in New Issue
Block a user