- in readtok(), don't reset lasttp if we've consumed the whitespace
at the end of the expression string. Fixes error message problem
reported by <anmaster@tele2.se>
+
+ 11/1
+ ----
+builtins/printf.def
+ - change asciicode() to return intmax_t; add multibyte character
+ support instead of assuming ASCII (depending on behavior of system
+ multibyte support functions). Fixes bug reported by Rich
+ Felker <dalias@aerifal.cx>
+
+ 11/5
+ ----
+execute_cmd.c
+ - if redirections attached to a compound command fail, make sure to
+ set last_command_exit_value when returning EXECUTION_FAILURE.
+ Fixes bug reported separately by Andreas Schwab <schwab@suse.de>
+ and Paul Eggert <eggert@cs.ucla.edu>
+
+ 11/9
+ ----
+builtins/read.def
+ - make sure the return value from get_word_from_string is freed if
+ non-null. Fixes bug reported by Lars Ellenberg
+ <lars.ellenberg@linbit.com>
+
+ 11/10
+ -----
+variables.c
+ - use getpid() as value of seeded_subshell to avoid problems with
+ random number generator not getting re-seeded correctly when
+ subshells are created. Fix from Tomas Janousek <tjanouse@redhat.com>
+
+lib/readline/display.c
+ - in update_line(), when outputting characters at the end of the line,
+ e.g., when displaying the prompt string, adjust _rl_last_c_pos by
+ wrap_offset if the text we're drawing begins before the last
+ invisible character in the line. Similar to fix from 5/24. Fixes
+ bug reported by Miroslav Lichvar <mlichvar@redhat.com>
- change exit status of `type' to not successful if any of the
requested commands are not found. Reported by Stephane Chazleas
<stephane_chazelas@yahoo.fr>
+
+pcomplete.c
+ - change command_line_to_word_list to use rl_completer_word_break_characters
+ instead of the shell metacharacters to split words, so programmable
+ completion does the same thing readline does internally. Reported
+ by Vasily Tarasov <vtaras@sw.ru>
+
+ 10/16
+ -----
+bashline.c
+ - When completing a command name beginnig with a tilde and containing
+ escaped specical characters, dequote the filename before prefixing
+ it to the matches, so the escapes are not quoted again. Reported
+ by neil@s-z.org
+
+ 10/17
+ -----
+expr.c
+ - in readtok(), don't reset lasttp if we've consumed the whitespace
+ at the end of the expression string. Fixes error message problem
+ reported by <anmaster@tele2.se>
+
+ 11/1
+ ----
+builtins/printf.def
+ - change asciicode() to return intmax_t; add multibyte character
+ support instead of assuming ASCII (depending on behavior of system
+ multibyte support functions). Fixes bug reported by Rich
+ Felker <dalias@aerifal.cx>
+
+ 11/9
+ ----
+builtins/read.def
+ - make sure the return value from get_word_from_string is freed if
+ non-null. Fixes bug reported by Lars Ellenberg
+ <lars.ellenberg@linbit.com>
+
+ 11/10
+ -----
+variables.c
+ - use getpid() as value of seeded_subshell to avoid problems with
+ random number generator not getting re-seeded correctly when
+ subshells are created. Fix from Tomas Janousek <tjanouse@redhat.com>
+
+lib/readline/display.c
+ - in update_line(), when outputting characters at the end of the line,
+ e.g., when displaying the prompt string, adjust _rl_last_c_pos by
+ wrap_offset if the text we're drawing begins before the last
+ invisible character in the line. Similar to fix from 5/24. Fixes
+ bug reported by Miroslav Lichvar <mlichvar@redhat.com>
#include "../bashintl.h"
#include "../shell.h"
+#include "shmbutil.h"
#include "stdc.h"
#include "bashgetopt.h"
#include "common.h"
#endif
static floatmax_t getfloatmax __P((void));
-static int asciicode __P((void));
+static intmax_t asciicode __P((void));
static WORD_LIST *garglist;
static int retval;
}
/* NO check is needed for garglist here. */
-static int
+static intmax_t
asciicode ()
{
- register int ch;
+ register intmax_t ch;
+#if defined (HANDLE_MULTIBYTE)
+ wchar_t wc;
+ size_t mblength, slen;
+#endif
+ DECLARE_MBSTATE;
+
+#if defined (HANDLE_MULTIBYTE)
+ slen = strlen (garglist->word->word+1);
+ mblength = mbrlen (garglist->word->word+1, slen, NULL);
+#if 0
+ if (mblength > 1)
+#else
+ if (1)
+#endif
+ {
+ mblength = mbrtowc (&wc, garglist->word->word+1, slen, NULL);
+ ch = wc; /* XXX */
+ }
+ else
+#endif
+ ch = garglist->word->word[1];
- ch = garglist->word->word[1];
garglist = garglist->next;
return (ch);
}
#include "../bashintl.h"
#include "../shell.h"
+#include "shmbutil.h"
#include "stdc.h"
#include "bashgetopt.h"
#include "common.h"
vbsize = 0; \
vbuf = 0; \
} \
+ else if (vbuf) \
+ vbuf[0] = 0; \
fflush (stdout); \
if (ferror (stdout)) \
{ \
#endif
static floatmax_t getfloatmax __P((void));
-static int asciicode __P((void));
+static intmax_t asciicode __P((void));
static WORD_LIST *garglist;
static int retval;
}
/* NO check is needed for garglist here. */
-static int
+static intmax_t
asciicode ()
{
- register int ch;
+ register intmax_t ch;
+#if defined (HANDLE_MULTIBYTE)
+ wchar_t wc;
+ size_t mblength, slen;
+#endif
+ DECLARE_MBSTATE;
+
+#if defined (HANDLE_MULTIBYTE)
+ slen = strlen (garglist->word->word+1);
+ mblength = mbrlen (garglist->word->word+1, slen, NULL);
+#if 0
+ if (mblength > 1)
+#else
+ if (1)
+ {
+ mblength = mbrtowc (&wc, garglist->word->word+1, slen, NULL);
+ ch = wc; /* XXX */
+ }
+ else
+#endif
+ ch = garglist->word->word[1];
- ch = garglist->word->word[1];
garglist = garglist->next;
return (ch);
}
intmax_t intval;
char c;
char *input_string, *orig_input_string, *ifs_chars, *prompt, *arrayname;
- char *e, *t, *t1, *ps2;
+ char *e, *t, *t1, *ps2, *tofree;
struct stat tsb;
SHELL_VAR *var;
#if defined (ARRAY_VARS)
#else
/* Check whether or not the number of fields is exactly the same as the
number of variables. */
+ tofree = NULL;
if (*input_string)
{
t1 = input_string;
t = get_word_from_string (&input_string, ifs_chars, &e);
if (*input_string == 0)
- input_string = t;
+ tofree = input_string = t;
else
input_string = strip_trailing_ifs_whitespace (t1, ifs_chars, saw_escape);
}
else
var = bind_read_variable (list->word->word, input_string);
stupidly_hack_special_variables (list->word->word);
+ FREE (tofree);
+
if (var)
VUNSETATTR (var, att_invisible);
xfree (orig_input_string);
intmax_t intval;
char c;
char *input_string, *orig_input_string, *ifs_chars, *prompt, *arrayname;
- char *e, *t, *t1, *ps2;
+ char *e, *t, *t1, *ps2, *tofree;
struct stat tsb;
SHELL_VAR *var;
#if defined (ARRAY_VARS)
input_string[i++] = c;
#if defined (HANDLE_MULTIBYTE)
- if (MB_CUR_MAX > 1)
+ if (nchars > 0 && MB_CUR_MAX > 1)
{
input_string[i] = '\0'; /* for simplicity and debugging */
i += read_mbchar (fd, input_string, i, c, unbuffered_read);
if (*input_string)
{
t1 = input_string;
- t = get_word_from_string (&input_string, ifs_chars, &e);
+ tofree = NULL;
+ tofree = t = get_word_from_string (&input_string, ifs_chars, &e);
if (*input_string == 0)
input_string = t;
else
cleanup_redirects (redirection_undo_list);
redirection_undo_list = (REDIRECT *)NULL;
dispose_exec_redirects ();
- return (EXECUTION_FAILURE);
+ return (last_command_exit_value = EXECUTION_FAILURE);
}
if (redirection_undo_list)
array_push (bash_source_a, sfile);
t = itos (executing_line_number ());
array_push (bash_lineno_a, t);
-itrace("execute_function: pushed %s to BASH_LINENO", t);
free (t);
#endif
}
else
{
- /* We have horizontal scrolling and we are not inserting at
- the end. We have invisible characters in this line. This
- is a dumb update. */
_rl_output_some_chars (nfd, temp);
_rl_last_c_pos += col_temp;
+ /* If nfd begins before any invisible characters in the prompt,
+ adjust _rl_last_c_pos to account for wrap_offset and set
+ cpos_adjusted to let the caller know. */
+ if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
+ {
+ _rl_last_c_pos -= wrap_offset;
+ cpos_adjusted = 1;
+ }
return;
}
/* Copy (new) chars to screen from first diff to last match. */
second and subsequent lines start at inv_lbreaks[N], offset by
OFFSET (which has already been calculated above). */
-#define WRAP_OFFSET<(line, offset) ((line == 0) \
+#define WRAP_OFFSET(line, offset) ((line == 0) \
? (offset ? prompt_invis_chars_first_line : 0) \
: ((line == prompt_last_screen_line) ? wrap_offset-prompt_invis_chars_first_line : 0))
#define W_OFFSET(line, offset) ((line) == 0 ? offset : 0)
tx = _rl_col_width (&visible_line[pos], 0, nleft) - visible_wrap_offset;
else
tx = nleft;
- if (_rl_last_c_pos > tx)
+ if (tx >= 0 && _rl_last_c_pos > tx)
{
_rl_backspace (_rl_last_c_pos - tx); /* XXX */
_rl_last_c_pos = tx;
int current_line, omax, nmax, inv_botlin;
{
register char *ofd, *ols, *oe, *nfd, *nls, *ne;
- int temp, lendiff, wsatend, od, nd, twidth;
+ int temp, lendiff, wsatend, od, nd, twidth, o_cpos;
int current_invis_chars;
int col_lendiff, col_temp;
#if defined (HANDLE_MULTIBYTE)
_rl_last_c_pos = lendiff + modmark;
}
+ o_cpos = _rl_last_c_pos;
+
/* When this function returns, _rl_last_c_pos is correct, and an absolute
cursor postion in multibyte mode, but a buffer index when not in a
multibyte locale. */
/* We need to indicate that the cursor position is correct in the presence of
invisible characters in the prompt string. Let's see if setting this when
we make sure we're at the end of the drawn prompt string works. */
- if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 && _rl_last_c_pos == prompt_physical_chars)
+ if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 &&
+ (_rl_last_c_pos > 0 || o_cpos > 0) &&
+ _rl_last_c_pos == prompt_physical_chars)
cpos_adjusted = 1;
#endif
#endif
is a dumb update. */
_rl_output_some_chars (nfd, temp);
_rl_last_c_pos += col_temp;
+ /* If nfd begins before any invisible characters in the prompt,
+ adjust _rl_last_c_pos to account for wrap_offset and set
+ cpos_adjusted to let the caller know. */
+ if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
+ {
+ _rl_last_c_pos -= wrap_offset;
+ cpos_adjusted = 1;
+ }
return;
}
/* Copy (new) chars to screen from first diff to last match. */
-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
{
sbrand (strtoul (value, (char **)NULL, 10));
if (subshell_environment)
- seeded_subshell = 1;
+ seeded_subshell = getpid ();
return (self);
}
int
get_random_number ()
{
- int rv;
+ int rv, pid;
/* Reset for command and process substitution. */
- if (subshell_environment && seeded_subshell == 0)
+ pid = getpid ();
+ if (subshell_environment && seeded_subshell != pid)
{
- sbrand (rseed + getpid() + NOW);
- seeded_subshell = 1;
+ sbrand (rseed + pid + NOW);
+ seeded_subshell = pid;
}
do
#include "posixstat.h"
#include "posixtime.h"
-#if defined (qnx)
-# if defined (qnx6)
+#if defined (__QNX__)
+# if defined (__QNXNTO__)
# include <sys/netmgr.h>
# else
# include <sys/vc.h>
-# endif /* !qnx6 */
-#endif /* qnx */
+# endif /* !__QNXNTO__ */
+#endif /* __QNX__ */
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
set_auto_export (temp_var); /* XXX */
#endif
-#if defined (qnx)
+#if defined (__QNX__)
/* set node id -- don't import it from the environment */
{
char node_name[22];
-# if defined (qnx6)
+# if defined (__QNXNTO__)
netmgr_ndtostr(ND2S_LOCAL_STR, ND_LOCAL_NODE, node_name, sizeof(node_name));
# else
qnx_nidtostr (getnid (), node_name, sizeof (node_name));
}
rval = evalexp (value, &expok);
if (expok == 0)
- {
- top_level_cleanup ();
+ {
+ top_level_cleanup ();
jump_to_top_level (DISCARD);
- }
+ }
if (flags & ASS_APPEND)
rval += lval;
retval = itos (rval);