examples/loadables/{basename,cut,dirname,finfo,head,ln,logname,mkdir,pathchk,print,printenv,push,realpath,rmdir,sleep,tee,truefalse,tty,uname,unlink,whoami}.c
- fix up some includes. Fix from Mike Frysinger <vapier@gentoo.org>
+
+ 8/21
+ ----
+histexpand.c
+ - fix another memory leak in history_find_word. Bug report originally
+ from Michael Snyder <msnyder@sonic.net>; test case suggested by Jim
+ Blandy <jimb@codesourcery.com>
+
+ 8/26
+ ----
+subst.c
+ - change to do_assignment_internal to make an assignment to a variable
+ with the `noassign' internal attribute not a variable assignment
+ error.
- add @LDFLAGS@ to SHOBJ_LDFLAGS assignment -- experimental. Suggested
by Mike Frysinger <vapier@gentoo.org>
-examples/loadables/{
+examples/loadables/{basename,cut,dirname,finfo,head,ln,logname,mkdir,pathchk,print,printenv,push,realpath,rmdir,sleep,tee,truefalse,tty,uname,unlink,whoami}.c
+ - fix up some includes. Fix from Mike Frysinger <vapier@gentoo.org>
+
+ 8/21
+ ----
+histexpand.c
+ - fix another memory leak in history_find_word. Bug report originally
+ from Michael Snyder <msnyder@sonic.net>; test case suggested by Jim
+ Blandy <jimb@codesourcery.com>
+
+ 8/26
+ ----
+subst.c
+ - change to do_assignment_internal to make an assignment to a variable
+ with the `noassign' internal attribute not a variable assignment
+ error
$BUILTIN exec
$FUNCTION exec_builtin
-$SHORT_DOC exec [-cl] [-a name] [command [arguments ...]]
+$SHORT_DOC exec [-cl] [-a name] [command [arguments ...]] [redirection ...]
Execute COMMAND, replacing this shell with the specified program.
ARGUMENTS become the arguments to COMMAND. If COMMAND is not specified,
any redirections take effect in the current shell. If the `-l' option
is supplied, the shell places a dash in the zeroth argument to the
COMMAND, as login does. If the `-c' option is supplied, COMMAND is
executed with an empty environment. The `-a' option causes the shell
-to pass NAME as the zeroth argument to COMMAND. If the file cannot be
+to pass NAME as the zeroth argument to COMMAND. If the command cannot be
executed, a non-interactive shell exits, unless the shell option `execfail'
-is set.
+is set. If COMMAND is absent, any redirections specified take effect in the
+calling shell.
$END
#include <config.h>
This file is exec.def, from which is created exec.c.
It implements the builtin "exec" in Bash.
-Copyright (C) 1987-2003 Free Software Foundation, Inc.
+Copyright (C) 1987-2007 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
$BUILTIN exec
$FUNCTION exec_builtin
-$SHORT_DOC exec [-cl] [-a name] file [redirection ...]
-Execute FILE, replacing this shell with the specified program.
-If FILE is not specified, the redirections take effect in this
-shell. If the first argument is `-l', then place a dash in the
-zeroth arg passed to FILE, as login does. If the `-c' option
-is supplied, FILE is executed with a null environment. The `-a'
-option means set argv[0] of the executed process to NAME.
-If the file cannot be executed and the shell is not interactive,
-then the shell exits, unless the shell option `execfail' is set.
+$SHORT_DOC exec [-cl] [-a name] [command [arguments ...]] [redirection ...]
+Execute COMMAND, replacing this shell with the specified program.
+ARGUMENTS become the arguments to COMMAND. If COMMAND is not specified,
+any redirections take effect in the current shell. If the `-l' option
+is supplied, the shell places a dash in the zeroth argument to the
+COMMAND, as login does. If the `-c' option is supplied, COMMAND is
+executed with an empty environment. The `-a' option causes the shell
+to pass NAME as the zeroth argument to COMMAND. If the command cannot be
+executed, a non-interactive shell exits, unless the shell option `execfail'
+is set. If COMMAND is absent, any redirections take effect in the
+calling shell.
$END
#include <config.h>
static int subst_rhs_len;
static char *get_history_word_specifier PARAMS((char *, char *, int *));
-static char *history_find_word PARAMS((char *, int));
static int history_tokenize_word PARAMS((const char *, int));
static char **history_tokenize_internal PARAMS((const char *, int, int *));
static char *history_substring PARAMS((const char *, int, int));
+static void freewords PARAMS((char **, int));
+static char *history_find_word PARAMS((char *, int));
static char *quote_breaks PARAMS((char *));
return (history_tokenize_internal (string, -1, (int *)NULL));
}
+/* Free members of WORDS from START to an empty string */
+static void
+freewords (words, start)
+ char **words;
+ int start;
+{
+ register int i;
+
+ for (i = start; words[i]; i++)
+ free (words[i]);
+}
+
/* Find and return the word which contains the character at index IND
in the history line LINE. Used to save the word matched by the
last history !?string? search. */
words = history_tokenize_internal (line, ind, &wind);
if (wind == -1 || words == 0)
{
+ if (words)
+ freewords (words, 0);
FREE (words);
return ((char *)NULL);
}
s = words[wind];
for (i = 0; i < wind; i++)
free (words[i]);
- for (i = wind + 1; words[i]; i++)
- free (words[i]);
+ freewords (words, wind + 1);
free (words);
return s;
}
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */
-#define PATCHLEVEL 17
+#define PATCHLEVEL 25
#endif /* _PATCHLEVEL_H_ */
/* patchlevel.h -- current bash patch level */
-/* Copyright (C) 2001-2006 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2007 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */
-#define PATCHLEVEL 9
+#define PATCHLEVEL 17
#endif /* _PATCHLEVEL_H_ */
const WORD_DESC *word;
int expand;
{
- int offset, tlen, appendop, assign_list, aflags;
+ int offset, tlen, appendop, assign_list, aflags, retval;
char *name, *value;
SHELL_VAR *entry;
#if defined (ARRAY_VARS)
stupidly_hack_special_variables (name);
+#if 1
+ /* Return 1 if the assignment seems to have been performed correctly. */
+ if (entry == 0 || readonly_p (entry))
+ retval = 0; /* assignment failure */
+ else if (noassign_p (entry))
+ {
+ last_command_exit_value = EXECUTION_FAILURE;
+ retval = 1; /* error status, but not assignment failure */
+ }
+ else
+ retval = 1;
+ ASSIGN_RETURN (retval);
+
+ if (entry && retval != 0)
+ VUNSETATTR (entry, att_invisible);
+#else
if (entry)
VUNSETATTR (entry, att_invisible);
- /* Return 1 if the assignment seems to have been performed correctly. */
ASSIGN_RETURN (entry ? ((readonly_p (entry) == 0) && noassign_p (entry) == 0) : 0);
+#endif
}
/* Perform the assignment statement in STRING, and expand the
assigning_in_environment = 0;
top_level_cleanup (); /* from sig.c */
-
jump_to_top_level (v);
}
/* Non-zero means to throw an error when globbing fails to match anything. */
int fail_glob_expansion;
-int assigining_in_environment;
-
#if 0
/* Variables to keep track of which words in an expanded word list (the
output of expand_word_list_internal) are the result of globbing
const WORD_DESC *word;
int expand;
{
- int offset, tlen, appendop, assign_list, aflags;
+ int offset, tlen, appendop, assign_list, aflags, retval;
char *name, *value;
SHELL_VAR *entry;
#if defined (ARRAY_VARS)
if (entry)
VUNSETATTR (entry, att_invisible);
+#if 1
/* Return 1 if the assignment seems to have been performed correctly. */
+ if (entry == 0 || readonly_p (entry))
+ retval = 0; /* assignment failure */
+ else if (noassign_p (entry))
+ {
+ last_command_exit_value = EXECUTION_FAILURE;
+ retval = 1; /* error status, but not assignment failure */
+ }
+ else
+ retval = 1;
+ ASSIGN_RETURN (retval);
+#else
ASSIGN_RETURN (entry ? ((readonly_p (entry) == 0) && noassign_p (entry) == 0) : 0);
+#endif
}
/* Perform the assignment statement in STRING, and expand the
temp = (*temp && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
? quote_string (temp)
: quote_escapes (temp);
- else if (atype == 1 && temp && *temp == 0 && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
+ else if (atype == 1 && temp && QUOTED_NULL (temp) && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
rflags |= W_HASQUOTEDNULL;
}
#endif
assigning_in_environment = 0;
top_level_cleanup (); /* from sig.c */
-
jump_to_top_level (v);
}
-BUILD_DIR=/usr/local/build/chet/bash/bash-current
+BUILD_DIR=/usr/local/build/bash/bash-current
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR
./errors.tests: line 61: declare: `/bin/sh': not a valid identifier
./errors.tests: line 65: declare: cannot use `-f' to make functions
./errors.tests: line 68: exec: -i: invalid option
-exec: usage: exec [-cl] [-a name] file [redirection ...]
+exec: usage: exec [-cl] [-a name] [command [arguments ...]] [redirection ...]
./errors.tests: line 72: export: XPATH: not a function
./errors.tests: line 75: break: only meaningful in a `for', `while', or `until' loop
./errors.tests: line 76: continue: only meaningful in a `for', `while', or `until' loop
0
1
testb
-bash: no job control in this shell
expand_aliases on
after
0
1
testb
-bash: cannot set terminal pgrp to 15044: Inappropriate ioctl for device
bash: no job control in this shell
expand_aliases on
after