redox/recipes/shells/bash/redox.patch
2024-12-06 17:37:00 +00:00

263 lines
9.2 KiB
Diff

diff -ruwN bash-5.2.15/bashline.c source/bashline.c
--- bash-5.2.15/bashline.c 2022-04-17 15:37:12.000000000 -0700
+++ source/bashline.c 2024-12-05 16:04:07.566380980 -0800
@@ -2645,7 +2645,7 @@
const char *text;
int state;
{
-#if defined (__WIN32__) || defined (__OPENNT) || !defined (HAVE_GRP_H)
+#if defined (__WIN32__) || defined (__OPENNT) || !defined (HAVE_GRP_H) || defined(__redox__)
return ((char *)NULL);
#else
static char *gname = (char *)NULL;
diff -ruwN bash-5.2.15/builtins/ulimit.def source/builtins/ulimit.def
--- bash-5.2.15/builtins/ulimit.def 2021-11-05 06:19:53.000000000 -0700
+++ source/builtins/ulimit.def 2024-12-05 16:04:07.567380980 -0800
@@ -609,7 +609,7 @@
}
else
{
-#if defined (HAVE_RESOURCE)
+#if defined (HAVE_RESOURCE) && !defined(__redox__)
if (getrlimit (limits[ind].parameter, &limit) < 0)
return -1;
# if defined (HPUX9)
diff -ruwN bash-5.2.15/config-top.h source/config-top.h
--- bash-5.2.15/config-top.h 2021-11-05 06:11:12.000000000 -0700
+++ source/config-top.h 2024-12-06 01:06:18.324586528 -0800
@@ -63,24 +63,24 @@
/* The default value of the PATH variable. */
#ifndef DEFAULT_PATH_VALUE
#define DEFAULT_PATH_VALUE \
- "/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:."
+ "/usr/local/bin;/usr/local/sbin;/usr/bin;/usr/sbin;/bin;/sbin;."
#endif
/* If you want to unconditionally set a value for PATH in every restricted
shell, set this. */
-/* #define RBASH_STATIC_PATH_VALUE "/rbin:/usr/rbin" */
+/* #define RBASH_STATIC_PATH_VALUE "/rbin;/usr/rbin" */
/* The value for PATH when invoking `command -p'. This is only used when
the Posix.2 confstr () function, or CS_PATH define are not present. */
#ifndef STANDARD_UTILS_PATH
#define STANDARD_UTILS_PATH \
- "/bin:/usr/bin:/sbin:/usr/sbin:/etc:/usr/etc"
+ "/bin;/usr/bin;/sbin;/usr/sbin;/etc;/usr/etc"
#endif
/* The default path for enable -f */
#ifndef DEFAULT_LOADABLE_BUILTINS_PATH
#define DEFAULT_LOADABLE_BUILTINS_PATH \
- "/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:."
+ "/usr/local/lib/bash;/usr/lib/bash;/opt/local/lib/bash;/usr/pkg/lib/bash;/opt/pkg/lib/bash;."
#endif
/* Default primary and secondary prompt strings. */
@@ -199,3 +199,6 @@
/* Undefine or define to 0 if you don't want to allow associative array
assignment using a compound list of key-value pairs. */
#define ASSOC_KVPAIR_ASSIGNMENT 1
+
+/* Don't check for a valid inode number when pattern matching on Redox */
+#define BROKEN_DIRENT_D_INO 1
diff -ruwN bash-5.2.15/configure source/configure
--- bash-5.2.15/configure 2022-09-23 07:13:22.000000000 -0700
+++ source/configure 2024-12-05 16:06:32.812286102 -0800
@@ -3298,6 +3298,7 @@
*-nsk*) opt_bash_malloc=no ;; # HP NonStop
*-haiku*) opt_bash_malloc=no ;; # Haiku OS
*-genode*) opt_bash_malloc=no ;; # Genode has no sbrk
+*-redox*) opt_bash_malloc=no ;; # Redox OS
esac
# memory scrambling on free()
diff -ruwN bash-5.2.15/configure.ac source/configure.ac
--- bash-5.2.15/configure.ac 2022-09-23 07:12:27.000000000 -0700
+++ source/configure.ac 2024-12-05 16:04:07.571380977 -0800
@@ -92,6 +92,7 @@
*-nsk*) opt_bash_malloc=no ;; # HP NonStop
*-haiku*) opt_bash_malloc=no ;; # Haiku OS
*-genode*) opt_bash_malloc=no ;; # Genode has no sbrk
+*-redox*) opt_bash_malloc=no ;; # Redox OS
esac
# memory scrambling on free()
diff -ruwN bash-5.2.15/execute_cmd.c source/execute_cmd.c
--- bash-5.2.15/execute_cmd.c 2022-12-13 09:09:02.000000000 -0800
+++ source/execute_cmd.c 2024-12-05 16:04:07.573380976 -0800
@@ -1379,11 +1379,11 @@
nullcmd = (command == 0) || (command->type == cm_simple && command->value.Simple->words == 0 && command->value.Simple->redirects == 0);
if (posixly_correct && nullcmd)
{
-#if defined (HAVE_GETRUSAGE)
+#if defined (HAVE_GETRUSAGE) && defined (HAVE_GETTIMEOFDAY)
selfb.ru_utime.tv_sec = kidsb.ru_utime.tv_sec = selfb.ru_stime.tv_sec = kidsb.ru_stime.tv_sec = 0;
selfb.ru_utime.tv_usec = kidsb.ru_utime.tv_usec = selfb.ru_stime.tv_usec = kidsb.ru_stime.tv_usec = 0;
before = shellstart;
-#else
+#elif defined (HAVE_TIMES)
before.tms_utime = before.tms_stime = before.tms_cutime = before.tms_cstime = 0;
tbefore = shell_start_time;
#endif
diff -ruwN bash-5.2.15/general.c source/general.c
--- bash-5.2.15/general.c 2022-11-23 14:10:12.000000000 -0800
+++ source/general.c 2024-12-05 16:04:07.574380975 -0800
@@ -589,6 +589,7 @@
void
check_dev_tty ()
{
+#if !defined(__redox__)
int tty_fd;
char *tty;
@@ -603,6 +604,7 @@
}
if (tty_fd >= 0)
close (tty_fd);
+#endif
}
/* Return 1 if PATH1 and PATH2 are the same file. This is kind of
@@ -1031,10 +1033,10 @@
`:'. If I is 0, then the path has a leading colon. Trailing colons
are handled OK by the `else' part of the if statement; an empty
string is returned in that case. */
- if (i && string[i] == ':')
+ if (i && string[i] == ';')
i++;
- for (start = i; string[i] && string[i] != ':'; i++)
+ for (start = i; string[i] && string[i] != ';'; i++)
;
*p_index = i;
diff -ruwN bash-5.2.15/include/posixwait.h source/include/posixwait.h
--- bash-5.2.15/include/posixwait.h 2019-03-29 10:25:52.000000000 -0700
+++ source/include/posixwait.h 2024-12-05 16:04:07.574380975 -0800
@@ -34,7 +34,7 @@
/* How to get the status of a job. For Posix, this is just an
int, but for other systems we have to crack the union wait. */
-#if !defined (_POSIX_VERSION)
+#if 0
typedef union wait WAIT;
# define WSTATUS(t) (t.w_status)
#else /* _POSIX_VERSION */
@@ -50,7 +50,7 @@
/* More Posix P1003.1 definitions. In the POSIX versions, the parameter is
passed as an `int', in the non-POSIX version, as `union wait'. */
-#if defined (_POSIX_VERSION)
+#if 1
# if !defined (WSTOPSIG)
# define WSTOPSIG(s) ((s) >> 8)
diff -ruwN bash-5.2.15/lib/readline/input.c source/lib/readline/input.c
--- bash-5.2.15/lib/readline/input.c 2022-04-08 12:43:24.000000000 -0700
+++ source/lib/readline/input.c 2024-12-05 16:04:07.575380974 -0800
@@ -805,7 +805,7 @@
int result;
unsigned char c;
int fd;
-#if defined (HAVE_PSELECT)
+#if defined (HAVE_PSELECT) || defined (HAVE_SELECT)
sigset_t empty_set;
fd_set readfds;
#endif
diff -ruwN bash-5.2.15/lib/readline/terminal.c source/lib/readline/terminal.c
--- bash-5.2.15/lib/readline/terminal.c 2022-04-05 07:44:17.000000000 -0700
+++ source/lib/readline/terminal.c 2024-12-05 16:04:07.575380974 -0800
@@ -102,7 +102,7 @@
static int tcap_initialized;
-#if !defined (__linux__) && !defined (NCURSES_VERSION)
+#if !defined (__linux__) && !defined (NCURSES_VERSION) && !defined (__redox__)
# if defined (__EMX__) || defined (NEED_EXTERN_PC)
extern
# endif /* __EMX__ || NEED_EXTERN_PC */
diff -ruwN bash-5.2.15/lib/sh/getcwd.c source/lib/sh/getcwd.c
--- bash-5.2.15/lib/sh/getcwd.c 2012-03-10 07:48:50.000000000 -0800
+++ source/lib/sh/getcwd.c 2024-12-05 16:04:07.575380974 -0800
@@ -20,7 +20,7 @@
#include <config.h>
-#if !defined (HAVE_GETCWD)
+#if !defined (HAVE_GETCWD) && !defined(__redox__)
#if !defined (__GNUC__) && !defined (HAVE_ALLOCA_H) && defined (_AIX)
#pragma alloca
diff -ruwN bash-5.2.15/lib/sh/input_avail.c source/lib/sh/input_avail.c
--- bash-5.2.15/lib/sh/input_avail.c 2021-05-24 08:16:33.000000000 -0700
+++ source/lib/sh/input_avail.c 2024-12-05 16:04:07.576380974 -0800
@@ -33,7 +33,7 @@
# include <sys/file.h>
#endif /* HAVE_SYS_FILE_H */
-#if defined (HAVE_PSELECT)
+#if defined (HAVE_PSELECT) || defined (HAVE_SELECT)
# include <signal.h>
#endif
diff -ruwN bash-5.2.15/lib/sh/strtoimax.c source/lib/sh/strtoimax.c
--- bash-5.2.15/lib/sh/strtoimax.c 2021-09-10 07:32:35.000000000 -0700
+++ source/lib/sh/strtoimax.c 2024-12-05 16:04:07.576380974 -0800
@@ -55,6 +55,8 @@
extern long long strtoll PARAMS((const char *, char **, int));
#endif
+#if !defined (__redox__)
+
#ifdef strtoimax
#undef strtoimax
#endif
@@ -79,6 +81,8 @@
return (strtol (ptr, endptr, base));
}
+#endif
+
#ifdef TESTING
# include <stdio.h>
int
diff -ruwN bash-5.2.15/parse.y source/parse.y
--- bash-5.2.15/parse.y 2022-12-13 09:09:02.000000000 -0800
+++ source/parse.y 2024-12-05 16:04:07.577380973 -0800
@@ -2625,6 +2625,7 @@
parser_state |= PST_ENDALIAS;
/* We need to do this to make sure last_shell_getc_is_singlebyte returns
true, since we are returning a single-byte space. */
+#if defined (HANDLE_MULTIBYTE)
if (shell_input_line_index == shell_input_line_len && last_shell_getc_is_singlebyte == 0)
{
#if 0
@@ -2638,6 +2639,7 @@
shell_input_line_property[shell_input_line_index - 1] = 1;
#endif
}
+#endif /* HANDLE_MULTIBYTE */
return ' '; /* END_ALIAS */
}
#endif
diff -ruwN bash-5.2.15/y.tab.c source/y.tab.c
--- bash-5.2.15/y.tab.c 2022-12-13 09:09:02.000000000 -0800
+++ source/y.tab.c 2024-12-05 16:04:07.579380972 -0800
@@ -4936,6 +4936,7 @@
parser_state |= PST_ENDALIAS;
/* We need to do this to make sure last_shell_getc_is_singlebyte returns
true, since we are returning a single-byte space. */
+#if defined (HANDLE_MULTIBYTE)
if (shell_input_line_index == shell_input_line_len && last_shell_getc_is_singlebyte == 0)
{
#if 0
@@ -4949,6 +4950,7 @@
shell_input_line_property[shell_input_line_index - 1] = 1;
#endif
}
+#endif /* HANDLE_MULTIBYTE */
return ' '; /* END_ALIAS */
}
#endif