diff --git a/src/apps/bin/bash/Makefile.in b/src/apps/bin/bash/Makefile.in index a3dcd7eefd..377ce2a02f 100644 --- a/src/apps/bin/bash/Makefile.in +++ b/src/apps/bin/bash/Makefile.in @@ -138,6 +138,8 @@ GCC_LINT_FLAGS = -Wall -Wshadow -Wpointer-arith -Wcast-qual \ GCC_LINT_CFLAGS = $(BASE_CCFLAGS) $(CPPFLAGS) $(GCC_LINT_FLAGS) +BEOSSETVERSION = + # # Support libraries # @@ -464,7 +466,7 @@ CREATED_MAKEFILES = Makefile builtins/Makefile doc/Makefile \ # Keep GNU Make from exporting the entire environment for small machines. .NOEXPORT: -.made: $(Program) bashbug +.made: $(Program) $(BEOSSETVERSION) bashbug @echo "$(Program) last made for a $(Machine) running $(OS)" >.made $(Program): .build $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP) @@ -482,6 +484,11 @@ $(Program): .build $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP) @echo " ***********************************************************" @echo +beos-setversion: + setversion $(Program) -app `$(BUILD_DIR)/$(VERSPROG) -r` \ +`$(BUILD_DIR)/$(VERSPROG) -v | sed 's/./& /g'` $(PatchLevel) \ +-short "$(Version)" -long "$(Version) `echo -n -e '\302\251'` 2002 The Free Software Foundation" + bashbug: $(SUPPORT_SRC)bashbug.sh config.h Makefile $(VERSPROG) @sed -e "s%!MACHINE!%$(Machine)%" -e "s%!OS!%$(OS)%" \ -e "s%!CFLAGS!%$(CCFLAGS)%" -e "s%!CC!%$(CC)%" \ diff --git a/src/apps/bin/bash/README.BeOS b/src/apps/bin/bash/README.BeOS new file mode 100644 index 0000000000..daf7dfd358 --- /dev/null +++ b/src/apps/bin/bash/README.BeOS @@ -0,0 +1,18 @@ +Notes for the BeOS and Zeta port of bash. +This port merges the 2.03 version from Be and the 2.04 GeekGadgets patch. +Some stuff which isn't needed anymore have been removed. + +./configure --prefix=/ --disable-job-control --disable-net-redirections --enable-static-link + +Notes: +* added checks for libsocket and libbind (BONE) to configure.in +* mkfifo() exists, but no filesystem currently supports creating a fifo, so +process substitutions won't work. +* job control isn't implemented in BeOS, but configure tries to use it anyway. +* No /dev/tcp in BeOS. +* O_TRUNC seems fixed at least since R5.1 (BONE) +* select() does work since R5.1 +* old ports set SYS_PROFILE to /boot/beos/etc/profile, which is unneeded, since the kernel does symlink /boot/beos/etc to /etc at boot. +* about input.c:sync_buffered_stream: not casting to off_t makes the result on the heredoc test to be such as lseek fails but the fd is reset (seeked to 0L) so the script is read again, and again). Seems a bug in BeOS, but the operation was wrong anyway. +* sig.c: not sure this is still required. + diff --git a/src/apps/bin/bash/builtins/ulimit.def b/src/apps/bin/bash/builtins/ulimit.def index 3e147b4f26..3a056298ac 100644 --- a/src/apps/bin/bash/builtins/ulimit.def +++ b/src/apps/bin/bash/builtins/ulimit.def @@ -238,6 +238,9 @@ ulimit (cmd, newlim) int cmd; long newlim; { + if (cmd == 1) + return RLIM_INFINITY; /* A system without ulimit() and getrlimit() */ + /* probably dosen't support limits at all. */ errno = EINVAL; return -1; } diff --git a/src/apps/bin/bash/configure.in b/src/apps/bin/bash/configure.in index 5f06978872..cb9652ac3e 100644 --- a/src/apps/bin/bash/configure.in +++ b/src/apps/bin/bash/configure.in @@ -617,7 +617,11 @@ dnl check for GNU libintl if gettext/textdomain/bindtextdomain dnl are not found in libc if test "$ac_cv_func_bindtextdomain" = "no"; then AC_CHECK_LIB(intl,bindtextdomain) - if test "$ac_cv_lib_intl" = "yes"; then + if test "$ac_cv_lib_intl_bindtextdomain" = "yes"; then + dnl undo caching + unset ac_cv_func_gettext + unset ac_cv_func_textdomain + unset ac_cv_func_bindtextdomain AC_CHECK_FUNCS(gettext textdomain bindtextdomain) fi fi @@ -633,17 +637,19 @@ fi dnl this defines SYS_SIGLIST_DECLARED AC_DECL_SYS_SIGLIST -dnl network functions -- check for inet_aton again -if test "$ac_cv_func_inet_aton" != 'yes'; then -BASH_FUNC_INET_ATON -fi - dnl libraries dnl this is reportedly no longer necessary for irix[56].? case "$host_os" in irix4*) AC_CHECK_LIB(sun, getpwent) ;; +*beos*) AC_CHECK_LIB(bind, gethostbyname) + AC_CHECK_LIB(socket, getpeername) ;; esac +dnl network functions -- check for inet_aton again +if test "$ac_cv_func_inet_aton" != 'yes'; then +BASH_FUNC_INET_ATON +fi + dnl check for getpeername in the socket library only if it's not in libc if test "$ac_cv_func_getpeername" = no; then BASH_CHECK_LIB_SOCKET diff --git a/src/apps/bin/bash/eval.c b/src/apps/bin/bash/eval.c index 9908f22d44..179ecd4bbc 100644 --- a/src/apps/bin/bash/eval.c +++ b/src/apps/bin/bash/eval.c @@ -43,7 +43,7 @@ # include "bashhist.h" #endif -extern int EOF_reached; +extern int EOF_Reached; extern int indirection_level; extern int posixly_correct; extern int subshell_environment, running_under_emacs; diff --git a/src/apps/bin/bash/input.c b/src/apps/bin/bash/input.c index 9cb5401dea..3b5cf5f7bd 100644 --- a/src/apps/bin/bash/input.c +++ b/src/apps/bin/bash/input.c @@ -490,7 +490,7 @@ sync_buffered_stream (bfd) if (buffers == 0 || (bp = buffers[bfd]) == 0) return (-1); - chars_left = bp->b_used - bp->b_inputp; + chars_left = bp->b_used - (off_t)bp->b_inputp; /* mmu_man: force substract on LL for BeOS. */ if (chars_left) lseek (bp->b_fd, -chars_left, SEEK_CUR); bp->b_used = bp->b_inputp = 0; diff --git a/src/apps/bin/bash/lib/readline/histfile.c b/src/apps/bin/bash/lib/readline/histfile.c index 60a91251b7..284110c85b 100644 --- a/src/apps/bin/bash/lib/readline/histfile.c +++ b/src/apps/bin/bash/lib/readline/histfile.c @@ -346,12 +346,6 @@ history_truncate_file (fname, lines) if (bp > buffer && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1)) { write (file, bp, chars_read - (bp - buffer)); - -#if defined (__BEOS__) - /* BeOS ignores O_TRUNC. */ - ftruncate (file, chars_read - (bp - buffer)); -#endif - close (file); } diff --git a/src/apps/bin/bash/sig.c b/src/apps/bin/bash/sig.c index 21a57ae100..80dc1eccc8 100644 --- a/src/apps/bin/bash/sig.c +++ b/src/apps/bin/bash/sig.c @@ -445,6 +445,19 @@ sigint_sighandler (sig) if (interrupt_immediately) { interrupt_immediately = 0; +#ifdef __BEOS__ + /* XXXdbg -- throw_to_top_level() calls longjmp() which leaves our + sigmask in a screwed up state so we reset it here. */ + /* FIXME - fnf: Is this a generic problem with bash, or something + Be specific? */ + { + sigset_t oset; + sigemptyset(&oset); + sigprocmask(SIG_BLOCK, NULL, &oset); + sigdelset(&oset, SIGINT); + sigprocmask(SIG_SETMASK, &oset, NULL); + } +#endif throw_to_top_level (); }