additional error checking for declare; changes for MSYS32; add support for unlocked-io stdio functions; several C23 changes

This commit is contained in:
Chet Ramey
2024-02-16 10:55:13 -05:00
parent 6bd75b8d63
commit e1dd98a1db
28 changed files with 1419 additions and 481 deletions
+33
View File
@@ -8607,3 +8607,36 @@ execute_cmd.c
- execute_function: if we didn't compile with debugger support, restore
currently_executing_command after run_debug_trap, like in other
cases
2/13
----
builtins/declare.def
- declare_invalid_opts: move the code that checks for invalid option
combinations to its own function; it returns 0 for no errors and
a return code for declare_internal to return otherwise
Inspired by report from Grisha Levit <grishalevit@gmail.com>
- declare_invalid_opts: make -A -a and -A +A/-a +a option combinations
invalid
Report from Grisha Levit <grishalevit@gmail.com>
2/14
----
bashline.c,general.c,subst.c,lib/sh/pathphys.c,builtins/read.def,
support/bashversion.c
- changes for cygwin and msys (no new features)
bashline.c,builtins/fc.def,general.c,parse.y,stringlib.c,subst.c,variables.c
- MSYS-specific changes to support \r\n line endings and DOS-style
paths
configure.ac,cross-build/msys32.cache,support/config.rpath,support/shobj-conf
- MSYS-specific build options
configure.ac,config.h.in,m4/unlocked-io.m4,general.h,include/unlocked-io.h
MANIFEST
- adapt Gnulib's unlocked-io module for faster stdio functions.
From Grisha Levit <grishalevit@gmail.com>
lib/malloc/malloc.c,lib/malloc/table.h,lib/sh/strlcpy.c
- fixes for ISO C 23
Patch from Collin Funk <collin.funk1@gmail.com>
+3
View File
@@ -211,6 +211,7 @@ builtins/bashgetopt.c f
builtins/common.h f
builtins/bashgetopt.h f
#cross-build/cygwin32.cache f
cross-build/msys32.cache f
cross-build/x86-beos.cache f
cross-build/opennt.cache f
cross-build/qnx.cache f
@@ -236,6 +237,7 @@ include/systimes.h f
include/timer.h f
include/typemax.h f
include/unionwait.h f
include/unlocked-io.h f
lib/glob/Makefile.in f
lib/glob/sm_loop.c f
lib/glob/smatch.c f
@@ -521,6 +523,7 @@ lib/tilde/Makefile.in f
lib/tilde/tilde.c f
lib/tilde/tilde.h f
lib/tilde/shell.c f
m4/unlocked-io.m4 f
m4/strtoimax.m4 f
m4/stat-time.m4 f
m4/timespec.m4 f
+17
View File
@@ -798,7 +798,11 @@ snarf_hosts_from_file (const char *filename)
char *temp, buffer[256], name[256];
register int i, start;
#ifdef __MSYS__
file = fopen (filename, "rt");
#else
file = fopen (filename, "r");
#endif
if (file == 0)
return;
@@ -3129,6 +3133,19 @@ test_for_directory (const char *name)
int r;
fn = bash_tilde_expand (name, 0);
#if __CYGWIN
/* stat("//server") can only be successful as a directory, but can take
seconds to time out on failure. It is much faster to assume that
"//server" is a valid name than it is to wait for a stat, even if it
gives false positives on bad names. */
if (fn[0] == '/' && fn[1] == '/' && ! strchr (&fn[2], '/'))
{
free (fn);
return 1;
}
#endif
r = file_isdir (fn);
free (fn);
+52 -18
View File
@@ -218,6 +218,45 @@ declare_transform_name (char *name, int flags_on, int flags_off)
return (newname);
}
/* Some option combinations that don't make any sense */
static int
declare_invalid_opts (int flags_on, int flags_off)
{
if ((flags_on & att_function) && (flags_on & (att_array|att_assoc|att_integer|att_nameref)))
{
char *optchar;
if (flags_on & att_nameref)
optchar = "-n";
else if (flags_on & att_integer)
optchar = "-i";
else if (flags_on & att_assoc)
optchar = "-A";
else if (flags_on & att_array)
optchar = "-a";
sh_invalidopt (optchar);
return (EXECUTION_FAILURE);
}
else if ((flags_on & att_assoc) && (flags_off & att_assoc))
{
sh_invalidopt ("-A");
return (EX_BADUSAGE);
}
else if ((flags_on & att_array) && (flags_off & att_array))
{
sh_invalidopt ("-a");
return (EX_BADUSAGE);
}
else if ((flags_on & att_assoc) && (flags_on & att_array))
{
sh_invalidopt ("-a");
return (EX_BADUSAGE);
}
return 0;
}
/* The workhorse function. */
static int
declare_internal (WORD_LIST *list, int local_var)
@@ -244,6 +283,10 @@ declare_internal (WORD_LIST *list, int local_var)
case 'a':
#if defined (ARRAY_VARS)
*flags |= att_array;
#if 0
if (flags == &flags_on)
*flags &= ~att_assoc; /* last one wins */
#endif
break;
#else
builtin_usage ();
@@ -252,6 +295,10 @@ declare_internal (WORD_LIST *list, int local_var)
case 'A':
#if defined (ARRAY_VARS)
*flags |= att_assoc;
#if 0
if (flags == &flags_on)
*flags &= ~att_array; /* last one wins */
#endif
break;
#else
builtin_usage ();
@@ -359,24 +406,11 @@ declare_internal (WORD_LIST *list, int local_var)
return (sh_chkwrite (any_failed ? EXECUTION_FAILURE : EXECUTION_SUCCESS));
}
/* Some option combinations that don't make any sense */
if ((flags_on & att_function) && (flags_on & (att_array|att_assoc|att_integer|att_nameref)))
{
char *optchar;
if (flags_on & att_nameref)
optchar = "-n";
else if (flags_on & att_integer)
optchar = "-i";
else if (flags_on & att_assoc)
optchar = "-A";
else if (flags_on & att_array)
optchar = "-a";
sh_invalidopt (optchar);
return (EXECUTION_FAILURE);
}
/* check for some invalid option combinations that are usage errors */
opt = declare_invalid_opts (flags_on, flags_off);
if (opt != 0)
return (opt);
#define NEXT_VARIABLE() free (name); list = list->next; continue
/* There are arguments left, so we are making variables. */
+12
View File
@@ -690,6 +690,9 @@ static char *
fc_readline (FILE *stream)
{
register int c;
#ifdef __MSYS__
register int d;
#endif
int line_len = 0, lindex = 0;
char *line = (char *)NULL;
@@ -698,6 +701,11 @@ fc_readline (FILE *stream)
if ((lindex + 2) >= line_len)
line = (char *)xrealloc (line, (line_len += 128));
#ifdef __MSYS__
if (d == '\r')
lindex--;
#endif
if (c == '\n')
{
line[lindex++] = '\n';
@@ -706,6 +714,10 @@ fc_readline (FILE *stream)
}
else
line[lindex++] = c;
#ifdef __MSYS__
d = c;
#endif
}
if (!lindex)
-5
View File
@@ -88,7 +88,6 @@ $END
#ifdef __CYGWIN__
# include <fcntl.h>
# include <io.h>
#endif
#include "../bashintl.h"
@@ -643,10 +642,6 @@ read_builtin (WORD_LIST *list)
fflush (stderr);
}
#if defined (__CYGWIN__) && defined (O_TEXT)
setmode (0, O_TEXT);
#endif
ps2 = 0;
for (print_ps2 = eof = retval = 0;;)
{
+17 -1
View File
@@ -1,6 +1,6 @@
/* config.h -- Configuration file for bash. */
/* Copyright (C) 1987-2009,2011-2012,2013-2023 Free Software Foundation, Inc.
/* Copyright (C) 1987-2009,2011-2012,2013-2024 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -510,6 +510,22 @@
#undef HAVE_DECL_STRTOULL
#undef HAVE_DECL_STRTOUMAX
/* These are checked with BASH_FUNC_UNLOCKED_IO */
#undef HAVE_DECL_CLEARERR_UNLOCKED
#undef HAVE_DECL_FEOF_UNLOCKED
#undef HAVE_DECL_FERROR_UNLOCKED
#undef HAVE_DECL_FFLUSH_UNLOCKED
#undef HAVE_DECL_FGETS_UNLOCKED
#undef HAVE_DECL_FPUTC_UNLOCKED
#undef HAVE_DECL_FPUTS_UNLOCKED
#undef HAVE_DECL_FREAD_UNLOCKED
#undef HAVE_DECL_FWRITE_UNLOCKED
#undef HAVE_DECL_GETC_UNLOCKED
#undef HAVE_DECL_GETCHAR_UNLOCKED
#undef HAVE_DECL_PUTC_UNLOCKED
#undef HAVE_DECL_PUTCHAR_UNLOCKED
/* Characteristics of system calls and C library functions. */
/* Define if the `getpgrp' function takes no argument. */
Vendored
+249 -15
View File
@@ -1,5 +1,5 @@
#! /bin/sh
# From configure.ac for Bash 5.3, version 5.060.
# From configure.ac for Bash 5.3, version 5.061.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for bash 5.3-devel.
#
@@ -3284,7 +3284,7 @@ m68k-sysv) opt_bash_malloc=no ;; # fixes file descriptor leak in closedir
# These need additional investigation
sparc-linux*) opt_bash_malloc=no ;; # sparc running linux; requires ELF
*-aix*) opt_bash_malloc=no ;; # AIX machines
*-cygwin*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment
*-cygwin*|msys*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment
# These lack a working sbrk(2)
aarch64-freebsd*) opt_bash_malloc=no ;;
riscv*-freebsd*) opt_bash_malloc=no ;;
@@ -5290,6 +5290,9 @@ if test "x$cross_compiling" = "xyes"; then
*-cygwin*)
cross_cache=${srcdir}/cross-build/cygwin32.cache
;;
*-msys*)
cross_cache=${srcdir}/cross-build/msys32.cache
;;
*-mingw*)
cross_cache=${srcdir}/cross-build/cygwin32.cache
;;
@@ -6147,7 +6150,7 @@ if test $opt_readline = yes; then
# section for OS versions that don't allow unresolved symbols
# to be compiled into dynamic libraries.
case "$host_os" in
cygwin*) TILDE_LIB= ;;
cygwin*|msys*) TILDE_LIB= ;;
esac
else
RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
@@ -6670,6 +6673,16 @@ fi
# unlocked-io.m4 serial 16
# Copyright (C) 1998-2006, 2009-2024 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# codeset.m4 serial 5 (gettext-0.18.2)
@@ -9055,8 +9068,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \
LIBS=$save_LIBS
test $gl_pthread_api = yes && break
done
echo "$as_me:9058: gl_pthread_api=$gl_pthread_api" >&5
echo "$as_me:9059: LIBPTHREAD=$LIBPTHREAD" >&5
echo "$as_me:9071: gl_pthread_api=$gl_pthread_api" >&5
echo "$as_me:9072: LIBPTHREAD=$LIBPTHREAD" >&5
gl_pthread_in_glibc=no
# On Linux with glibc >= 2.34, libc contains the fully functional
@@ -9082,7 +9095,7 @@ rm -rf conftest*
;;
esac
echo "$as_me:9085: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&5
echo "$as_me:9098: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&5
# Test for libpthread by looking for pthread_kill. (Not pthread_self,
# since it is defined as a macro on OSF/1.)
@@ -9236,7 +9249,7 @@ fi
fi
fi
echo "$as_me:9239: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&5
echo "$as_me:9252: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&5
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5
printf %s "checking whether POSIX threads API is available... " >&6; }
@@ -9464,8 +9477,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \
LIBS=$save_LIBS
test $gl_pthread_api = yes && break
done
echo "$as_me:9467: gl_pthread_api=$gl_pthread_api" >&5
echo "$as_me:9468: LIBPTHREAD=$LIBPTHREAD" >&5
echo "$as_me:9480: gl_pthread_api=$gl_pthread_api" >&5
echo "$as_me:9481: LIBPTHREAD=$LIBPTHREAD" >&5
gl_pthread_in_glibc=no
# On Linux with glibc >= 2.34, libc contains the fully functional
@@ -9491,7 +9504,7 @@ rm -rf conftest*
;;
esac
echo "$as_me:9494: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&5
echo "$as_me:9507: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&5
# Test for libpthread by looking for pthread_kill. (Not pthread_self,
# since it is defined as a macro on OSF/1.)
@@ -9645,7 +9658,7 @@ fi
fi
fi
echo "$as_me:9648: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&5
echo "$as_me:9661: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&5
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5
printf %s "checking whether POSIX threads API is available... " >&6; }
@@ -18467,6 +18480,96 @@ printf "%s\n" "#define DUP2_BROKEN 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pgrps need synchronization" >&5
printf %s "checking whether pgrps need synchronization... " >&6; }
if test ${bash_cv_pgrp_pipe+y}
then :
printf %s "(cached) " >&6
else $as_nop
if test "$cross_compiling" = yes
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cannot check pgrp synchronization if cross compiling -- defaulting to no" >&5
printf "%s\n" "$as_me: WARNING: cannot check pgrp synchronization if cross compiling -- defaulting to no" >&2;}
bash_cv_pgrp_pipe=no
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
#include <stdlib.h>
int
main()
{
# ifdef GETPGRP_VOID
# define getpgID() getpgrp()
# else
# define getpgID() getpgrp(0)
# define setpgid(x,y) setpgrp(x,y)
# endif
int pid1, pid2, fds[2];
int status;
char ok;
switch (pid1 = fork()) {
case -1:
exit(1);
case 0:
setpgid(0, getpid());
exit(0);
}
setpgid(pid1, pid1);
sleep(2); /* let first child die */
if (pipe(fds) < 0)
exit(2);
switch (pid2 = fork()) {
case -1:
exit(3);
case 0:
setpgid(0, pid1);
ok = getpgID() == pid1;
write(fds[1], &ok, 1);
exit(0);
}
setpgid(pid2, pid1);
close(fds[1]);
if (read(fds[0], &ok, 1) != 1)
exit(4);
wait(&status);
wait(&status);
exit(ok ? 0 : 5);
}
_ACEOF
if ac_fn_c_try_run "$LINENO"
then :
bash_cv_pgrp_pipe=no
else $as_nop
bash_cv_pgrp_pipe=yes
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_pgrp_pipe" >&5
printf "%s\n" "$bash_cv_pgrp_pipe" >&6; }
if test $bash_cv_pgrp_pipe = yes; then
printf "%s\n" "#define PGRP_PIPE 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for type of signal functions" >&5
printf %s "checking for type of signal functions... " >&6; }
if test ${bash_cv_signal_vintage+y}
@@ -18605,9 +18708,6 @@ printf "%s\n" "#define HAVE_USG_SIGHOLD 1" >>confdefs.h
fi
printf "%s\n" "#define PGRP_PIPE 1" >>confdefs.h
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sys_errlist and sys_nerr" >&5
printf %s "checking for sys_errlist and sys_nerr... " >&6; }
if test ${bash_cv_sys_errlist+y}
@@ -20738,6 +20838,140 @@ esac
fi
ac_fn_check_decl "$LINENO" "clearerr_unlocked" "ac_cv_have_decl_clearerr_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_clearerr_unlocked" = xyes
then :
ac_have_decl=1
else $as_nop
ac_have_decl=0
fi
printf "%s\n" "#define HAVE_DECL_CLEARERR_UNLOCKED $ac_have_decl" >>confdefs.h
ac_fn_check_decl "$LINENO" "feof_unlocked" "ac_cv_have_decl_feof_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_feof_unlocked" = xyes
then :
ac_have_decl=1
else $as_nop
ac_have_decl=0
fi
printf "%s\n" "#define HAVE_DECL_FEOF_UNLOCKED $ac_have_decl" >>confdefs.h
ac_fn_check_decl "$LINENO" "ferror_unlocked" "ac_cv_have_decl_ferror_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_ferror_unlocked" = xyes
then :
ac_have_decl=1
else $as_nop
ac_have_decl=0
fi
printf "%s\n" "#define HAVE_DECL_FERROR_UNLOCKED $ac_have_decl" >>confdefs.h
ac_fn_check_decl "$LINENO" "fflush_unlocked" "ac_cv_have_decl_fflush_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_fflush_unlocked" = xyes
then :
ac_have_decl=1
else $as_nop
ac_have_decl=0
fi
printf "%s\n" "#define HAVE_DECL_FFLUSH_UNLOCKED $ac_have_decl" >>confdefs.h
ac_fn_check_decl "$LINENO" "fgets_unlocked" "ac_cv_have_decl_fgets_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_fgets_unlocked" = xyes
then :
ac_have_decl=1
else $as_nop
ac_have_decl=0
fi
printf "%s\n" "#define HAVE_DECL_FGETS_UNLOCKED $ac_have_decl" >>confdefs.h
ac_fn_check_decl "$LINENO" "fputc_unlocked" "ac_cv_have_decl_fputc_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_fputc_unlocked" = xyes
then :
ac_have_decl=1
else $as_nop
ac_have_decl=0
fi
printf "%s\n" "#define HAVE_DECL_FPUTC_UNLOCKED $ac_have_decl" >>confdefs.h
ac_fn_check_decl "$LINENO" "fputs_unlocked" "ac_cv_have_decl_fputs_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_fputs_unlocked" = xyes
then :
ac_have_decl=1
else $as_nop
ac_have_decl=0
fi
printf "%s\n" "#define HAVE_DECL_FPUTS_UNLOCKED $ac_have_decl" >>confdefs.h
ac_fn_check_decl "$LINENO" "fread_unlocked" "ac_cv_have_decl_fread_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_fread_unlocked" = xyes
then :
ac_have_decl=1
else $as_nop
ac_have_decl=0
fi
printf "%s\n" "#define HAVE_DECL_FREAD_UNLOCKED $ac_have_decl" >>confdefs.h
ac_fn_check_decl "$LINENO" "fwrite_unlocked" "ac_cv_have_decl_fwrite_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_fwrite_unlocked" = xyes
then :
ac_have_decl=1
else $as_nop
ac_have_decl=0
fi
printf "%s\n" "#define HAVE_DECL_FWRITE_UNLOCKED $ac_have_decl" >>confdefs.h
ac_fn_check_decl "$LINENO" "getc_unlocked" "ac_cv_have_decl_getc_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_getc_unlocked" = xyes
then :
ac_have_decl=1
else $as_nop
ac_have_decl=0
fi
printf "%s\n" "#define HAVE_DECL_GETC_UNLOCKED $ac_have_decl" >>confdefs.h
ac_fn_check_decl "$LINENO" "getchar_unlocked" "ac_cv_have_decl_getchar_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_getchar_unlocked" = xyes
then :
ac_have_decl=1
else $as_nop
ac_have_decl=0
fi
printf "%s\n" "#define HAVE_DECL_GETCHAR_UNLOCKED $ac_have_decl" >>confdefs.h
ac_fn_check_decl "$LINENO" "putc_unlocked" "ac_cv_have_decl_putc_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_putc_unlocked" = xyes
then :
ac_have_decl=1
else $as_nop
ac_have_decl=0
fi
printf "%s\n" "#define HAVE_DECL_PUTC_UNLOCKED $ac_have_decl" >>confdefs.h
ac_fn_check_decl "$LINENO" "putchar_unlocked" "ac_cv_have_decl_putchar_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_putchar_unlocked" = xyes
then :
ac_have_decl=1
else $as_nop
ac_have_decl=0
fi
printf "%s\n" "#define HAVE_DECL_PUTCHAR_UNLOCKED $ac_have_decl" >>confdefs.h
if test "$ac_cv_func_putenv" = "yes"; then
@@ -22006,7 +22240,7 @@ freebsd*|midnightbsd*) LOCAL_CFLAGS='-DHEREDOC_PIPESIZE=4096' ;;
*qnx[67]*) LOCAL_LIBS="-lncurses" ;;
*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
powerux*) LOCAL_LIBS="-lgen" ;;
cygwin*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
cygwin*|msys*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO -D_POSIX_SOURCE -D_ALL_SOURCE -DRECYCLES_PIDS" ;;
*openstep*) LOCAL_CFLAGS="-D__APPLE_CC__" ;;
esac
+11 -6
View File
@@ -1,11 +1,11 @@
dnl
dnl Configure script for bash-5.3
dnl
dnl report bugs to chet@po.cwru.edu
dnl report bugs to chet.ramey@case.edu
dnl
dnl Process this file with autoconf to produce a configure script.
# Copyright (C) 1987-2023 Free Software Foundation, Inc.
# Copyright (C) 1987-2024 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
@@ -21,7 +21,7 @@ dnl Process this file with autoconf to produce a configure script.
# 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.059])dnl
AC_REVISION([for Bash 5.3, version 5.061])dnl
define(bashvers, 5.3)
define(relstatus, devel)
@@ -76,7 +76,7 @@ m68k-sysv) opt_bash_malloc=no ;; # fixes file descriptor leak in closedir
# These need additional investigation
sparc-linux*) opt_bash_malloc=no ;; # sparc running linux; requires ELF
*-aix*) opt_bash_malloc=no ;; # AIX machines
*-cygwin*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment
*-cygwin*|msys*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment
# These lack a working sbrk(2)
aarch64-freebsd*) opt_bash_malloc=no ;;
riscv*-freebsd*) opt_bash_malloc=no ;;
@@ -464,6 +464,9 @@ if test "x$cross_compiling" = "xyes"; then
*-cygwin*)
cross_cache=${srcdir}/cross-build/cygwin32.cache
;;
*-msys*)
cross_cache=${srcdir}/cross-build/msys32.cache
;;
*-mingw*)
cross_cache=${srcdir}/cross-build/cygwin32.cache
;;
@@ -605,7 +608,7 @@ if test $opt_readline = yes; then
# section for OS versions that don't allow unresolved symbols
# to be compiled into dynamic libraries.
case "$host_os" in
cygwin*) TILDE_LIB= ;;
cygwin*|msys*) TILDE_LIB= ;;
esac
else
RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
@@ -717,6 +720,7 @@ m4_include([m4/stat-time.m4])
m4_include([m4/timespec.m4])
m4_include([m4/strtoimax.m4])
m4_include([m4/unlocked-io.m4])
dnl include files for gettext
@@ -1092,6 +1096,7 @@ BASH_FUNC_SNPRINTF
BASH_FUNC_VSNPRINTF
BASH_FUNC_STRTOIMAX
BASH_FUNC_UNLOCKED_IO
dnl If putenv or unsetenv is not present, set the right define so the
dnl prototype and declaration in lib/sh/getenv.c will be standard-conformant
@@ -1202,7 +1207,7 @@ freebsd*|midnightbsd*) LOCAL_CFLAGS='-DHEREDOC_PIPESIZE=4096' ;;
*qnx[[67]]*) LOCAL_LIBS="-lncurses" ;;
*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
powerux*) LOCAL_LIBS="-lgen" ;;
cygwin*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
cygwin*|msys*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO -D_POSIX_SOURCE -D_ALL_SOURCE -DRECYCLES_PIDS" ;;
*openstep*) LOCAL_CFLAGS="-D__APPLE_CC__" ;;
esac
+251
View File
@@ -0,0 +1,251 @@
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems. If it contains results you don't
# want to keep, you may remove or edit it.
#
# config.status only pays attention to the cache file if you give it
# the --recheck option to rerun configure.
#
# `ac_cv_env_foo' variables (set or unset) will be overriden when
# loading this file, other *unset* `ac_cv_foo' will be assigned the
# following values.
ac_cv_build=${ac_cv_build='i686-pc-msys'}
ac_cv_build_alias=${ac_cv_build_alias='i686-pc-msys'}
ac_cv_c_bigendian=${ac_cv_c_bigendian='no'}
ac_cv_c_char_unsigned=${ac_cv_c_char_unsigned='no'}
ac_cv_c_compiler_gnu=${ac_cv_c_compiler_gnu='yes'}
ac_cv_c_const=${ac_cv_c_const='yes'}
ac_cv_c_inline=${ac_cv_c_inline='inline'}
ac_cv_c_long_double=${ac_cv_c_long_double='yes'}
ac_cv_c_stringize=${ac_cv_c_stringize='yes'}
ac_cv_decl_sys_siglist=${ac_cv_decl_sys_siglist='no'}
ac_cv_exeext=${ac_cv_exeext='.exe'}
ac_cv_func___setostype=${ac_cv_func___setostype='no'}
ac_cv_func__doprnt=${ac_cv_func__doprnt='no'}
ac_cv_func_alloca_works=${ac_cv_func_alloca_works='yes'}
ac_cv_func_asprintf=${ac_cv_func_asprintf='no'}
ac_cv_func_bcopy=${ac_cv_func_bcopy='yes'}
ac_cv_func_bindtextdomain=${ac_cv_func_bindtextdomain='no'}
ac_cv_func_bzero=${ac_cv_func_bzero='yes'}
ac_cv_func_confstr=${ac_cv_func_confstr='no'}
ac_cv_func_dlclose=${ac_cv_func_dlclose='yes'}
ac_cv_func_dlopen=${ac_cv_func_dlopen='yes'}
ac_cv_func_dlsym=${ac_cv_func_dlsym='yes'}
ac_cv_func_dup2=${ac_cv_func_dup2='yes'}
ac_cv_func_fnmatch=${ac_cv_func_fnmatch='no'}
ac_cv_func_getaddrinfo=${ac_cv_func_getaddrinfo='no'}
ac_cv_func_getcwd=${ac_cv_func_getcwd='yes'}
ac_cv_func_getdtablesize=${ac_cv_func_getdtablesize='yes'}
ac_cv_func_getgroups=${ac_cv_func_getgroups='yes'}
ac_cv_func_gethostbyname=${ac_cv_func_gethostbyname='yes'}
ac_cv_func_gethostname=${ac_cv_func_gethostname='yes'}
ac_cv_func_getpagesize=${ac_cv_func_getpagesize='yes'}
ac_cv_func_getpeername=${ac_cv_func_getpeername='yes'}
ac_cv_func_getpgrp_void=${ac_cv_func_getpgrp_void='yes'}
ac_cv_func_getrlimit=${ac_cv_func_getrlimit='yes'}
ac_cv_func_getrusage=${ac_cv_func_getrusage='yes'}
ac_cv_func_getservbyname=${ac_cv_func_getservbyname='yes'}
ac_cv_func_gettext=${ac_cv_func_gettext='no'}
ac_cv_func_gettimeofday=${ac_cv_func_gettimeofday='yes'}
ac_cv_func_inet_aton=${ac_cv_func_inet_aton='yes'}
ac_cv_func_isascii=${ac_cv_func_isascii='yes'}
ac_cv_func_isblank=${ac_cv_func_isblank='no'}
ac_cv_func_isgraph=${ac_cv_func_isgraph='yes'}
ac_cv_func_isprint=${ac_cv_func_isprint='yes'}
ac_cv_func_isspace=${ac_cv_func_isspace='yes'}
ac_cv_func_isxdigit=${ac_cv_func_isxdigit='yes'}
ac_cv_func_killpg=${ac_cv_func_killpg='yes'}
ac_cv_func_lstat=${ac_cv_func_lstat='yes'}
ac_cv_func_memmove=${ac_cv_func_memmove='yes'}
ac_cv_func_mkfifo=${ac_cv_func_mkfifo='yes'}
ac_cv_func_pathconf=${ac_cv_func_pathconf='yes'}
ac_cv_func_putenv=${ac_cv_func_putenv='yes'}
ac_cv_func_readlink=${ac_cv_func_readlink='yes'}
ac_cv_func_rename=${ac_cv_func_rename='yes'}
ac_cv_func_sbrk=${ac_cv_func_sbrk='yes'}
ac_cv_func_select=${ac_cv_func_select='yes'}
ac_cv_func_setdtablesize=${ac_cv_func_setdtablesize='yes'}
ac_cv_func_setenv=${ac_cv_func_setenv='yes'}
ac_cv_func_setlinebuf=${ac_cv_func_setlinebuf='no'}
ac_cv_func_setlocale=${ac_cv_func_setlocale='yes'}
ac_cv_func_setvbuf=${ac_cv_func_setvbuf='yes'}
ac_cv_func_setvbuf_reversed=${ac_cv_func_setvbuf_reversed='no'}
ac_cv_func_siginterrupt=${ac_cv_func_siginterrupt='no'}
ac_cv_func_snprintf=${ac_cv_func_snprintf='yes'}
ac_cv_func_strcasecmp=${ac_cv_func_strcasecmp='yes'}
ac_cv_func_strchr=${ac_cv_func_strchr='yes'}
ac_cv_func_strcoll_works=${ac_cv_func_strcoll_works='yes'}
ac_cv_func_strerror=${ac_cv_func_strerror='yes'}
ac_cv_func_strpbrk=${ac_cv_func_strpbrk='yes'}
ac_cv_func_strtod=${ac_cv_func_strtod='yes'}
ac_cv_func_strtoimax=${ac_cv_func_strtoimax='no'}
ac_cv_func_strtol=${ac_cv_func_strtol='yes'}
ac_cv_func_strtoll=${ac_cv_func_strtoll='no'}
ac_cv_func_strtoul=${ac_cv_func_strtoul='yes'}
ac_cv_func_strtoull=${ac_cv_func_strtoull='no'}
ac_cv_func_strtoumax=${ac_cv_func_strtoumax='no'}
ac_cv_func_sysconf=${ac_cv_func_sysconf='yes'}
ac_cv_func_tcgetattr=${ac_cv_func_tcgetattr='yes'}
ac_cv_func_tcgetpgrp=${ac_cv_func_tcgetpgrp='yes'}
ac_cv_func_textdomain=${ac_cv_func_textdomain='no'}
ac_cv_func_times=${ac_cv_func_times='yes'}
ac_cv_func_ttyname=${ac_cv_func_ttyname='yes'}
ac_cv_func_tzset=${ac_cv_func_tzset='yes'}
ac_cv_func_ulimit=${ac_cv_func_ulimit='no'}
ac_cv_func_uname=${ac_cv_func_uname='yes'}
ac_cv_func_vasprintf=${ac_cv_func_vasprintf='no'}
ac_cv_func_vprintf=${ac_cv_func_vprintf='yes'}
ac_cv_func_vsnprintf=${ac_cv_func_vsnprintf='yes'}
ac_cv_func_wait3=${ac_cv_func_wait3='yes'}
ac_cv_func_waitpid=${ac_cv_func_waitpid='yes'}
ac_cv_have_decl_confstr=${ac_cv_have_decl_confstr='no'}
ac_cv_have_decl_printf=${ac_cv_have_decl_printf='yes'}
ac_cv_have_decl_sbrk=${ac_cv_have_decl_sbrk='yes'}
ac_cv_have_decl_strsignal=${ac_cv_have_decl_strsignal='yes'}
ac_cv_have_decl_strtold=${ac_cv_have_decl_strtold='no'}
ac_cv_header_arpa_inet_h=${ac_cv_header_arpa_inet_h='yes'}
ac_cv_header_dirent_dirent_h=${ac_cv_header_dirent_dirent_h='yes'}
ac_cv_header_dlfcn_h=${ac_cv_header_dlfcn_h='yes'}
ac_cv_header_grp_h=${ac_cv_header_grp_h='yes'}
ac_cv_header_inttypes_h=${ac_cv_header_inttypes_h='no'}
ac_cv_header_libintl_h=${ac_cv_header_libintl_h='yes'}
ac_cv_header_limits_h=${ac_cv_header_limits_h='yes'}
ac_cv_header_locale_h=${ac_cv_header_locale_h='yes'}
ac_cv_header_memory_h=${ac_cv_header_memory_h='yes'}
ac_cv_header_minix_config_h=${ac_cv_header_minix_config_h='no'}
ac_cv_header_netdb_h=${ac_cv_header_netdb_h='yes'}
ac_cv_header_netinet_in_h=${ac_cv_header_netinet_in_h='yes'}
ac_cv_header_stat_broken=${ac_cv_header_stat_broken='no'}
ac_cv_header_stdarg_h=${ac_cv_header_stdarg_h='yes'}
ac_cv_header_stdc=${ac_cv_header_stdc='yes'}
ac_cv_header_stddef_h=${ac_cv_header_stddef_h='yes'}
ac_cv_header_stdint_h=${ac_cv_header_stdint_h='no'}
ac_cv_header_stdlib_h=${ac_cv_header_stdlib_h='yes'}
ac_cv_header_string_h=${ac_cv_header_string_h='yes'}
ac_cv_header_strings_h=${ac_cv_header_strings_h='yes'}
ac_cv_header_sys_file_h=${ac_cv_header_sys_file_h='yes'}
ac_cv_header_sys_param_h=${ac_cv_header_sys_param_h='yes'}
ac_cv_header_sys_pte_h=${ac_cv_header_sys_pte_h='no'}
ac_cv_header_sys_ptem_h=${ac_cv_header_sys_ptem_h='no'}
ac_cv_header_sys_resource_h=${ac_cv_header_sys_resource_h='yes'}
ac_cv_header_sys_select_h=${ac_cv_header_sys_select_h='yes'}
ac_cv_header_sys_socket_h=${ac_cv_header_sys_socket_h='yes'}
ac_cv_header_sys_stat_h=${ac_cv_header_sys_stat_h='yes'}
ac_cv_header_sys_stream_h=${ac_cv_header_sys_stream_h='no'}
ac_cv_header_sys_time_h=${ac_cv_header_sys_time_h='yes'}
ac_cv_header_sys_times_h=${ac_cv_header_sys_times_h='yes'}
ac_cv_header_sys_types_h=${ac_cv_header_sys_types_h='yes'}
ac_cv_header_sys_wait_h=${ac_cv_header_sys_wait_h='yes'}
ac_cv_header_termcap_h=${ac_cv_header_termcap_h='yes'}
ac_cv_header_termio_h=${ac_cv_header_termio_h='yes'}
ac_cv_header_termios_h=${ac_cv_header_termios_h='yes'}
ac_cv_header_time=${ac_cv_header_time='yes'}
ac_cv_header_unistd_h=${ac_cv_header_unistd_h='yes'}
ac_cv_header_varargs_h=${ac_cv_header_varargs_h='yes'}
ac_cv_host=${ac_cv_host='i686-pc-msys'}
ac_cv_host_alias=${ac_cv_host_alias='i686-pc-msys'}
ac_cv_lib_dir_opendir=${ac_cv_lib_dir_opendir='no'}
ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen='no'}
ac_cv_lib_intl_bindtextdomain=${ac_cv_lib_intl_bindtextdomain='yes'}
ac_cv_lib_termcap_tgetent=${ac_cv_lib_termcap_tgetent='yes'}
ac_cv_member_struct_stat_st_blocks=${ac_cv_member_struct_stat_st_blocks='yes'}
ac_cv_member_struct_termio_c_line=${ac_cv_member_struct_termio_c_line='yes'}
ac_cv_member_struct_termios_c_line=${ac_cv_member_struct_termios_c_line='yes'}
ac_cv_objext=${ac_cv_objext='o'}
ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'}
ac_cv_prog_AR=${ac_cv_prog_AR='ar'}
ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -E'}
ac_cv_prog_YACC=${ac_cv_prog_YACC='bison -y'}
ac_cv_prog_ac_ct_CC=${ac_cv_prog_ac_ct_CC='gcc'}
ac_cv_prog_ac_ct_RANLIB=${ac_cv_prog_ac_ct_RANLIB='ranlib'}
ac_cv_prog_cc_g=${ac_cv_prog_cc_g='yes'}
ac_cv_prog_cc_stdc=${ac_cv_prog_cc_stdc=''}
ac_cv_prog_gcc_traditional=${ac_cv_prog_gcc_traditional='no'}
ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set='yes'}
ac_cv_sizeof_char=${ac_cv_sizeof_char='1'}
ac_cv_sizeof_char_p=${ac_cv_sizeof_char_p='4'}
ac_cv_sizeof_double=${ac_cv_sizeof_double='8'}
ac_cv_sizeof_int=${ac_cv_sizeof_int='4'}
ac_cv_sizeof_long=${ac_cv_sizeof_long='4'}
ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long='8'}
ac_cv_sizeof_short=${ac_cv_sizeof_short='2'}
ac_cv_sys_file_offset_bits=${ac_cv_sys_file_offset_bits='no'}
ac_cv_sys_interpreter=${ac_cv_sys_interpreter='yes'}
ac_cv_sys_large_files=${ac_cv_sys_large_files='no'}
ac_cv_sys_largefile_CC=${ac_cv_sys_largefile_CC='no'}
ac_cv_sys_posix_termios=${ac_cv_sys_posix_termios='yes'}
ac_cv_sys_tiocgwinsz_in_termios_h=${ac_cv_sys_tiocgwinsz_in_termios_h='yes'}
ac_cv_type_bits16_t=${ac_cv_type_bits16_t='no'}
ac_cv_type_bits32_t=${ac_cv_type_bits32_t='no'}
ac_cv_type_bits64_t=${ac_cv_type_bits64_t='no'}
ac_cv_type_char=${ac_cv_type_char='yes'}
ac_cv_type_char_p=${ac_cv_type_char_p='yes'}
ac_cv_type_double=${ac_cv_type_double='yes'}
ac_cv_type_getgroups=${ac_cv_type_getgroups='gid_t'}
ac_cv_type_int=${ac_cv_type_int='yes'}
ac_cv_type_long=${ac_cv_type_long='yes'}
ac_cv_type_long_long=${ac_cv_type_long_long='yes'}
ac_cv_type_mode_t=${ac_cv_type_mode_t='yes'}
ac_cv_type_off_t=${ac_cv_type_off_t='yes'}
ac_cv_type_pid_t=${ac_cv_type_pid_t='yes'}
ac_cv_type_ptrdiff_t=${ac_cv_type_ptrdiff_t='yes'}
ac_cv_type_short=${ac_cv_type_short='yes'}
ac_cv_type_signal=${ac_cv_type_signal='void'}
ac_cv_type_size_t=${ac_cv_type_size_t='yes'}
ac_cv_type_ssize_t=${ac_cv_type_ssize_t='yes'}
ac_cv_type_time_t=${ac_cv_type_time_t='yes'}
ac_cv_type_u_bits16_t=${ac_cv_type_u_bits16_t='no'}
ac_cv_type_u_bits32_t=${ac_cv_type_u_bits32_t='no'}
ac_cv_type_u_int=${ac_cv_type_u_int='yes'}
ac_cv_type_u_long=${ac_cv_type_u_long='yes'}
ac_cv_type_uid_t=${ac_cv_type_uid_t='yes'}
ac_cv_working_alloca_h=${ac_cv_working_alloca_h='no'}
bash_cv_decl_strtoimax=${bash_cv_decl_strtoimax='no'}
bash_cv_decl_strtol=${bash_cv_decl_strtol='yes'}
bash_cv_decl_strtoll=${bash_cv_decl_strtoll='no'}
bash_cv_decl_strtoul=${bash_cv_decl_strtoul='yes'}
bash_cv_decl_strtoull=${bash_cv_decl_strtoull='no'}
bash_cv_decl_strtoumax=${bash_cv_decl_strtoumax='no'}
bash_cv_decl_under_sys_siglist=${bash_cv_decl_under_sys_siglist='no'}
bash_cv_dev_fd=${bash_cv_dev_fd='absent'}
bash_cv_dev_stdin=${bash_cv_dev_stdin='absent'}
bash_cv_dirent_has_d_fileno=${bash_cv_dirent_has_d_fileno='no'}
bash_cv_dirent_has_dino=${bash_cv_dirent_has_dino='yes'}
bash_cv_dup2_broken=${bash_cv_dup2_broken='no'}
bash_cv_fionread_in_ioctl=${bash_cv_fionread_in_ioctl='no'}
bash_cv_func_sigsetjmp=${bash_cv_func_sigsetjmp='present'}
bash_cv_func_strcoll_broken=${bash_cv_func_strcoll_broken='no'}
bash_cv_getenv_redef=${bash_cv_getenv_redef='yes'}
bash_cv_getpw_declared=${bash_cv_getpw_declared='yes'}
bash_cv_have_strsignal=${bash_cv_have_strsignal='yes'}
bash_cv_job_control_missing=${bash_cv_job_control_missing='present'}
bash_cv_mail_dir=${bash_cv_mail_dir='unknown'}
bash_cv_must_reinstall_sighandlers=${bash_cv_must_reinstall_sighandlers='no'}
bash_cv_opendir_not_robust=${bash_cv_opendir_not_robust='no'}
bash_cv_pgrp_pipe=${bash_cv_pgrp_pipe='no'}
bash_cv_printf_a_format=${bash_cv_printf_a_format='no'}
bash_cv_signal_vintage=${bash_cv_signal_vintage='posix'}
bash_cv_speed_t_in_sys_types=${bash_cv_speed_t_in_sys_types='no'}
bash_cv_struct_timeval=${bash_cv_struct_timeval='yes'}
bash_cv_struct_winsize_header=${bash_cv_struct_winsize_header='termios_h'}
bash_cv_sys_errlist=${bash_cv_sys_errlist='no'}
bash_cv_sys_named_pipes=${bash_cv_sys_named_pipes='present'}
bash_cv_sys_siglist=${bash_cv_sys_siglist='no'}
bash_cv_termcap_lib=${bash_cv_termcap_lib='libtermcap'}
bash_cv_tiocstat_in_ioctl=${bash_cv_tiocstat_in_ioctl='no'}
bash_cv_type_clock_t=${bash_cv_type_clock_t='yes'}
bash_cv_type_intmax_t=${bash_cv_type_intmax_t='no'}
bash_cv_type_long_long=${bash_cv_type_long_long='long long'}
bash_cv_type_quad_t=${bash_cv_type_quad_t='no'}
bash_cv_type_rlimit=${bash_cv_type_rlimit='rlim_t'}
bash_cv_type_sigset_t=${bash_cv_type_sigset_t='yes'}
bash_cv_type_socklen_t=${bash_cv_type_socklen_t='no'}
bash_cv_type_uintmax_t=${bash_cv_type_uintmax_t='no'}
bash_cv_type_unsigned_long_long=${bash_cv_type_unsigned_long_long='unsigned long long'}
bash_cv_ulimit_maxfds=${bash_cv_ulimit_maxfds='no'}
bash_cv_under_sys_siglist=${bash_cv_under_sys_siglist='no'}
bash_cv_unusable_rtsigs=${bash_cv_unusable_rtsigs='no'}
bash_cv_void_sighandler=${bash_cv_void_sighandler='yes'}
+6 -1
View File
@@ -826,7 +826,12 @@ absolute_pathname (const char *string)
int
absolute_program (const char *string)
{
#ifndef __MSYS__
return ((char *)mbschr (string, '/') != (char *)NULL);
#else
return ((char *)mbschr (string, '/') != (char *)NULL ||
(char *)mbschr (string, '\\') != (char *)NULL)
#endif
}
/* **************************************************************** */
@@ -850,7 +855,7 @@ make_absolute (const char *string, const char *dot_path)
char pathbuf[PATH_MAX + 1];
/* WAS cygwin_conv_to_full_posix_path (string, pathbuf); */
cygwin_conv_path (CCP_WIN_A_TO_POSIX, string, pathbuf, PATH_MAX);
cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE, string, pathbuf, PATH_MAX);
result = savestring (pathbuf);
}
#else
+2 -1
View File
@@ -1,6 +1,6 @@
/* general.h -- defines that everybody likes to use. */
/* 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.
@@ -43,6 +43,7 @@
# include <limits.h>
#endif
#include "unlocked-io.h"
#include "xmalloc.h"
/* Hardly used anymore */
+138
View File
@@ -0,0 +1,138 @@
/* Prefer faster, non-thread-safe stdio functions if available.
Copyright (C) 2001-2004, 2009-2024 Free Software Foundation, Inc.
This program 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.
This program 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 this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Jim Meyering. */
/* Adapted from gnulib:lib/unlocked-io.h */
#ifndef UNLOCKED_IO_H
# define UNLOCKED_IO_H 1
/* These are wrappers for functions/macros from the GNU C library, and
from other C libraries supporting POSIX's optional thread-safe functions.
The standard I/O functions are thread-safe. These *_unlocked ones are
more efficient but not thread-safe. That they're not thread-safe is
fine since all of the applications in this package are single threaded.
Also, some code that is shared with the GNU C library may invoke
the *_unlocked functions directly. On hosts that lack those
functions, invoke the non-thread-safe versions instead. */
# include <stdio.h>
# if HAVE_DECL_CLEARERR_UNLOCKED || defined clearerr_unlocked
# undef clearerr
# define clearerr(x) clearerr_unlocked (x)
# else
# define clearerr_unlocked(x) clearerr (x)
# endif
# if HAVE_DECL_FEOF_UNLOCKED || defined feof_unlocked
# undef feof
# define feof(x) feof_unlocked (x)
# else
# define feof_unlocked(x) feof (x)
# endif
# if HAVE_DECL_FERROR_UNLOCKED || defined ferror_unlocked
# undef ferror
# define ferror(x) ferror_unlocked (x)
# else
# define ferror_unlocked(x) ferror (x)
# endif
# if HAVE_DECL_FFLUSH_UNLOCKED || defined fflush_unlocked
# undef fflush
# define fflush(x) fflush_unlocked (x)
# else
# define fflush_unlocked(x) fflush (x)
# endif
# if HAVE_DECL_FGETS_UNLOCKED || defined fgets_unlocked
# undef fgets
# define fgets(x,y,z) fgets_unlocked (x,y,z)
# else
# define fgets_unlocked(x,y,z) fgets (x,y,z)
# endif
# if HAVE_DECL_FPUTC_UNLOCKED || defined fputc_unlocked
# undef fputc
# define fputc(x,y) fputc_unlocked (x,y)
# else
# define fputc_unlocked(x,y) fputc (x,y)
# endif
# if HAVE_DECL_FPUTS_UNLOCKED || defined fputs_unlocked
# undef fputs
# define fputs(x,y) fputs_unlocked (x,y)
# else
# define fputs_unlocked(x,y) fputs (x,y)
# endif
# if HAVE_DECL_FREAD_UNLOCKED || defined fread_unlocked
# undef fread
# define fread(w,x,y,z) fread_unlocked (w,x,y,z)
# else
# define fread_unlocked(w,x,y,z) fread (w,x,y,z)
# endif
# if HAVE_DECL_FWRITE_UNLOCKED || defined fwrite_unlocked
# undef fwrite
# define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z)
# else
# define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z)
# endif
# if HAVE_DECL_GETC_UNLOCKED || defined getc_unlocked
# undef getc
# define getc(x) getc_unlocked (x)
# else
# define getc_unlocked(x) getc (x)
# endif
# if HAVE_DECL_GETCHAR_UNLOCKED || defined getchar_unlocked
# undef getchar
# define getchar() getchar_unlocked ()
# else
# define getchar_unlocked() getchar ()
# endif
# if HAVE_DECL_PUTC_UNLOCKED || defined putc_unlocked
# undef putc
# define putc(x,y) putc_unlocked (x,y)
# else
# define putc_unlocked(x,y) putc (x,y)
# endif
# if HAVE_DECL_PUTCHAR_UNLOCKED || defined putchar_unlocked
# undef putchar
# define putchar(x) putchar_unlocked (x)
# else
# define putchar_unlocked(x) putchar (x)
# endif
# undef flockfile
# define flockfile(x) ((void) 0)
# undef ftrylockfile
# define ftrylockfile(x) 0
# undef funlockfile
# define funlockfile(x) ((void) 0)
#endif /* UNLOCKED_IO_H */
+1 -1
View File
@@ -322,7 +322,7 @@ static PTR_T internal_valloc (size_t, const char *, int, int);
static PTR_T internal_remap (PTR_T, size_t, int, int);
#if defined (botch)
extern void botch ();
extern void botch (const char *, ...);
#else
static void botch (const char *, const char *, int);
#endif
+1 -1
View File
@@ -60,7 +60,7 @@ typedef struct mr_table {
extern mr_table_t *mr_table_entry (PTR_T);
extern void mregister_alloc (const char *, PTR_T, size_t, const char *, int);
extern void mregister_free (PTR_T, int, const char *, int);
extern void mregister_describe_mem ();
extern void mregister_describe_mem (PTR_T, FILE *); /* needs stdio.h */
extern void mregister_dump_table (void);
extern void mregister_table_init (void);
+5 -10
View File
@@ -77,6 +77,10 @@ sh_physpath (char *path, int flags)
ssize_t r;
size_t linklen;
#ifdef __CYGWIN__
return realpath (path, NULL);
#endif
linklen = strlen (path);
#if 0
@@ -100,13 +104,8 @@ sh_physpath (char *path, int flags)
/* This always gets an absolute pathname. */
/* POSIX.2 says to leave a leading `//' alone. On cygwin, we skip over any
leading `x:' (dos drive name). */
#if defined (__CYGWIN__)
qbase = (ISALPHA((unsigned char)workpath[0]) && workpath[1] == ':') ? workpath + 3 : workpath + 1;
#else
/* POSIX.2 says to leave a leading `//' alone. */
qbase = workpath + 1;
#endif
double_slash_path = DOUBLE_SLASH (workpath);
qbase += double_slash_path;
@@ -212,11 +211,7 @@ error:
{
q = result;
/* Duplicating some code here... */
#if defined (__CYGWIN__)
qbase = (ISALPHA((unsigned char)workpath[0]) && workpath[1] == ':') ? workpath + 3 : workpath + 1;
#else
qbase = workpath + 1;
#endif
double_slash_path = DOUBLE_SLASH (workpath);
qbase += double_slash_path;
+1 -1
View File
@@ -23,7 +23,7 @@
#include <bashansi.h>
size_t
strlcpy(char *dest, const const char *src, size_t size)
strlcpy(char *dest, const char *src, size_t size)
{
size_t ret;
+31
View File
@@ -0,0 +1,31 @@
# unlocked-io.m4 serial 16
# Copyright (C) 1998-2006, 2009-2024 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
dnl From Jim Meyering.
dnl
dnl Adapted from gnulib:m4/unlocked-io.m4
AC_DEFUN([BASH_FUNC_UNLOCKED_IO],
[
dnl Persuade glibc and Solaris <stdio.h> to declare
dnl fgets_unlocked(), fputs_unlocked() etc.
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_CHECK_DECLS_ONCE([clearerr_unlocked])
AC_CHECK_DECLS_ONCE([feof_unlocked])
AC_CHECK_DECLS_ONCE([ferror_unlocked])
AC_CHECK_DECLS_ONCE([fflush_unlocked])
AC_CHECK_DECLS_ONCE([fgets_unlocked])
AC_CHECK_DECLS_ONCE([fputc_unlocked])
AC_CHECK_DECLS_ONCE([fputs_unlocked])
AC_CHECK_DECLS_ONCE([fread_unlocked])
AC_CHECK_DECLS_ONCE([fwrite_unlocked])
AC_CHECK_DECLS_ONCE([getc_unlocked])
AC_CHECK_DECLS_ONCE([getchar_unlocked])
AC_CHECK_DECLS_ONCE([putc_unlocked])
AC_CHECK_DECLS_ONCE([putchar_unlocked])
])
+3 -3
View File
@@ -29,13 +29,13 @@
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#else
extern int optind;
extern char *optarg;
#endif
#include "syntax.h"
extern int optind;
extern char *optarg;
#ifndef errno
extern int errno;
#endif
+12
View File
@@ -1553,7 +1553,14 @@ yy_input_name (void)
static int
yy_getc (void)
{
#ifndef __MSYS__
return (*(bash_input.getter)) ();
#else
int c;
/* skip \r entirely on MSYS */
while ((c = (*(bash_input.getter)) ()) == '\r');
return c;
#endif
}
/* Call this to unget C. That is, to make C the next character
@@ -2521,6 +2528,11 @@ shell_getc (int remove_quoted_newline)
else
RESIZE_MALLOCED_BUFFER (shell_input_line, i, 2, shell_input_line_size, 256);
#ifdef __MSYS__
if (c == '\r')
continue;
#endif
if (c == EOF)
{
if (interactive && bash_input.type == st_stream)
BIN
View File
Binary file not shown.
+491 -409
View File
File diff suppressed because it is too large Load Diff
+7 -1
View File
@@ -263,7 +263,13 @@ strip_trailing (char *string, int len, int newlines_only)
{
if ((newlines_only && string[len] == '\n') ||
(!newlines_only && whitespace (string[len])))
len--;
{
len--;
#ifdef __MSYS__
if (newlines_only && string[len + 1] == '\n' && string[len] == '\r')
len--;
#endif
}
else
break;
}
+37
View File
@@ -43,6 +43,10 @@
#include "posixstat.h"
#include "bashintl.h"
#ifdef __CYGWIN__
# define NEED_SH_SETLINEBUF_DECL
#endif
#include "shell.h"
#include "parser.h"
#include "redir.h"
@@ -6744,6 +6748,17 @@ read_comsub (int fd, int quoted, int flags, int *rflag)
/* If the newline was quoted, remove the quoting char. */
if (istring[istring_index - 1] == CTLESC)
--istring_index;
#ifdef __MSYS__
if (istring_index > 0 && istring[istring_index - 1] == '\r')
{
--istring_index;
/* If the carriage return was quoted, remove the quoting char. */
if (istring[istring_index - 1] == CTLESC)
--istring_index;
}
#endif
}
else
break;
@@ -7140,6 +7155,28 @@ command_substitute (char *string, int quoted, int flags)
goto error_exit;
}
#ifdef __CYGWIN__
/* Passing a pipe through std fds can cause hangs when talking to a
non-cygwin child. Move it. */
if (fildes[0] < 3)
{
int fd = fcntl (fildes[0], F_DUPFD, 3);
close (fildes[0]);
fildes[0] = fd;
}
if (fildes[1] < 3)
{
int fd = fcntl (fildes[1], F_DUPFD, 3);
close (fildes[1]);
fildes[1] = fd;
}
if (fildes[0] < 0 || fildes[1] < 0)
{
sys_error (_("cannot make pipe for command substitution"));
goto error_exit;
}
#endif /* __CYGWIN__ */
#if defined (JOB_CONTROL)
old_pipeline_pgrp = pipeline_pgrp;
/* Don't reset the pipeline pgrp if we're already a subshell in a pipeline or
+2 -3
View File
@@ -26,6 +26,8 @@
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
extern int optind;
extern char *optarg;
#endif
#include "bashansi.h"
@@ -41,9 +43,6 @@
#define LFLAG 0x0020
#define XFLAG 0x0040
extern int optind;
extern char *optarg;
extern char *dist_version;
extern int patch_level;
+5 -5
View File
@@ -57,7 +57,7 @@ else
aix*)
wl='-Wl,'
;;
mingw* | cygwin* | pw32* | os2* | cegcc*)
mingw* | cygwin* | msys* | pw32* | os2* | cegcc*)
;;
hpux9* | hpux10* | hpux11*)
wl='-Wl,'
@@ -149,7 +149,7 @@ hardcode_direct=no
hardcode_minus_L=no
case "$host_os" in
cygwin* | mingw* | pw32* | cegcc*)
cygwin* | msys* | mingw* | pw32* | cegcc*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
@@ -198,7 +198,7 @@ if test "$with_gnu_ld" = yes; then
ld_shlibs=no
fi
;;
cygwin* | mingw* | pw32* | cegcc*)
cygwin* | msys* | mingw* | pw32* | cegcc*)
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
@@ -348,7 +348,7 @@ else
;;
bsdi[45]*)
;;
cygwin* | mingw* | pw32* | cegcc*)
cygwin* | msys* | mingw* | pw32* | cegcc*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
@@ -533,7 +533,7 @@ case "$host_os" in
bsdi[45]*)
library_names_spec='$libname$shrext'
;;
cygwin* | mingw* | pw32* | cegcc*)
cygwin* | msys* | mingw* | pw32* | cegcc*)
shrext=.dll
library_names_spec='$libname.dll.a $libname.lib'
;;
+18
View File
@@ -494,6 +494,24 @@ cygwin*)
fi
;;
msys*)
SHOBJ_LD='$(CC)'
SHOBJ_LDFLAGS='-shared -Wl,--enable-auto-import -Wl,--enable-auto-image-base -Wl,--export-all -Wl,--out-implib=$(@).a'
SHLIB_LIBPREF='msys-'
SHLIB_LIBSUFF='dll'
SHLIB_LIBVERSION='$(SHLIB_DLLVERSION).$(SHLIB_LIBSUFF)'
SHLIB_LIBS='$(TERMCAP_LIB)'
SHLIB_DOT=
# For official cygwin releases, DLLVERSION will be defined in the
# environment of configure, and will be incremented any time the API
# changes in a non-backwards compatible manner. Otherwise, it is just
# SHLIB_MAJOR.
if [ -n "$DLLVERSION" ] ; then
SHLIB_DLLVERSION="$DLLVERSION"
fi
;;
mingw*)
SHOBJ_LD='$(CC)'
SHOBJ_LDFLAGS='-shared -Wl,--enable-auto-import -Wl,--enable-auto-image-base -Wl,--export-all -Wl,--out-implib=$(@).a'
+14
View File
@@ -2550,6 +2550,20 @@ set_if_not (const char *name, const char *value)
{
SHELL_VAR *v;
#ifdef __MSYS__
/* Remove trailing \r from value */
{
char *tpos;
if (value && *value)
{
tpos = strchr (value, '\0');
tpos--;
if (*tpos == '\r')
*tpos = '\0';
}
}
#endif
if (shell_variables == 0)
create_variable_tables ();