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
SHELL = @MAKE_SHELL@
CP = cp
RM = rm -f
+RMDIR = rmdir
AR = @AR@
ARFLAGS = @ARFLAGS@
RANLIB = @RANLIB@
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) )
( 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
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
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:
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
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);
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);
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);
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);
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);
-$(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) )
.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,
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,
.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:
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
.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.
@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.
@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:
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
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
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
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