OpenCoverageBash

Bash patch #9 - Test report of the modifications

Overview

Test Execution StatusStatistics
Passed
  0.000% (0/1)
Failed
  0.000% (0/1)
Requires Manual Checking
  0.000% (0/1)
Unknown
100.000% (1/1)
All
100.000% (1/1)
CategoryRemoved LinesInserted LinesTotal
Modified lines executed:
  2.857% (1/35)
  1.064% (1/94)
  1.550% (2/129)
Modified lines not executed:
  0.000% (0/35)
  3.191% (3/94)
  2.326% (3/129)
Source code lines not covered:
 97.143% (34/35)
 95.745% (90/94)
 96.124% (124/129)

List of tests executing the changes

Execution NameState
Self testUnknown

Patch File

Showing: 

Modified File: CWRU/CWRU.chlog

LineTestsDifference Output
diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog
index 5d6eec63..bd8f7ce7 100644
--- a/CWRU/CWRU.chlog
+++ b/CWRU/CWRU.chlog
@@ -14927,3 +14927,31 @@ config-top.h
14927 - DONT_REPORT_SIGPIPE: define, so non-interactive shells will no
14928 longer print termination messages for child processes killed by
14929 SIGTERM
14930
-
+
14931
-
+ 2/6
14932
-
+ ---
14933
-
+lib/readline/text.c
14934
-
+ - rl_insert: don't attempt to optimize typeahead if we are only reading
14935
-
+ a fixed number of characters (rl_num_chars_to_read > 0)
14936
-
+
14937
-
+redir.c
14938
-
+ - redir_special_open: if the shell is restricted, return a
14939
-
+ RESTRICTED_REDIRECT error for attempts to open /dev/tcp and /dev/udp
14940
-
+ sockets. Inspired by report from Blake Burkhart <bburky@bburky.com>
14941
-
+ - do_redirection_internal: if redir_open returns RESTRICTED_REDIRECT,
14942
-
+ return that right away (instead of errno) so we can print a better
14943
-
+ error message
14944
-
+
14945
-
+ 2/11
14946
-
+ ----
14947
-
+jobs.c
14948
-
+ - bgp_resize: fix problems with (pid_t) overflow when calculating new
14949
-
+ size for table when js.c_childmax is near the limit of a pid_t
14950
-
+ (e.g., 2**31 - 1 on a 32-bit system, or 2**63-1 on a system with
14951
-
+ 32-bit pid_t). Fixes hang reported by Natanael Copa
14952
-
+ <ncopa@alpinelinux.org> based on his patch from 12/8.
14953
-
+ - bgp_resize: cap max table size for bgpids at MAX_CHILD_MAX (32768)
14954
-
+
14955
-
+include/typemax.h
14956
-
+ - TYPE_MINIMUM, TYPE_MAXIMUM: updated definitions from coreutils-8.29,
14957
-
+ silences some compiler warnings

Modified File: doc/bash.1

LineTestsDifference Output
diff --git a/doc/bash.1 b/doc/bash.1
index aa77e883..ea00f6bd 100644
--- a/doc/bash.1
+++ b/doc/bash.1
@@ -2133,7 +2133,7 @@ A value of
2133 .I ignoreboth
2134 is shorthand for \fIignorespace\fP and \fIignoredups\fP.
2135 A value of
2136
-
No equivalent source code line in the reference code can be identified.
-.IR erasedups
2136
-
+.I erasedups
2137 causes all previous lines matching the current line to be removed from
2138 the history list before that line is saved.
2139 Any value not in the above list is ignored.
@@ -2794,7 +2794,7 @@ lexicographically between \fIx\fP and \fIy\fP, inclusive,
2794 using the default C locale.
2795 Note that both \fIx\fP and \fIy\fP must be of the same type.
2796 When the increment is supplied, it is used as the difference between
2797
-
No equivalent source code line in the reference code can be identified.
-each term. The default increment is 1 or -1 as appropriate.
2797
-
+each term. The default increment is 1 or \-1 as appropriate.
2798 .PP
2799 Brace expansion is performed before any other expansions,
2800 and any characters special to other expansions are preserved
@@ -3042,7 +3042,7 @@ one space to avoid being confused with the \fB:-\fP expansion.
3042 If \fIparameter\fP is \fB@\fP, the result is \fIlength\fP positional
3043 parameters beginning at \fIoffset\fP.
3044 A negative \fIoffset\fP is taken relative to one greater than the greatest
3045
-
No equivalent source code line in the reference code can be identified.
-positional parameter, so an offset of -1 evaluates to the last positional
3045
-
+positional parameter, so an offset of \-1 evaluates to the last positional
3046 parameter.
3047 It is an expansion error if \fIlength\fP evaluates to a number less than
3048 zero.
@@ -3439,7 +3439,7 @@ are ignored at the beginning and end of the
3439 word, as long as the whitespace character is in the
3440 value of
3441 .SM
3442
-
No equivalent source code line in the reference code can be identified.
-.BR IFS
3442
-
+.B IFS
3443 (an
3444 .SM
3445 .B IFS
@@ -4423,7 +4423,7 @@ A shell variable that is null or unset evaluates to 0 when referenced
4423 by name without using the parameter expansion syntax.
4424 The value of a variable is evaluated as an arithmetic expression
4425 when it is referenced, or when a variable which has been given the
4426
-
No equivalent source code line in the reference code can be identified.
-\fIinteger\fP attribute using \fBdeclare -i\fP is assigned a value.
4426
-
+\fIinteger\fP attribute using \fBdeclare \-i\fP is assigned a value.
4427 A null value evaluates to 0.
4428 A shell variable need not have its \fIinteger\fP attribute
4429 turned on to be used in an expression.
@@ -5633,13 +5633,13 @@ in emacs mode and to
5633 .B #
5634 in vi command mode.
5635 .TP
5636
-
No equivalent source code line in the reference code can be identified.
-.B completion\-display\-width (-1)
5636
-
+.B completion\-display\-width (\-1)
5637 The number of screen columns used to display possible matches
5638 when performing completion.
5639 The value is ignored if it is less than 0 or greater than the terminal
5640 screen width.
5641 A value of 0 will cause matches to be displayed one per line.
5642
-
No equivalent source code line in the reference code can be identified.
-The default value is -1.
5642
-
+The default value is \-1.
5643 .TP
5644 .B completion\-ignore\-case (Off)
5645 If set to \fBOn\fP, readline performs filename matching and completion
@@ -6805,7 +6805,7 @@ of the setting of the \fBmark-symlinked\-directories\fP readline variable.
6805 .PP
6806 There is some support for dynamically modifying completions. This is
6807 most useful when used in combination with a default completion specified
6808
-
No equivalent source code line in the reference code can be identified.
-with \fBcomplete -D\fP.
6808
-
+with \fBcomplete \-D\fP.
6809 It's possible for shell functions executed as completion
6810 handlers to indicate that completion should be retried by returning an
6811 exit status of 124. If a shell function returns 124, and changes
@@ -6962,7 +6962,7 @@ for information on setting and unsetting shell options.
6962 .PP
6963 The shell supports a history expansion feature that
6964 is similar to the history expansion in
6965
-
No equivalent source code line in the reference code can be identified.
-.BR csh.
6965
-
+.BR csh .
6966 This section describes what syntax features are available. This
6967 feature is enabled by default for interactive shells, and can be
6968 disabled using the
@@ -8289,7 +8289,7 @@ with that string) or as a number (an index into the history list,
8289 where a negative number is used as an offset from the current
8290 command number). If
8291 .I last
8292
-
No equivalent source code line in the reference code can be identified.
-is not specified it is set to
8292
-
+is not specified, it is set to
8293 the current command for listing (so that
8294 .if n ``fc \-l \-10''
8295 .if t \f(CWfc \-l \-10\fP
@@ -8298,7 +8298,7 @@ prints the last 10 commands) and to
8298 otherwise.
8299 If
8300 .I first
8301
-
No equivalent source code line in the reference code can be identified.
-is not specified it is set to the previous
8301
-
+is not specified, it is set to the previous
8302 command for editing and \-16 for listing.
8303 .sp 1
8304 The
@@ -8802,7 +8802,7 @@ Exit a login shell.
8802 Read lines from the standard input into the indexed array variable
8803 .IR array ,
8804 or from file descriptor
8805
-
No equivalent source code line in the reference code can be identified.
-.IR fd
8805
-
+.I fd
8806 if the
8807 .B \-u
8808 option is supplied.
@@ -8951,9 +8951,9 @@ causes \fBprintf\fP to output the date-time string resulting from using
8951 \fIdatefmt\fP as a format string for \fIstrftime\fP(3).
8952 The corresponding \fIargument\fP is an integer representing the number of
8953 seconds since the epoch.
8954
-
No equivalent source code line in the reference code can be identified.
-Two special argument values may be used: -1 represents the current
8955
-
No equivalent source code line in the reference code can be identified.
-time, and -2 represents the time the shell was invoked.
8956
-
No equivalent source code line in the reference code can be identified.
-If no argument is specified, conversion behaves as if -1 had been given.
8954
-
+Two special argument values may be used: \-1 represents the current
8955
-
+time, and \-2 represents the time the shell was invoked.
8956
-
+If no argument is specified, conversion behaves as if \-1 had been given.
8957 This is an exception to the usual \fBprintf\fP behavior.
8958 .PD
8959 .PP

Modified File: eval.c

LineTestsDifference Output
diff --git a/eval.c b/eval.c
index 7992346a..3104bffe 100644
--- a/eval.c
+++ b/eval.c
@@ -261,6 +261,15 @@ send_pwd_to_eterm ()
261 free (f);
262 }
263
264
-
+static void
265
-
+execute_prompt_command ()
266
-
+{
267
-
+ char *command_to_execute;
268
-
+
269
-
+ command_to_execute = get_string_value ("PROMPT_COMMAND");
270
-
+ if (command_to_execute)
271
-
+ execute_variable_command (command_to_execute, "PROMPT_COMMAND");
272
-
+}
264 ➡ 273 /* Call the YACC-generated parser and return the status of the parse.
265 ➡ 274 Input is read from the current input stream (bash_input). yyparse
266 ➡ 275 leaves the parsed command in the global variable GLOBAL_COMMAND.
@@ -269,7 +278,6 @@ int
269 ➡ 278 parse_command ()
270 ➡ 279 {
271 ➡ 280 int r;
272
-
No equivalent source code line in the reference code can be identified.
- char *command_to_execute;
273 ➡ 281
274 ➡ 282 need_here_doc = 0;
275 ➡ 283 run_pending_traps ();
@@ -282,9 +290,7 @@ parse_command ()
282 ➡ 290 actually printed. */
283 ➡ 291 if (interactive && bash_input.type != st_string && parser_expanding_alias() == 0)
284 ➡ 292 {
285
-
No equivalent source code line in the reference code can be identified.
- command_to_execute = get_string_value ("PROMPT_COMMAND");
286
-
No equivalent source code line in the reference code can be identified.
- if (command_to_execute)
287
-
No equivalent source code line in the reference code can be identified.
- execute_variable_command (command_to_execute, "PROMPT_COMMAND");
293
-
+ execute_prompt_command ();
288 ➡ 294
289 ➡ 295 if (running_under_emacs == 2)
290 ➡ 296 send_pwd_to_eterm (); /* Yuck */

Modified File: include/typemax.h

LineTestsDifference Output
diff --git a/include/typemax.h b/include/typemax.h
index aa21c9c6..0f696388 100644
--- a/include/typemax.h
+++ b/include/typemax.h
@@ -35,14 +35,23 @@
35 # define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
36 #endif
37
38
-
+#ifndef TYPE_SIGNED_MAGNITUDE
39
-
+# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
40
-
+#endif
41
-
+
42
-
+#ifndef TYPE_WIDTH
43
-
+# define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT)
44
-
+#endif
45
-
+
38 ➡ 46 #ifndef TYPE_MINIMUM
39
-
No equivalent source code line in the reference code can be identified.
-# define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
40
-
No equivalent source code line in the reference code can be identified.
- ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \
41
-
No equivalent source code line in the reference code can be identified.
- : (t) 0))
47
-
+# define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t))
42 ➡ 48 #endif
43 ➡ 49
44 ➡ 50 #ifndef TYPE_MAXIMUM
45
-
No equivalent source code line in the reference code can be identified.
-# define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
51
-
+# define TYPE_MAXIMUM(t) \
52
-
+ ((t) (! TYPE_SIGNED (t) \
53
-
+ ? (t) -1 \
54
-
+ : ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1)))
46 ➡ 55 #endif
47 ➡ 56
48 ➡ 57 #ifdef HAVE_LONG_LONG

Modified File: jobs.c

LineTestsDifference Output
diff --git a/jobs.c b/jobs.c
index eff3fefa..8e51fa9b 100644
--- a/jobs.c
+++ b/jobs.c
@@ -73,6 +73,8 @@
73 #include "execute_cmd.h"
74 #include "flags.h"
75
76
-
+#include "typemax.h"
77
-
+
76 ➡ 78 #include "builtins/builtext.h"
77 ➡ 79 #include "builtins/common.h"
78 ➡ 80
@@ -93,7 +95,7 @@ extern int killpg __P((pid_t, int));
93 ➡ 95 #endif
94 ➡ 96
95 ➡ 97 #if !MAX_CHILD_MAX
96
-
No equivalent source code line in the reference code can be identified.
-# define MAX_CHILD_MAX 8192
98
-
+# define MAX_CHILD_MAX 32768
97 ➡ 99 #endif
98 ➡ 100
99 ➡ 101 #if !defined (DEBUG)
@@ -734,7 +736,7 @@ stop_pipeline (async, deferred)
734 ➡ 736 static void
735 ➡ 737 bgp_resize ()
736 ➡ 738 {
737
-
No equivalent source code line in the reference code can be identified.
- ps_index_t nsize;
739
-
+ ps_index_t nsize, nsize_cur, nsize_max;
738 ➡ 740 ps_index_t psi;
739 ➡ 741
740 ➡ 742 if (bgpids.nalloc == 0)
@@ -748,10 +750,19 @@ bgp_resize ()
748 ➡ 750 else
749 ➡ 751 nsize = bgpids.nalloc;
750 ➡ 752
751
-
No equivalent source code line in the reference code can be identified.
- while (nsize < (ps_index_t)js.c_childmax)
752
-
No equivalent source code line in the reference code can be identified.
- nsize *= 2;
753
-
+ nsize_max = TYPE_MAXIMUM (ps_index_t);
754
-
+ nsize_cur = (ps_index_t)js.c_childmax;
755
-
+ if (nsize_cur < 0) /* overflow */
756
-
+ nsize_cur = MAX_CHILD_MAX;
757
-
+
758
-
+ while (nsize > 0 && nsize < nsize_cur) /* > 0 should catch overflow */
759
-
+ nsize <<= 1;
760
-
+ if (nsize > nsize_max || nsize <= 0) /* overflow? */
761
-
+ nsize = nsize_max;
762
-
+ if (nsize > MAX_CHILD_MAX)
763
-
+ nsize = nsize_max = MAX_CHILD_MAX; /* hard cap */
753 ➡ 764
754
-
No equivalent source code line in the reference code can be identified.
- if (bgpids.nalloc < js.c_childmax)
765
-
+ if (bgpids.nalloc < nsize_cur && bgpids.nalloc < nsize_max)
755 ➡ 766 {
756 ➡ 767 bgpids.storage = (struct pidstat *)xrealloc (bgpids.storage, nsize * sizeof (struct pidstat));
757 ➡ 768
@@ -768,7 +779,7 @@ bgp_resize ()
768 ➡ 779 static ps_index_t
769 ➡ 780 bgp_getindex ()
770 ➡ 781 {
771
-
No equivalent source code line in the reference code can be identified.
- if (bgpids.nalloc < js.c_childmax || bgpids.head >= bgpids.nalloc)
782
-
+ if (bgpids.nalloc < (ps_index_t)js.c_childmax || bgpids.head >= bgpids.nalloc)
772 ➡ 783 bgp_resize ();
773 ➡ 784
774 ➡ 785 pshash_delindex (bgpids.head); /* XXX - clear before reusing */

Modified File: lib/readline/doc/hsuser.texi

LineTestsDifference Output
diff --git a/lib/readline/doc/hsuser.texi b/lib/readline/doc/hsuser.texi
index 1c25f813..d21f65d0 100644
--- a/lib/readline/doc/hsuser.texi
+++ b/lib/readline/doc/hsuser.texi
@@ -149,8 +149,8 @@ Both @var{first} and
149 @var{last} may be specified as a string (to locate the most recent
150 command beginning with that string) or as a number (an index into the
151 history list, where a negative number is used as an offset from the
152
-
No equivalent source code line in the reference code can be identified.
-current command number). If @var{last} is not specified it is set to
153
-
No equivalent source code line in the reference code can be identified.
-@var{first}. If @var{first} is not specified it is set to the previous
152
-
+current command number). If @var{last} is not specified, it is set to
153
-
+@var{first}. If @var{first} is not specified, it is set to the previous
154 command for editing and @minus{}16 for listing. If the @option{-l} flag is
155 given, the commands are listed on standard output. The @option{-n} flag
156 suppresses the command numbers when listing. The @option{-r} flag

Modified File: lib/readline/doc/readline.3

LineTestsDifference Output
diff --git a/lib/readline/doc/readline.3 b/lib/readline/doc/readline.3
index 5b555dcf..c084c658 100644
--- a/lib/readline/doc/readline.3
+++ b/lib/readline/doc/readline.3
@@ -378,13 +378,13 @@ in emacs mode and to
378 .B #
379 in vi command mode.
380 .TP
381
-
No equivalent source code line in the reference code can be identified.
-.B completion\-display\-width (-1)
381
-
+.B completion\-display\-width (\-1)
382 The number of screen columns used to display possible matches
383 when performing completion.
384 The value is ignored if it is less than 0 or greater than the terminal
385 screen width.
386 A value of 0 will cause matches to be displayed one per line.
387
-
No equivalent source code line in the reference code can be identified.
-The default value is -1.
387
-
+The default value is \-1.
388 .TP
389 .B completion\-ignore\-case (Off)
390 If set to \fBOn\fP, readline performs filename matching and completion

Modified File: lib/readline/readline.c

LineTestsDifference Output
diff --git a/lib/readline/readline.c b/lib/readline/readline.c
index 64154c54..4842a02e 100644
--- a/lib/readline/readline.c
+++ b/lib/readline/readline.c
@@ -242,7 +242,7 @@ int rl_erase_empty_line = 0;
242
243 /* Non-zero means to read only this many characters rather than up to a
244 character bound to accept-line. */
245
-
No equivalent source code line in the reference code can be identified.
-int rl_num_chars_to_read;
245
-
+int rl_num_chars_to_read = 0;
246
247 /* Line buffer and maintenance. */
248 char *rl_line_buffer = (char *)NULL;

Modified File: lib/readline/text.c

LineTestsDifference Output
diff --git a/lib/readline/text.c b/lib/readline/text.c
index 116a33b6..81de2a99 100644
--- a/lib/readline/text.c
+++ b/lib/readline/text.c
@@ -915,6 +915,7 @@ rl_insert (int count, int c)
915 x = 0;
916 n = (unsigned short)-2;
917 while (_rl_optimize_typeahead &&
918
0
+ rl_num_chars_to_read == 0 &&
918 ➡ 919 (RL_ISSTATE (RL_STATE_INPUTPENDING|RL_STATE_MACROINPUT) == 0) &&
919 ➡ 920 _rl_pushed_input_available () == 0 &&
920 ➡ 921 _rl_input_queued (0) &&

Modified File: redir.c

LineTestsDifference Output
diff --git a/redir.c b/redir.c
index 7104a3a7..ebb2c635 100644
--- a/redir.c
+++ b/redir.c
@@ -578,6 +578,10 @@ redir_special_open (spec, filename, flags, mode, ri)
578 #if defined (NETWORK_REDIRECTIONS)
579 case RF_DEVTCP:
580 case RF_DEVUDP:
581
-
+#if defined (RESTRICTED_SHELL)
582
0
+ if (restricted)
583
0
+ return (RESTRICTED_REDIRECT);
584
-
+#endif
581 ➡ 585 #if defined (HAVE_NETWORK)
582 ➡ 586 fd = netopen (filename);
583 ➡ 587 #else
@@ -850,7 +854,7 @@ do_redirection_internal (redirect, flags)
850 ➡ 854 fd = redir_open (redirectee_word, redirect->flags, 0666, ri);
851 ➡ 855 free (redirectee_word);
852 ➡ 856
853
1
Executed by:
  • Self test
- if (fd == NOCLOBBER_REDIRECT)
857
1
Executed by:
  • Self test
+ if (fd == NOCLOBBER_REDIRECT || fd == RESTRICTED_REDIRECT)
854 ➡ 858 return (fd);
855 ➡ 859
856 ➡ 860 if (fd < 0)

Generated by Squish Coco 4.1.2