- term: if we see a left paren, scan forward for a closing right paren
and use posixtest() if there are 1-4 arguments between the parens to
avoid ambiguous behavior for expressions like true -a \( ! -a \),
- which a user would expect to return false instead of an error
- message
- Picked up from coreutils test
+ which, though it's horribly ambiguous, a user would expect to
+ return false instead of an error message
+ Picked up from coreutils-9.2 test
+
+ 3/25
+ ----
+bashansi.c
+ - HAVE_C_BOOL: prefer if defined, fall back to stdbool.h if bool isn't
+ a compiler builtin
+
+braces.c
+ - mkseq: simplify break condition
+
+builtins/printf.def
+ - decodeint: let the caller decide what to do with an overflow return,
+ don't return -1 after calling report_erange(). This will honor a
+ precision even if the field width overflows
+ - printf_builtin: check for overflow when adjusting precision for
+ string length with %Q
+ - printstr,printwidestr: now that the code uses decodeint, we don't
+ need to check the precision against INT_MAX
+
+bashansi.h
+ - include stddef.h if we have it, otherwise define replacements for
+ NULL and offsetof()
+
+builtins/help.def,lib/sh/fmtulong.c,lib/sh/getcwd.c,lib/sh/makepath.c,
+lib/sh/snprintf.c,lib/sh/strtod.c,lib/sh/strtol.c,unwind_prot.c,
+lib/readline/shell.c
+ - include bashansi.h instead of stddef.h, or remove a stddef.h include
+ if bashansi.h is already included
+ - remove extra definitions that appear in stddef.h or bashansi.h
+
+lib/sh/reallocarray.c,externs.h
+ - implementation of reallocarray(), originally from OpenBSD, from
+ Paul Eggert
+
+configure.ac
+ - use AC_REPLACE_FUNCS for reallocarray
+
+xmalloc.c,xmalloc.h
+ - xreallocarray: implementation of reallocarray that uses xrealloc
+ - sh_xreallocarray: implementation of reallocarray that uses
+ sh_xrealloc and has file and line information for error messages
+
+lib/sh/stringvec.c
+ - strvec_create, strvec_resize: rewrite in terms of xreallocarray
+ - strvec_mcreate, strvec_mresize: rewrite in terms of reallocarray
+ - strvec_remove, strvec_search, strvec_copy, strvec_from_word_list,
+ strvec_to_word_list: use size_t instead of int where appropriate
+
+lib/sh/stringvec.c,externs.h
+ - strvec_search: return a value of type ptrdiff_t, since size_t is
+ unsigned and we want to return -1 if not found
+
+ All from a report and patch by Paul Eggert <eggert@cs.ucla.edu>
+
+test.c
+ - term: change paren scan algorithm to count open and close parens so
+ we handle nested subexpressions. Still not compatible in the case
+ of something like test true -a \( ! -a \) \)
+
+ 3/27
+ ----
+parse.y
+ - flush_parser_state: new function, deallocates the members of a
+ parser state struct that are dynamically allocated
+ - parse_comsub: call flush_parser_state in places where we will
+ return an error or jump to the top level
+ Fixes memory leaks on error reported by bug_reports00@protonmail.com
+
+Makefile.in
+ - CREATED_MACOS: list of dSYM directories created by building and
+ testing
+ - distclean,maintainer-clean: remove $(CREATED_HEADERS) and
+ $(CREATED_MACOS)
+ - maintainer-clean: remove ctags/etags files
lib/sh/pathcanon.c f
lib/sh/pathphys.c f
lib/sh/random.c f
+lib/sh/reallocarray.c f
lib/sh/rename.c f
lib/sh/setlinebuf.c f
lib/sh/shmatch.c f
-# Makefile for bash-5.3, version 5.4
+# Makefile for bash-5.3, version 5.5
#
# Copyright (C) 1996-2024 Free Software Foundation, Inc.
mksignames$(EXEEXT) lsignames.h \
mksyntax${EXEEXT} syntax.c $(VERSPROG) $(VERSOBJ) \
buildversion.o mksignames.o signames.o buildsignames.o
+CREATED_MACOS = recho.dSYM zecho.dSYM printenv.dSYM xcase.dSYM \
+ bashversion.dSYM mksyntax.dSYM ${DEFDIR}/psize.aux.dSYM
CREATED_CONFIGURE = config.h config.cache config.status config.log \
stamp-h po/POTFILES config.status.lineno
CREATED_MAKEFILES = Makefile builtins/Makefile doc/Makefile \
-( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
-( cd $(LOADABLES_DIR) && $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
$(RM) $(CREATED_SUPPORT)
+ $(RM) -rf $(CREATED_MACOS)
mostlyclean: basic-clean
( cd $(DOCDIR) && $(MAKE) $(MFLAGS) $@ )
-( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
-( cd $(LOADABLES_DIR) && $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
$(RM) $(CREATED_CONFIGURE) tags TAGS
- $(RM) $(CREATED_SUPPORT) Makefile $(CREATED_MAKEFILES) pathnames.h
+ $(RM) $(CREATED_SUPPORT) Makefile $(CREATED_MAKEFILES) $(CREATED_HEADERS)
+ $(RM) -rf $(CREATED_MACOS)
maintainer-clean: basic-clean
@echo This command is intended for maintainers to use.
done
-( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
-( cd $(LOADABLES_DIR) && $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
- $(RM) $(CREATED_CONFIGURE) $(CREATED_MAKEFILES)
- $(RM) $(CREATED_SUPPORT) Makefile pathnames.h
+ $(RM) $(CREATED_CONFIGURE) Makefile $(CREATED_MAKEFILES) tags TAGS
+ $(RM) $(CREATED_SUPPORT) $(CREATED_HEADERS)
+ $(RM) -rf $(CREATED_MACOS)
maybe-clean:
-if test X"`cd $(topdir) && pwd -P`" != X"`cd $(BUILD_DIR) && pwd -P`" ; then \
# include "ansi_stdlib.h"
#endif /* !HAVE_STDLIB_H */
-/* Prefer stdbool.h if we have it, maybe have to rethink this later */
-#if defined (HAVE_STDBOOL_H)
-# include <stdbool.h>
-#else
-# ifndef HAVE_C_BOOL
+/* If bool is not a compiler builtin, prefer stdbool.h if we have it */
+#if !defined (HAVE_C_BOOL)
+# if defined (HAVE_STDBOOL_H)
+# include <stdbool.h>
+# else
# undef bool
typedef unsigned char bool;
+# define true 1
+# define false 0
# endif
#endif
+/* Include <stddef.h>, or define substitutes (config.h handles ptrdiff_t). */
+#ifdef HAVE_STDDEF_H
+# include <stddef.h>
+#endif
+/* Substitutes for definitions in stddef.h */
+#ifndef NULL
+# define NULL 0
+#endif
+#ifndef offsetof
+# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
+
#endif /* !_BASHANSI_H_ */
QUIT;
#endif
if (type == ST_INT)
- result[i++] = t = itos (n);
+ t = itos (n);
else if (type == ST_ZINT)
{
size_t tlen;
memset (t + (n < 0), '0', width - tlen);
}
}
- result[i++] = t;
}
else
{
t[0] = n;
t[1] = '\0';
}
- result[i++] = t;
}
+ result[i++] = t;
+
/* We failed to allocate memory for this number, so we bail. */
if (t == 0)
{
}
n += incr;
-
- if (i == nelem - 1)
- break;
}
- while (1);
+ while (i < nelem - 1);
result[i] = (char *)0;
return (result);
This file is fc.def, from which is created fc.c.
It implements the builtin "fc" in Bash.
-Copyright (C) 1987-2023 Free Software Foundation, Inc.
+Copyright (C) 1987-2024 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
runs the last command beginning with `cc' and typing `r' re-executes
the last command.
+The history builtin also operates on the history list.
+
Exit Status:
Returns success or status of executed command; non-zero if an error occurs.
$END
This file is help.def, from which is created help.c.
It implements the builtin "help" in Bash.
-Copyright (C) 1987-2023 Free Software Foundation, Inc.
+Copyright (C) 1987-2024 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#include <errno.h>
#include <filecntl.h>
-#include <stddef.h>
+#include "../bashansi.h"
#include "../bashintl.h"
This file is history.def, from which is created history.c.
It implements the builtin "history" in Bash.
-Copyright (C) 1987-2023 Free Software Foundation, Inc.
+Copyright (C) 1987-2024 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
and HISTFILE is unset or null, the -a, -n, -r, and -w options have
no effect and return success.
+The fc builtin also operates on the history list.
+
If the HISTTIMEFORMAT variable is set and not null, its value is used
as a format string for strftime(3) to print the time stamp associated
with each displayed history entry. No time stamps are printed otherwise.
v |= ckd_add (&pr, pr, *ps - '0');
}
if (v && diagnose)
- {
- report_erange (*str, ps);
- return -1;
- }
+ report_erange (*str, ps);
*str = ps;
return (v ? overflow_return : pr);
slen = strlen (xp);
if (convch == 'Q')
{
- if (slen > precision)
- precision = slen;
+ /* check for string length overflow when adjusting precision */
+ if (ckd_add (&precision, slen, 0))
+ {
+ builtin_error (_("%%Q: string length: %s"), strerror (ERANGE));
+ precision = -1;
+ }
}
/* Use printstr to get fieldwidth and precision right. */
r = printstr (start, xp, slen, fieldwidth, precision);
pr = decodeint (&fmt, 1, -1);
/* pr < precision means we adjusted precision in printf_builtin
for the quoted string length (%Q), so we use the adjusted value */
- if (pr < precision && precision < INT_MAX)
+ if (pr < precision)
pr = precision;
}
else
pr = decodeint (&fmt, 1, -1);
/* pr < precision means we adjusted precision in printf_builtin
for the quoted string length (%Q), so we use the adjusted value */
- if (pr < precision && precision < INT_MAX)
+ if (pr < precision)
pr = precision;
}
else
#! /bin/sh
-# From configure.ac for Bash 5.3, version 5.062.
+# From configure.ac for Bash 5.3, version 5.063.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for bash 5.3-devel.
#
fi
+ac_fn_c_check_func "$LINENO" "reallocarray" "ac_cv_func_reallocarray"
+if test "x$ac_cv_func_reallocarray" = xyes
+then :
+ printf "%s\n" "#define HAVE_REALLOCARRAY 1" >>confdefs.h
+
+else $as_nop
+ case " $LIBOBJS " in
+ *" reallocarray.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS reallocarray.$ac_objext"
+ ;;
+esac
+
+fi
+
ac_fn_c_check_header_compile "$LINENO" "libaudit.h" "ac_cv_header_libaudit_h" "$ac_includes_default"
if test "x$ac_cv_header_libaudit_h" = xyes
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-AC_REVISION([for Bash 5.3, version 5.062])dnl
+AC_REVISION([for Bash 5.3, version 5.063])dnl
define(bashvers, 5.3)
define(relstatus, devel)
AC_REPLACE_FUNCS(strchrnul)
AC_REPLACE_FUNCS(strdup)
AC_REPLACE_FUNCS(strlcpy)
+AC_REPLACE_FUNCS(reallocarray)
AC_CHECK_HEADERS(libaudit.h)
AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]])
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
-.\" Last Change: Mon Feb 19 16:52:45 EST 2024
+.\" Last Change: Mon Mar 25 10:56:35 EDT 2024
.\"
.\" bash_builtins, strip all but Built-Ins section
.\" avoid a warning about an undefined register
.\" .if !rzY .nr zY 0
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
-.TH BASH 1 "2024 February 19" "GNU Bash 5.3"
+.TH BASH 1 "2024 March 25" "GNU Bash 5.3"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
except that it prints the values of
indexed and associative arrays as a sequence of quoted key-value pairs
(see \fBArrays\fP above).
+The keys and values are quoted in a format that can be reused as input.
.TP
.B a
The expansion is a string consisting of flag values representing
except that it prints the values of
indexed and associative arrays as a sequence of quoted key-value pairs
(@pxref{Arrays}).
+The keys and values are quoted in a format that can be reused as input.
@item a
The expansion is a string consisting of flag values representing
@var{parameter}'s attributes.
Copyright (C) 1988-2024 Free Software Foundation, Inc.
@end ignore
-@set LASTCHANGE Mon Feb 19 16:52:26 EST 2024
+@set LASTCHANGE Mon Mar 25 10:56:49 EDT 2024
@set EDITION 5.3
@set VERSION 5.3
-@set UPDATED 19 February 2024
-@set UPDATED-MONTH February 2024
+@set UPDATED 25 March 2024
+@set UPDATED-MONTH March 2024
extern void seedrand32 (void);
extern u_bits32_t get_urandom32 (void);
+/* declarations for functions defined in lib/sh/reallocarray.c */
+extern void *reallocarray (void *, size_t, size_t);
+
/* declarations for functions defined in lib/sh/setlinebuf.c */
#ifdef NEED_SH_SETLINEBUF_DECL
extern int sh_setlinebuf (FILE *);
extern void strvec_dispose (char **);
extern int strvec_remove (char **, const char *);
extern size_t strvec_len (char * const *);
-extern int strvec_search (char **, const char *);
+extern ptrdiff_t strvec_search (char **, const char *);
extern char **strvec_copy (char * const *);
extern int strvec_posixcmp (char **, char **);
extern int strvec_strcmp (char **, char **);
extern struct passwd *getpwuid (uid_t);
#endif /* HAVE_GETPWUID && !HAVE_GETPW_DECLS */
-#ifndef NULL
-# define NULL 0
-#endif
-
#ifndef CHAR_BIT
# define CHAR_BIT 8
#endif
ufuncs.c casemod.c dprintf.c input_avail.c mbscasecmp.c fnxform.c \
strchrnul.c unicode.c wcswidth.c wcsnwidth.c shmbchar.c strdup.c \
strvis.c strlcpy.c strscpy.c utf8.c random.c gettimeofday.c \
- timers.c anonfile.c compat.c
+ timers.c anonfile.c reallocarray.c compat.c
# The header files for this library.
HSOURCES =
pathcanon.o: pathcanon.c
pathphys.o: pathphys.c
random.o: random.c
+reallocarray.o: reallocarray.c
rename.o: rename.c
setlinebuf.o: setlinebuf.c
shmatch.o: shmatch.c
pathcanon.o: ${BUILD_DIR}/config.h
pathphys.o: ${BUILD_DIR}/config.h
random.o: ${BUILD_DIR}/config.h
+reallocarray.o: ${BUILD_DIR}/config.h
rename.o: ${BUILD_DIR}/config.h
setlinebuf.o: ${BUILD_DIR}/config.h
shmatch.o: ${BUILD_DIR}/config.h
anonfile.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
anonfile.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
+reallocarray.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
+
compat.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
compat.o: ${topdir}/bashtypes.h
compat.o: ${BASHINCDIR}/filecntl.h
/* fmtulong.c -- Convert unsigned long int to string. */
-/* Copyright (C) 1998-2011,2023 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2011,2023-2024 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#endif
#include <bashansi.h>
-#ifdef HAVE_STDDEF_H
-# include <stddef.h>
-#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
/* getcwd.c -- get pathname of current directory */
-/* Copyright (C) 1991, 2022 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 2022, 2024 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
# define lstat stat
#endif
-#if !defined (NULL)
-# define NULL 0
-#endif
-
/* If the d_fileno member of a struct dirent doesn't return anything useful,
we need to check inode number equivalence the hard way. Return 1 if
the inode corresponding to PATH/DIR is identical to THISINO. */
/* makepath.c - glue PATH and DIR together into a full pathname. */
-/* Copyright (C) 1987-2020,2022-2023 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2020,2022-2024 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#include <tilde/tilde.h>
-#ifndef NULL
-# define NULL 0
-#endif
-
/* MAKE SURE THESE AGREE WITH ../../externs.h. */
#ifndef MP_DOTILDE
--- /dev/null
+/* reallocarray.c - reallocate memory for an array given type size and
+ number of elements */
+
+/* Copyright (C) 2024 Free Software Foundation, Inc.
+
+ This file is part of GNU Bash, the Bourne Again SHell.
+
+ Bash is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Bash is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Bash. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <config.h>
+
+#include "bashansi.h"
+#include <stdckdint.h>
+
+#include <errno.h>
+#if !defined (errno)
+extern int errno;
+#endif
+
+void *
+reallocarray (void *ptr, size_t nmemb, size_t size)
+{
+ size_t nbytes;
+
+ if (ckd_mul (&nbytes, nmemb, size))
+ {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ return realloc (ptr, nbytes);
+}
Unix snprintf implementation.
derived from inetutils/libinetutils/snprintf.c Version 1.1
- Copyright (C) 2001-2022 Free Software Foundation, Inc.
+ Copyright (C) 2001-2024 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
# include <limits.h>
#endif
#include <bashansi.h>
-#ifdef HAVE_STDDEF_H
-# include <stddef.h>
-#endif
#include <chartypes.h>
#ifdef HAVE_STDINT_H
char **
strvec_create (size_t n)
{
- size_t nbytes;
-
- return ckd_mul (&nbytes, n, sizeof (char *)) ? NULL : xmalloc (nbytes);
+ return ((char **)xreallocarray (NULL, n, sizeof (char *)));
}
/* Allocate an array of strings with room for N members. */
char **
strvec_mcreate (size_t n)
{
- size_t nbytes;
-
- return ckd_mul (&nbytes, n, sizeof (char *)) ? NULL : malloc (nbytes);
+ return ((char **)reallocarray (NULL, n, sizeof (char *)));
}
char **
strvec_resize (char **array, size_t nsize)
{
- size_t nbytes;
-
- return ckd_mul (&nbytes, nsize, sizeof (char *)) ? NULL : (char **)xrealloc (array, nbytes);
+ return ((char **)xreallocarray (array, nsize, sizeof (char *)));
}
char **
strvec_mresize (char **array, size_t nsize)
{
- size_t nbytes;
-
- return ckd_mul (&nbytes, nsize, sizeof (char *)) ? NULL : (char **)realloc (array, nbytes);
+ return ((char **)reallocarray (array, nsize, sizeof (char *)));
}
/* Return the length of ARRAY, a NULL terminated array of char *. */
int
strvec_remove (char **array, const char *name)
{
- register int i, j;
+ size_t i, j;
char *x;
if (array == 0)
/* Find NAME in ARRAY. Return the index of NAME, or -1 if not present.
ARRAY should be NULL terminated. */
-int
+ptrdiff_t
strvec_search (char **array, const char *name)
{
- int i;
+ size_t i;
for (i = 0; array[i]; i++)
if (STREQ (name, array[i]))
char **
strvec_copy (char * const *array)
{
- int i;
- size_t len;
+ size_t i, len;
char **ret;
len = strvec_len (array);
char **
strvec_from_word_list (WORD_LIST *list, int alloc, int starting_index, int *ip)
{
- int count;
+ size_t count;
char **array;
count = list_length ((GENERIC_LIST *)list);
{
WORD_LIST *list;
WORD_DESC *w;
- int i, count;
+ size_t i, count;
if (array == 0 || array[0] == 0)
return (WORD_LIST *)NULL;
/* strtod.c - convert string to double-precision floating-point value. */
-/* Copyright (C) 1991, 1992, 2022 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 2022-2024 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#include <bashansi.h>
-#ifndef NULL
-# define NULL 0
-#endif
-
#ifndef HUGE_VAL
# define HUGE_VAL HUGE
#endif
/* strtol - convert string representation of a number into a long integer value. */
-/* Copyright (C) 1991-2001,2022 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2024 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#include <stdc.h>
#include <bashansi.h>
-#ifndef NULL
-# define NULL 0
-#endif
-
/* Nonzero if we are defining `strtoul' or `strtoull', operating on
unsigned integers. */
#ifndef UNSIGNED
/* yyparse() has already called yyerror() and reset_parser(), so we set
PST_NOERROR to avoid a redundant error message. */
parser_state |= PST_NOERROR;
+
+ flush_parser_state (&ps);
return (&matched_pair_error);
}
else if (r != 0)
shell_eof_token = ps.eof_token;
expand_aliases = ps.expand_aliases;
+ flush_parser_state (&ps);
jump_to_top_level (DISCARD); /* XXX - return (&matched_pair_error)? */
}
}
shell_eof_token = ps.eof_token;
expand_aliases = ps.expand_aliases;
+ flush_parser_state (&ps);
return (&matched_pair_error);
}
shell_eof_token = ps->eof_token;
}
+/* Free the parts of a parser state struct that have allocated memory. */
+void
+flush_parser_state (sh_parser_state_t *ps)
+{
+ if (ps == 0)
+ return;
+
+ FREE (ps->token_state);
+ ps->token_state = 0;
+
+ if (ps->pipestatus)
+ array_dispose (ps->pipestatus);
+ ps->pipestatus = 0;
+
+ /* We want to free the saved token and leave the current token for error
+ reporting and cleanup. */
+ FREE (ps->token);
+ ps->token = 0;
+ ps->token_buffer_size = 0;
+}
+
sh_input_line_state_t *
save_input_line_state (sh_input_line_state_t *ls)
{
"Project-Id-Version: bash 5.2-rc1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-11 14:50-0500\n"
-"PO-Revision-Date: 2024-03-11 21:33+0100\n"
+"PO-Revision-Date: 2024-03-24 13:13+0100\n"
"Last-Translator: Nils Naumann <nau@gmx.net>\n"
"Language-Team: German <translation-team-de@lists.sourceforge.net>\n"
"Language: de\n"
# test
#: builtins.c:1262
-#, fuzzy
msgid ""
"Evaluate conditional expression.\n"
" \n"
msgstr ""
"Bedingten Ausdruck auswerten.\n"
" \n"
-" Wird Status 0 (wahr) oder 1 (falsch) abhängig vom Ergebnis des\n"
-" Ausdrucks. Die Ausdrücke können unär oder binär sein. Unäre\n"
+" Gibt den Status 0 (wahr) oder 1 (falsch) abhängig vom Ergebnis des\n"
+" Ausdrucks zurück. Die Ausdrücke können unär oder binär sein. Unäre\n"
" Ausdrücke werden häufig verwendet, um den Dateistatus zu ermitteln.\n"
" Es gibt weiterhin Zeichenketten und numerische Vergeichsoperatoren.\n"
" \n"
-" Das Verhalten von test hängt von der Argumentanzahl ab. Die\n"
-" bash Handbuchseite enthält deren vollständige Beschreibung.\n"
+" Das Verhalten hängt von der Argumentanzahl ab. Die bash\n"
+" Handbuchseite enthält deren vollständige Beschreibung.\n"
" \n"
" Dateioperatoren:\n"
" \n"
" -r Datei Wahr, wenn die Datei für den aktuellen Nutzer lesbar ist.\n"
" -s Datei Wahr, wenn die Datei existiert und nicht leer ist.\n"
" -S Datei Wahr, wenn die Datei ein Socket ist.\n"
-" -t FD Wahr, wenn FD auf einem Terminal geöffnet ist.\n"
+" -t FD Wahr, wenn FD auf einem Terminal geöffnet ist.\n"
" -u Datei Wahr, wenn das SetUID-Bit der Datei gesetzt ist.\n"
" -w Datei Wahr, wenn die Datei für den aktuellen Nutzer schreibbar ist.\n"
" -x Datei Wahr, wenn die Datei vom aktuellen Nutzer ausführbar ist.\n"
" -N Datei Wahr, wenn die Datei seit dem letzten Lesen geändert wurde.\n"
" \n"
" Datei1 -nt Datei2 Wahr, wenn Datei1 neuer als Datei2 ist (gemäß\n"
-" Änderungsdatum).\n"
+" Änderungsdatum).\n"
" \n"
" Datei1 -ot Datei2 Wahr, wenn Datei1 älter als Datei2 ist.\n"
" \n"
" Datei1 -ef Datei2 Wahr, wenn Datei1 ein harter Link zu Datei2 ist.\n"
" \n"
-" Zeichenfolgenoperatoren:\n"
+" Zeichenkettenoperatoren:\n"
" \n"
-" -z STRING Wahr, wenn die Zeichenfolge leer ist.\n"
+" -z STRING Wahr, wenn die Zeichenkette leer ist.\n"
" \n"
" -n STRING\n"
-" STRING Wahr, wenn die Zeichenfolge nicht leer ist.\n"
+" STRING Wahr, wenn die Zeichenkette nicht leer ist.\n"
" \n"
" STRING1 = STRING2\n"
-" Wahr, wenn die Zeichenfolgen gleich sind.\n"
+" Wahr, wenn die Zeichenketten gleich sind.\n"
" STRING1 != STRING2\n"
-" Wahr, wenn die Zeichenfolgen nicht gleich sind.\n"
+" Wahr, wenn die Zeichenketten nicht gleich sind.\n"
" STRING1 < STRING2\n"
" Wahr, wenn STRING1 lexikografisch vor STRING2\n"
" sortiert wird.\n"
" Andere Operatoren:\n"
" \n"
" -o OPTION Wahr, wenn die Shell-Option OPTION aktiviert ist.\n"
-" -v VAR Wahr, wenn die Shell-Variable VAR gesetzt ist.\n"
-" -R VAR Wahr, wenn die Variable gesetzt ist und ein Nameref ist.\n"
-" ! EXPR Wahr, wenn Ausdruck falsch ist.\n"
+" -v VAR Wahr, wenn die Shell-Variable VAR gesetzt ist.\n"
+" -R VAR Wahr, wenn die Variable gesetzt ist und ein Nameref ist.\n"
+" ! EXPR Wahr, wenn Ausdruck falsch ist.\n"
" EXPR1 -a EXPR2 Wahr, wenn sowohl expr1 als auch expr2 wahr sind.\n"
" EXPR1 -o EXPR2 Wahr, wenn entweder expr1 ODER expr2 wahr ist.\n"
" \n"
" Returns the status of the last command executed."
msgstr ""
+# coproc
#: builtins.c:1672
msgid ""
"Create a coprocess named NAME.\n"
" Exit Status:\n"
" The coproc command returns an exit status of 0."
msgstr ""
+"Startet einen Koprozess mit dem angegebenen Namen.\n"
+" \n"
+" Führt das angegebene Kommando asynchron in einem Kindprozess aus.\n"
+" Deren Standardaus- und -eingabe werden mit jeweils einer Pipe\n"
+" verbunden. Deren Dateideskriptoren sind in den Indexen 0 und 1 der\n"
+" Feldvariable mit dem angegebenen Namen verknüpft.\n"
+" Der Standardname ist „COPROC“.\n"
+" \n"
+" Rückgabewert:\n"
+" Der Befehl gibt immer 0 zurück."
# function
#: builtins.c:1686
/* shell.h -- The data structures used by the shell */
-/* Copyright (C) 1993-2023 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2024 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern sh_parser_state_t *save_parser_state (sh_parser_state_t *);
extern void restore_parser_state (sh_parser_state_t *);
+extern void flush_parser_state (sh_parser_state_t *);
extern sh_input_line_state_t *save_input_line_state (sh_input_line_state_t *);
extern void restore_input_line_state (sh_input_line_state_t *);
/* A paren-bracketed argument. */
if (argv[pos][0] == '(' && argv[pos][1] == '\0') /* ) */
{
- int nargs;
+ int nargs, count;
advance (1);
/* Steal an idea from coreutils and scan forward to check where the right
paren appears to prevent some ambiguity. If we find a valid sub-
- expression that has 1-4 arguments, call posixtest on it ( */
- for (nargs = 1; pos + nargs < argc && ISTOKEN (argv[pos+nargs], ')') == 0; nargs++)
- ;
- /* only do this if we have a valid parenthesized expression */
+ expression that has 1-4 arguments, call posixtest on it. Handle
+ nested subexpressions. ( */
+ for (nargs = count = 1; pos + nargs < argc; nargs++)
+ {
+ if (ISTOKEN (argv[pos+nargs], ')'))
+ count--;
+ else if (ISTOKEN (argv[pos+nargs], '(')) /*)*/
+ count++;
+ if (count == 0)
+ break;
+ }
+ /* only use posixtest if we have a valid parenthesized expression */
value = (pos + nargs < argc && nargs <= 4) ? posixtest (nargs) : expr ();
if (argv[pos] == 0) /* ( */
test_syntax_error (_("`)' expected"), (char *)NULL);
/* I can't stand it anymore! Please can't we just write the
whole Unix system in lisp or something? */
-/* Copyright (C) 1987-2023 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2024 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
# include <unistd.h>
#endif
-#if defined (HAVE_STDDEF_H)
-# include <stddef.h>
-#endif
-
-#ifndef offsetof
-# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-
#include "command.h"
#include "general.h"
#include "unwind_prot.h"
# include <unistd.h>
#endif
-#if defined (HAVE_STDLIB_H)
-# include <stdlib.h>
-#else
-# include "ansi_stdlib.h"
-#endif /* HAVE_STDLIB_H */
+#include "bashansi.h"
+#include <stdckdint.h>
#include "error.h"
return (temp);
}
+/* Reallocate the storage addressed by POINTER so that it is of
+ size NMEMB*SIZE, preserving contents like realloc does.
+ If POINTER is null, allocate new storage. This is like
+ glibc reallocarray except that it never returns a null pointer;
+ if storage is exhausted it reports an error and exits. */
+PTR_T
+xreallocarray (PTR_T ptr, size_t nmemb, size_t size)
+{
+ size_t nbytes;
+
+ if (ckd_mul (&nbytes, nmemb, size))
+ allocerr ("xreallocarray", (size_t)-1);
+
+ return xrealloc (ptr, nbytes);
+}
+
/* Use this as the function to call when adding unwind protects so we
don't need to know what free() returns. */
void
return (temp);
}
+PTR_T
+sh_xreallocarray (PTR_T ptr, size_t nmemb, size_t size, const char *file, int line)
+{
+ size_t nbytes;
+
+ if (ckd_mul (&nbytes, nmemb, size))
+ sh_allocerr ("xreallocarray", (size_t)-1, file, line);
+
+ return sh_xrealloc (ptr, nbytes, file, line);
+}
+
void
sh_xfree (PTR_T string, char *file, int line)
{
/* xmalloc.h -- defines for the `x' memory allocation functions */
-/* Copyright (C) 2001-2023 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2024 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
/* Allocation functions in xmalloc.c */
extern PTR_T xmalloc (size_t);
extern PTR_T xrealloc (void *, size_t);
+extern PTR_T xreallocarray (void *, size_t, size_t);
extern void xfree (void *);
#if defined(USING_BASH_MALLOC) && !defined (DISABLE_MALLOC_WRAPPERS)
extern PTR_T sh_xmalloc (size_t, const char *, int);
extern PTR_T sh_xrealloc (void *, size_t, const char *, int);
+extern PTR_T sh_xreallocarray (void *, size_t, size_t, const char *, int);
extern void sh_xfree (void *, const char *, int);
#define xmalloc(x) sh_xmalloc((x), __FILE__, __LINE__)
#define xrealloc(x, n) sh_xrealloc((x), (n), __FILE__, __LINE__)
+#define xreallocarray(x, n, s) sh_xreallocarray((x), (n), (s), __FILE__, __LINE__)
#define xfree(x) sh_xfree((x), __FILE__, __LINE__)
#ifdef free