Re: read builtin goes into uninterruptible loop if input only contains zeros

2017-07-30 Thread Chet Ramey
On 7/28/17 9:59 AM, Siteshwar Vashisht wrote:

> Bash Version: 4.4
> Patch Level: 12
> Release Status: release
> 
> Description:
> read builtin goes into uninterruptible loop if input comes from 
> /dev/zero.

Thanks for the report. This was fixed at the end of June, and the fix is in
the devel branch.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: read builtin goes into uninterruptible loop if input only contains zeros

2017-07-30 Thread Siteshwar Vashisht


- Original Message -
> From: "Chet Ramey" 
> To: "Siteshwar Vashisht" , bug-bash@gnu.org
> Cc: "chet ramey" 
> Sent: Sunday, July 30, 2017 4:33:09 PM
> Subject: Re: read builtin goes into uninterruptible loop if input only 
> contains zeros
> 
> Thanks for the report. This was fixed at the end of June, and the fix is in
> the devel branch.

Thanks for pointing to the fix, however I see that the fix is missing a warning 
about ignoring null character. You might want to add it.

> 
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
> 

-- 
--
Siteshwar Vashisht



Cleanup compiler warnings

2017-07-30 Thread Siteshwar Vashisht
Hello,

Attached patch cleans up compiler warnings about unused variables, functions 
etc. while compiling with '-Wall' option in gcc.

-- 
--
Siteshwar Vashisht
From 83394f684ab0b5451c351e37411e8cab3c4ed42a Mon Sep 17 00:00:00 2001
From: Siteshwar Vashisht 
Date: Sun, 30 Jul 2017 16:03:51 +0200
Subject: [PATCH] Cleanup compiler warnings

---
 array.c  |  1 -
 arrayfunc.c  |  6 +---
 bashline.c   | 39 +
 braces.c | 10 +++---
 builtins/bind.def|  1 -
 builtins/cd.def  | 14 ++--
 builtins/command.def |  5 ++-
 builtins/declare.def |  5 ++-
 builtins/evalfile.c  |  2 +-
 builtins/help.def|  9 +++--
 builtins/history.def |  6 +++-
 builtins/mapfile.def |  3 +-
 builtins/setattr.def |  2 +-
 builtins/shopt.def   |  2 +-
 builtins/ulimit.def  |  5 ++-
 execute_cmd.c| 20 +--
 expr.c   |  8 +++--
 general.c| 19 +-
 jobs.c   | 17 -
 locale.c | 13 +++
 parse.y  | 56 +++---
 pathexp.c|  5 ++-
 pcomplete.c  |  3 +-
 print_cmd.c  | 10 +++---
 redir.c  | 16 ++---
 shell.c  |  7 ++--
 subst.c  | 98 
 support/man2html.c   | 76 
 trap.c   |  6 ++--
 variables.c  | 23 +---
 xmalloc.c|  2 ++
 31 files changed, 234 insertions(+), 255 deletions(-)

diff --git a/array.c b/array.c
index 34f022e..5f7d72f 100644
--- a/array.c
+++ b/array.c
@@ -384,7 +384,6 @@ array_remove_quoted_nulls(array)
 ARRAY	*array;
 {
 	ARRAY_ELEMENT	*a;
-	char	*t;
 
 	if (array == 0 || array_head(array) == 0 || array_empty(array))
 		return (ARRAY *)NULL;
diff --git a/arrayfunc.c b/arrayfunc.c
index ac4884f..5b41f86 100644
--- a/arrayfunc.c
+++ b/arrayfunc.c
@@ -262,9 +262,6 @@ bind_assoc_variable (entry, name, key, value, flags)
  char *value;
  int flags;
 {
-  SHELL_VAR *dentry;
-  char *newval;
-
   if ((readonly_p (entry) && (flags&ASS_FORCE) == 0) || noassign_p (entry))
 {
   if (readonly_p (entry))
@@ -285,7 +282,7 @@ assign_array_element (name, value, flags)
 {
   char *sub, *vname;
   int sublen;
-  SHELL_VAR *entry, *nv;
+  SHELL_VAR *entry;
 
   vname = array_variable_name (name, (flags & ASS_NOEXPAND) != 0, &sub, &sublen);
 
@@ -458,7 +455,6 @@ expand_compound_array_assignment (var, value, flags)
  int flags;
 {
   WORD_LIST *list, *nlist;
-  WORD_LIST *hd, *tl, *t, *n;
   char *val;
   int ni;
 
diff --git a/bashline.c b/bashline.c
index e156ef8..fb01e22 100644
--- a/bashline.c
+++ b/bashline.c
@@ -175,11 +175,14 @@ static char *quote_word_break_chars __P((char *));
 static void set_filename_bstab __P((const char *));
 static char *bash_quote_filename __P((char *, int, char *));
 
+#ifdef INCLUDE_UNUSED
 #ifdef _MINIX
 static void putx __P((int));
 #else
 static int putx __P((int));
 #endif
+#endif
+
 static int bash_execute_unix_command __P((int, int));
 static void init_unix_command_map __P((void));
 static int isolate_sequence __P((char *, int, int, int *));
@@ -1049,7 +1052,7 @@ bash_forward_shellword (count, key)
  int count, key;
 {
   size_t slen;
-  int sindex, c, p;
+  int c, p;
   DECLARE_MBSTATE;
 
   if (count < 0)
@@ -1158,7 +1161,7 @@ bash_backward_shellword (count, key)
  int count, key;
 {
   size_t slen;
-  int sindex, c, p;
+  int c, p;
   DECLARE_MBSTATE;
 
   if (count < 0)
@@ -1416,7 +1419,7 @@ attempt_shell_completion (text, start, end)
  const char *text;
  int start, end;
 {
-  int in_command_position, ti, saveti, qc, dflags;
+  int in_command_position, ti, qc, dflags;
   char **matches, *command_separator_chars;
 #if defined (PROGRAMMABLE_COMPLETION)
   int have_progcomps, was_assignment;
@@ -1438,7 +1441,7 @@ attempt_shell_completion (text, start, end)
  appears after a character that separates commands.  It cannot be a
  command word if we aren't at the top-level prompt. */
   ti = start - 1;
-  saveti = qc = -1;
+  qc = -1;
 
   while ((ti > -1) && (whitespace (rl_line_buffer[ti])))
 ti--;
@@ -1449,7 +1452,7 @@ attempt_shell_completion (text, start, end)
   if (ti >= 0 && (rl_line_buffer[ti] == '"' || rl_line_buffer[ti] == '\''))
 {
   qc = rl_line_buffer[ti];
-  saveti = ti--;
+  ti--;
   while (ti > -1 && (whitespace (rl_line_buffer[ti])))
 	ti--;
 }
@@ -1799,7 +1802,7 @@ command_word_completion_function (hint_text, state)
   static char *dequoted_hint = (char *)NULL;
   static char *directory_part = (char *)NULL;
   static char **glob_matches = (char **)NULL;
-  static int path_index, hint_len, dequoted_len, istate, igncase;
+  static int path_index, hint_len, istate, igncase;
   static int mapping_over, local_index, searching_path, hint_is_dir;
   static int old_glob_ignore_case, globpat;
   static SHELL_VAR **varlist = (SHELL_VAR **)NULL;
@@ -1877,7 +