mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-30 15:03:52 +02:00
add warning message for null arg to printf %d; update command -v help string; Makefile updates to uninstall directories
This commit is contained in:
@@ -10690,3 +10690,30 @@ Makefile.in
|
||||
depends on it
|
||||
- uninstall-headers: remove $(HYBRID_HEADERS); fix typo in recipe
|
||||
|
||||
11/21
|
||||
-----
|
||||
builtins/printf.def
|
||||
- chk_converror: inline function to use for single place to check
|
||||
for numeric overflow, change callers to use it
|
||||
|
||||
11/25
|
||||
-----
|
||||
doc/bash.1,doc/bashref.texi
|
||||
- minor updates to the section on bracket expressions in pattern
|
||||
matching
|
||||
|
||||
builtins/command.def
|
||||
- update -v help string to indicate that the output is a single word
|
||||
Report from Andrew Davis <addavis@gmail.com>
|
||||
|
||||
11/26
|
||||
-----
|
||||
builtins/printf.def
|
||||
- chk_converr: add check for no characters being converted at all,
|
||||
print same warning message as if *ep != 0. This covers the case of
|
||||
an empty string argument.
|
||||
Report by Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Makefile.in,doc/Makefile.in
|
||||
- uninstall: make sure the bash-specific directories created by
|
||||
`make install' are emptied and removed
|
||||
|
||||
@@ -74,6 +74,7 @@ YACC = @YACC@
|
||||
SHELL = @MAKE_SHELL@
|
||||
CP = cp
|
||||
RM = rm -f
|
||||
RMDIR = rmdir
|
||||
AR = @AR@
|
||||
ARFLAGS = @ARFLAGS@
|
||||
RANLIB = @RANLIB@
|
||||
@@ -964,6 +965,10 @@ install-headers: maybe-install-headers
|
||||
done
|
||||
-$(INSTALL_DATA) $(SUPPORT_DIR)/bash.pc $(DESTDIR)$(pkgconfigdir)/bash.pc
|
||||
|
||||
uninstall-headers-dirs:
|
||||
-$(RMDIR) $(DESTDIR)$(headersdir)/builtins $(DESTDIR)$(headersdir)/include
|
||||
-$(RMDIR) $(DESTDIR)$(headersdir)
|
||||
|
||||
uninstall-headers:
|
||||
-( cd $(DESTDIR)$(headersdir) && $(RM) $(INSTALLED_HEADERS) )
|
||||
-( cd $(DESTDIR)$(headersdir)/include && $(RM) $(INSTALLED_INCLUDE_HEADERS) )
|
||||
@@ -974,6 +979,9 @@ uninstall-headers:
|
||||
( cd $(DESTDIR)$(headersdir) && $(RM) $$(basename "$$hf") ) \
|
||||
done
|
||||
-( $(RM) $(DESTDIR)$(pkgconfigdir)/bash.pc )
|
||||
# uninstall-headers-dirs
|
||||
-$(RMDIR) $(DESTDIR)$(headersdir)/builtins $(DESTDIR)$(headersdir)/include
|
||||
-$(RMDIR) $(DESTDIR)$(headersdir)
|
||||
|
||||
uninstall: .made
|
||||
$(RM) $(DESTDIR)$(bindir)/$(Program) $(DESTDIR)$(bindir)/bashbug
|
||||
@@ -984,6 +992,7 @@ uninstall: .made
|
||||
infodir=$(infodir) htmldir=$(htmldir) DESTDIR=$(DESTDIR) $@ )
|
||||
-( cd $(PO_DIR) ; $(MAKE) $(BASH_MAKEFLAGS) DESTDIR=$(DESTDIR) $@ )
|
||||
-( cd $(LOADABLES_DIR) && $(MAKE) $(BASH_MAKEFLAGS) DESTDIR=$(DESTDIR) $@ )
|
||||
-$(RMDIR) $(DESTDIR)$(loadablesdir) $(DESTDIR)$(docdir)
|
||||
|
||||
.PHONY: basic-clean clean maintainer-clean distclean mostlyclean maybe-clean
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ on disk when a function with the same name exists.
|
||||
Options:
|
||||
-p use a default value for PATH that is guaranteed to find all of
|
||||
the standard utilities
|
||||
-v print a description of COMMAND similar to the `type' builtin
|
||||
-v print a single-word indicating the command or filename that
|
||||
invokes COMMAND
|
||||
-V print a more verbose description of each COMMAND
|
||||
|
||||
Exit Status:
|
||||
|
||||
+26
-53
@@ -1355,6 +1355,24 @@ getstr (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* POSIX.2 says ``...a diagnostic message shall be written to standard
|
||||
error, and the utility shall not exit with a zero exit status, but
|
||||
shall continue processing any remaining operands and shall write the
|
||||
value accumulated at the time the error was detected to standard
|
||||
output.'' */
|
||||
|
||||
static inline void
|
||||
chk_converror (char *s, char *ep)
|
||||
{
|
||||
if (*ep || ep == s)
|
||||
{
|
||||
sh_invalidnum (s);
|
||||
conversion_error = 1;
|
||||
}
|
||||
else if (errno == ERANGE)
|
||||
printf_erange (s);
|
||||
}
|
||||
|
||||
/* Don't call getintmax here because it may consume an argument on error, and
|
||||
we call this to get field width/precision arguments. */
|
||||
static int
|
||||
@@ -1372,15 +1390,10 @@ getint (int overflow_retval)
|
||||
|
||||
errno = 0;
|
||||
ret = strtoimax (garglist->word->word, &ep, 0);
|
||||
overflow = (errno == ERANGE) || (ret < INT_MIN || ret > INT_MAX);
|
||||
if (overflow = (errno == ERANGE) || (ret < INT_MIN || ret > INT_MAX))
|
||||
errno = ERANGE; /* force errno */
|
||||
|
||||
if (*ep)
|
||||
{
|
||||
sh_invalidnum (garglist->word->word);
|
||||
conversion_error = 1;
|
||||
}
|
||||
else if (overflow)
|
||||
printf_erange (garglist->word->word);
|
||||
chk_converror (garglist->word->word, ep);
|
||||
|
||||
garglist = garglist->next;
|
||||
return (overflow ? overflow_retval : (int)ret);
|
||||
@@ -1401,21 +1414,7 @@ getintmax (void)
|
||||
errno = 0;
|
||||
ret = strtoimax (garglist->word->word, &ep, 0);
|
||||
|
||||
if (*ep)
|
||||
{
|
||||
sh_invalidnum (garglist->word->word);
|
||||
/* POSIX.2 says ``...a diagnostic message shall be written to standard
|
||||
error, and the utility shall not exit with a zero exit status, but
|
||||
shall continue processing any remaining operands and shall write the
|
||||
value accumulated at the time the error was detected to standard
|
||||
output.'' Yecch. */
|
||||
#if 0
|
||||
ret = 0; /* return partially-converted value from strtoimax */
|
||||
#endif
|
||||
conversion_error = 1;
|
||||
}
|
||||
else if (errno == ERANGE)
|
||||
printf_erange (garglist->word->word);
|
||||
chk_converror (garglist->word->word, ep);
|
||||
|
||||
garglist = garglist->next;
|
||||
return (ret);
|
||||
@@ -1435,18 +1434,8 @@ getuintmax (void)
|
||||
|
||||
errno = 0;
|
||||
ret = strtoumax (garglist->word->word, &ep, 0);
|
||||
|
||||
if (*ep)
|
||||
{
|
||||
sh_invalidnum (garglist->word->word);
|
||||
#if 0
|
||||
/* Same POSIX.2 conversion error requirements as getintmax(). */
|
||||
ret = 0;
|
||||
#endif
|
||||
conversion_error = 1;
|
||||
}
|
||||
else if (errno == ERANGE)
|
||||
printf_erange (garglist->word->word);
|
||||
|
||||
chk_converror (garglist->word->word, ep);
|
||||
|
||||
garglist = garglist->next;
|
||||
return (ret);
|
||||
@@ -1467,13 +1456,7 @@ getdouble (void)
|
||||
errno = 0;
|
||||
ret = strtod (garglist->word->word, &ep);
|
||||
|
||||
if (*ep)
|
||||
{
|
||||
sh_invalidnum (garglist->word->word);
|
||||
conversion_error = 1;
|
||||
}
|
||||
else if (errno == ERANGE)
|
||||
printf_erange (garglist->word->word);
|
||||
chk_converror (garglist->word->word, ep);
|
||||
|
||||
garglist = garglist->next;
|
||||
return (ret);
|
||||
@@ -1494,17 +1477,7 @@ getfloatmax (void)
|
||||
errno = 0;
|
||||
ret = strtofltmax (garglist->word->word, &ep);
|
||||
|
||||
if (*ep)
|
||||
{
|
||||
sh_invalidnum (garglist->word->word);
|
||||
#if 0
|
||||
/* Same thing about POSIX.2 conversion error requirements. */
|
||||
ret = 0;
|
||||
#endif
|
||||
conversion_error = 1;
|
||||
}
|
||||
else if (errno == ERANGE)
|
||||
printf_erange (garglist->word->word);
|
||||
chk_converror (garglist->word->word, ep);
|
||||
|
||||
garglist = garglist->next;
|
||||
return (ret);
|
||||
|
||||
+1
-1
@@ -304,7 +304,7 @@ uninstall:
|
||||
-$(RM) $(DESTDIR)$(man1dir)/bash_builtins${man1ext}
|
||||
$(RM) $(DESTDIR)$(infodir)/bash.info
|
||||
# run install-info if it is present to update the info directory
|
||||
if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
|
||||
-if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
|
||||
install-info --delete --dir-file=$(DESTDIR)$(infodir)/dir $(DESTDIR)$(infodir)/bash.info; \
|
||||
else true; fi
|
||||
-( cd $(DESTDIR)$(docdir) && $(RM) $(OTHER_INSTALLED_DOCS) )
|
||||
|
||||
+16
-25
@@ -4264,7 +4264,9 @@ Matches any single character.
|
||||
.TP
|
||||
.BR [ .\|.\|. ]
|
||||
.PD
|
||||
Matches any one of the enclosed characters.
|
||||
Matches any one of the characters enclosed between the brackets.
|
||||
This is known as a \fIbracket expression\fP
|
||||
and matches a single character.
|
||||
A pair of characters separated by a hyphen denotes a
|
||||
\fIrange expression\fP;
|
||||
any character that falls between those two characters, inclusive,
|
||||
@@ -4276,14 +4278,12 @@ is a
|
||||
or a
|
||||
.B \*^
|
||||
then any character not within the range matches.
|
||||
A
|
||||
.B \-
|
||||
may be matched by including it as the first or last character
|
||||
in the set.
|
||||
A
|
||||
.B ]
|
||||
may be matched by including it as the first character
|
||||
in the set.
|
||||
To match a
|
||||
.BR \- ,
|
||||
include it as the first or last character in the set.
|
||||
To match a
|
||||
.BR ] ,
|
||||
include it as the first character in the set.
|
||||
.IP
|
||||
The sorting order of characters in range expressions,
|
||||
and the characters included in the range,
|
||||
@@ -4308,10 +4308,7 @@ or enable the
|
||||
.B globasciiranges
|
||||
shell option.
|
||||
.IP
|
||||
Within
|
||||
.B [
|
||||
and
|
||||
.BR ] ,
|
||||
Within a bracket expression,
|
||||
\fIcharacter classes\fP can be specified using the syntax
|
||||
\fB[:\fP\fIclass\fP\fB:]\fP, where \fIclass\fP is one of the
|
||||
following classes defined in the POSIX standard:
|
||||
@@ -4327,19 +4324,13 @@ print punct space upper word xdigit
|
||||
A character class matches any character belonging to that class.
|
||||
The \fBword\fP character class matches letters, digits, and the character _.
|
||||
.IP
|
||||
Within
|
||||
.B [
|
||||
and
|
||||
.BR ] ,
|
||||
Within a bracket expression,
|
||||
an \fIequivalence class\fP can be specified using the syntax
|
||||
\fB[=\fP\fIc\fP\fB=]\fP, which matches all characters with the
|
||||
same collation weight (as defined by the current locale) as
|
||||
the character \fIc\fP.
|
||||
.IP
|
||||
Within
|
||||
.B [
|
||||
and
|
||||
.BR ] ,
|
||||
Within a bracket expression,
|
||||
the syntax \fB[.\fP\fIsymbol\fP\fB.]\fP matches the collating symbol
|
||||
\fIsymbol\fP.
|
||||
.RE
|
||||
@@ -13137,12 +13128,12 @@ Aliases are confusing in some uses.
|
||||
.PP
|
||||
Shell builtin commands and functions are not stoppable/restartable.
|
||||
.PP
|
||||
Compound commands and command sequences of the form
|
||||
Compound commands and command lists of the form
|
||||
.Q "a ; b ; c"
|
||||
are not handled gracefully when process suspension is attempted.
|
||||
are not handled gracefully when combined with process suspension.
|
||||
When a process is stopped, the shell immediately executes the next
|
||||
command in the sequence.
|
||||
It suffices to place the sequence of commands between parentheses to
|
||||
command in the list or breaks out of any existing loops.
|
||||
It suffices to enclose the command in parentheses to
|
||||
force it into a subshell, which may be stopped as a unit,
|
||||
or to start the command in the background and immediately
|
||||
bring it into the foreground.
|
||||
|
||||
+16
-5
@@ -3053,12 +3053,14 @@ directories and subdirectories.
|
||||
@item ?
|
||||
Matches any single character.
|
||||
@item [@dots{}]
|
||||
Matches any one of the enclosed characters.
|
||||
Matches any one of the characters enclosed between the brackets.
|
||||
This is known as a @dfn{bracket expression}
|
||||
and matches a single character.
|
||||
A pair of characters separated by a hyphen denotes a @dfn{range expression};
|
||||
any character that falls between those two characters, inclusive,
|
||||
using the current locale's collating sequence and character set, matches.
|
||||
If the first character following the
|
||||
@samp{[} is a @samp{!} or a @samp{^}
|
||||
@samp{[} is a @samp{!} or a @samp{^}
|
||||
then any character not within the range matches.
|
||||
To match a @samp{@minus{}}, include it as the first
|
||||
or last character in the set.
|
||||
@@ -3081,7 +3083,7 @@ force the use of the C locale by setting the @env{LC_COLLATE} or
|
||||
@env{LC_ALL} environment variable to the value @samp{C}, or enable the
|
||||
@code{globasciiranges} shell option.
|
||||
|
||||
Within @samp{[} and @samp{]}, @dfn{character classes} can be specified
|
||||
Within a bracket expression, @dfn{character classes} can be specified
|
||||
using the syntax
|
||||
@code{[:}@var{class}@code{:]}, where @var{class} is one of the
|
||||
following classes defined in the @sc{posix} standard:
|
||||
@@ -3094,12 +3096,21 @@ A character class matches any character belonging to that class.
|
||||
The @code{word} character class matches letters, digits, and the character
|
||||
@samp{_}.
|
||||
|
||||
Within @samp{[} and @samp{]}, an @dfn{equivalence class} can be
|
||||
For instance, the following pattern will match any character belonging
|
||||
to the @code{space} character class in the current locale, then any
|
||||
upper case letter or @samp{!}, a dot, and finally any lower case letter
|
||||
or a hyphen.
|
||||
|
||||
@example
|
||||
[[:space:]][[:upper:]!].[-[:lower:]]
|
||||
@end example
|
||||
|
||||
Within a bracket expression, an @dfn{equivalence class} can be
|
||||
specified using the syntax @code{[=}@var{c}@code{=]}, which
|
||||
matches all characters with the same collation weight (as defined
|
||||
by the current locale) as the character @var{c}.
|
||||
|
||||
Within @samp{[} and @samp{]}, the syntax @code{[.}@var{symbol}@code{.]}
|
||||
Within a bracket expression, the syntax @code{[.}@var{symbol}@code{.]}
|
||||
matches the collating symbol @var{symbol}.
|
||||
@end table
|
||||
|
||||
|
||||
+3
-3
@@ -2,10 +2,10 @@
|
||||
Copyright (C) 1988-2024 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Wed Oct 23 11:32:20 EDT 2024
|
||||
@set LASTCHANGE Mon Nov 25 15:20:23 EST 2024
|
||||
|
||||
@set EDITION 5.3
|
||||
@set VERSION 5.3
|
||||
|
||||
@set UPDATED 23 October 2024
|
||||
@set UPDATED-MONTH October 2024
|
||||
@set UPDATED 25 November 2024
|
||||
@set UPDATED-MONTH November 2024
|
||||
|
||||
@@ -169,6 +169,12 @@ xx
|
||||
9223372036854775807
|
||||
./printf.tests: line 365: printf: -9223372036854775815: Result too large
|
||||
-9223372036854775808
|
||||
./printf.tests: line 368: printf: +: invalid number
|
||||
0
|
||||
./printf.tests: line 369: printf: z: invalid number
|
||||
0
|
||||
./printf.tests: line 370: printf: : invalid number
|
||||
0
|
||||
one
|
||||
one\ctwo
|
||||
4\.2
|
||||
|
||||
@@ -364,6 +364,11 @@ TOOSMALL=-9223372036854775815
|
||||
printf '%d\n' "$TOOBIG"
|
||||
printf '%d\n' "$TOOSMALL"
|
||||
|
||||
# arguments that are not completely converted generate warning messages
|
||||
printf '%d\n' +
|
||||
printf '%d\n' z
|
||||
printf '%d\n' ''
|
||||
|
||||
# tests variable assignment with -v
|
||||
${THIS_SH} ./printf1.sub
|
||||
${THIS_SH} ./printf2.sub
|
||||
|
||||
Reference in New Issue
Block a user