Merge branch 'fix-bash-path' into 'master'

Fix Bash and Git PATH to use double colon

See merge request redox-os/cookbook!629
This commit is contained in:
Jeremy Soller 2025-09-19 11:06:44 -06:00
commit bd796dcf38
2 changed files with 73 additions and 234 deletions

View File

@ -1,6 +1,6 @@
diff -ruwN git-2.13.1/compat/bswap.h source/compat/bswap.h
--- git-2.13.1/compat/bswap.h 2017-06-04 19:08:11.000000000 -0600
+++ source/compat/bswap.h 2025-04-24 11:20:06.475749424 -0600
diff -ruwN source/compat/bswap.h source-new/compat/bswap.h
--- source/compat/bswap.h 2017-06-05 08:08:11.000000000 +0700
+++ source-new/compat/bswap.h 2025-09-01 04:41:10.337224520 +0700
@@ -1,3 +1,7 @@
+#if defined(__redox__)
+#include <machine/endian.h>
@ -9,9 +9,9 @@ diff -ruwN git-2.13.1/compat/bswap.h source/compat/bswap.h
/*
* Let's make sure we always have a sane definition for ntohl()/htonl().
* Some libraries define those as a function call, just to perform byte
diff -ruwN git-2.13.1/compat/terminal.c source/compat/terminal.c
--- git-2.13.1/compat/terminal.c 2017-06-04 19:08:11.000000000 -0600
+++ source/compat/terminal.c 2025-04-18 10:00:11.318697446 -0600
diff -ruwN source/compat/terminal.c source-new/compat/terminal.c
--- source/compat/terminal.c 2017-06-05 08:08:11.000000000 +0700
+++ source-new/compat/terminal.c 2025-09-01 04:41:10.337224520 +0700
@@ -137,6 +137,18 @@
return buf.buf;
}
@ -31,9 +31,9 @@ diff -ruwN git-2.13.1/compat/terminal.c source/compat/terminal.c
#else
char *git_terminal_prompt(const char *prompt, int echo)
diff -ruwN git-2.13.1/configure source/configure
--- git-2.13.1/configure 2017-06-04 19:08:11.000000000 -0600
+++ source/configure 2025-04-18 10:00:11.318697446 -0600
diff -ruwN source/configure source-new/configure
--- source/configure 2017-06-05 08:08:11.000000000 +0700
+++ source-new/configure 2025-09-01 04:41:10.338224544 +0700
@@ -6156,7 +6156,7 @@
ac_res=$ac_cv_search_getaddrinfo
if test "$ac_res" != no; then :
@ -43,33 +43,10 @@ diff -ruwN git-2.13.1/configure source/configure
else
NO_IPV6=YesPlease
fi
diff -ruwN git-2.13.1/daemon.c source/daemon.c
--- git-2.13.1/daemon.c 2017-06-04 19:08:11.000000000 -0600
+++ source/daemon.c 2025-04-18 10:00:11.319697447 -0600
@@ -71,13 +71,21 @@
return hi->ip_address.buf;
}
+#if defined(__redox__)
+#define LOG_ERR 0
+#define LOG_INFO 1
+#endif
+
static void logreport(int priority, const char *err, va_list params)
{
+#if !defined(__redox__)
if (log_syslog) {
char buf[1024];
vsnprintf(buf, sizeof(buf), err, params);
syslog(priority, "%s", buf);
- } else {
+ } else
+#endif
+ {
/*
* Since stderr is set to buffered mode, the
* logging of different processes will not overlap
@@ -888,8 +896,12 @@
diff -ruwN source/daemon.c source-new/daemon.c
--- source/daemon.c 2017-06-05 08:08:11.000000000 +0700
+++ source-new/daemon.c 2025-09-19 22:14:42.743240085 +0700
@@ -888,8 +888,12 @@
if (!reuseaddr)
return 0;
@ -82,34 +59,9 @@ diff -ruwN git-2.13.1/daemon.c source/daemon.c
}
struct socketlist {
@@ -1174,11 +1186,7 @@
if (!group_name)
c.gid = c.pass->pw_gid;
else {
- struct group *group = getgrnam(group_name);
- if (!group)
die("group not found - %s", group_name);
-
- c.gid = group->gr_gid;
}
return &c;
@@ -1348,10 +1356,12 @@
usage(daemon_usage);
}
+#if !defined(__redox__)
if (log_syslog) {
openlog("git-daemon", LOG_PID, LOG_DAEMON);
set_die_routine(daemon_die);
} else
+#endif
/* avoid splitting a message in the middle */
setvbuf(stderr, NULL, _IOFBF, 4096);
diff -ruwN git-2.13.1/git-compat-util.h source/git-compat-util.h
--- git-2.13.1/git-compat-util.h 2017-06-04 19:08:11.000000000 -0600
+++ source/git-compat-util.h 2025-04-18 10:00:11.319697447 -0600
diff -ruwN source/git-compat-util.h source-new/git-compat-util.h
--- source/git-compat-util.h 2017-06-05 08:08:11.000000000 +0700
+++ source-new/git-compat-util.h 2025-09-19 22:09:29.361246446 +0700
@@ -1,6 +1,18 @@
#ifndef GIT_COMPAT_UTIL_H
#define GIT_COMPAT_UTIL_H
@ -129,27 +81,10 @@ diff -ruwN git-2.13.1/git-compat-util.h source/git-compat-util.h
#define _FILE_OFFSET_BITS 64
@@ -179,7 +191,9 @@
#include <assert.h>
#include <regex.h>
#include <utime.h>
+#if !defined(__redox__)
#include <syslog.h>
+#endif
#ifndef NO_SYS_POLL_H
#include <sys/poll.h>
#else
@@ -320,8 +334,20 @@
#endif
#ifndef PATH_SEP
+#if defined(__redox__)
+#define PATH_SEP ';'
+#else
@@ -323,6 +335,14 @@
#define PATH_SEP ':'
#endif
+#endif
+
+#ifndef DEV_NULL
+#if defined(__redox__)
+#define DEV_NULL "/scheme/null"
@ -157,58 +92,13 @@ diff -ruwN git-2.13.1/git-compat-util.h source/git-compat-util.h
+#define DEV_NULL "/dev/null"
+#endif
+#endif
+
#ifdef HAVE_PATHS_H
#include <paths.h>
@@ -333,6 +359,16 @@
#ifndef has_dos_drive_prefix
static inline int git_has_dos_drive_prefix(const char *path)
{
+#if defined(__redox__)
+ char * pos = (char *)path;
+ char c;
+ while (c = *pos) {
+ pos++;
+ if (c == ':') {
+ return pos - path;
+ }
+ }
+#endif
return 0;
}
#define has_dos_drive_prefix git_has_dos_drive_prefix
@@ -341,7 +377,13 @@
#ifndef skip_dos_drive_prefix
static inline int git_skip_dos_drive_prefix(char **path)
{
+#if defined(__redox__)
+ int ret = has_dos_drive_prefix(*path);
+ *path += ret;
+ return ret;
+#else
return 0;
+#endif
}
#define skip_dos_drive_prefix git_skip_dos_drive_prefix
#endif
@@ -357,7 +399,14 @@
#ifndef offset_1st_component
static inline int git_offset_1st_component(const char *path)
{
+#if defined(__redox__)
+ char * pos = (char *)path;
+ skip_dos_drive_prefix(&pos);
+ pos += is_dir_sep(*pos);
+ return pos - path;
+#else
return is_dir_sep(path[0]);
+#endif
}
#define offset_1st_component git_offset_1st_component
#endif
diff -ruwN git-2.13.1/Makefile source/Makefile
--- git-2.13.1/Makefile 2017-06-04 19:08:11.000000000 -0600
+++ source/Makefile 2025-04-18 10:00:11.319697447 -0600
diff -ruwN source/Makefile source-new/Makefile
--- source/Makefile 2017-06-05 08:08:11.000000000 +0700
+++ source-new/Makefile 2025-09-01 04:41:10.339224568 +0700
@@ -979,7 +979,7 @@
BUILTIN_OBJS += builtin/write-tree.o
@ -257,9 +147,9 @@ diff -ruwN git-2.13.1/Makefile source/Makefile
ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \
done && \
diff -ruwN git-2.13.1/run-command.c source/run-command.c
--- git-2.13.1/run-command.c 2017-06-04 19:08:11.000000000 -0600
+++ source/run-command.c 2025-04-18 10:00:11.320697447 -0600
diff -ruwN source/run-command.c source-new/run-command.c
--- source/run-command.c 2017-06-05 08:08:11.000000000 +0700
+++ source-new/run-command.c 2025-09-19 22:08:26.892232334 +0700
@@ -120,9 +120,9 @@
#ifndef GIT_WINDOWS_NATIVE
static inline void dup_devnull(int to)
@ -272,18 +162,9 @@ diff -ruwN git-2.13.1/run-command.c source/run-command.c
if (dup2(fd, to) < 0)
die_errno(_("dup2(%d,%d) failed"), fd, to);
close(fd);
@@ -138,7 +138,7 @@
return NULL;
while (1) {
- const char *end = strchrnul(p, ':');
+ const char *end = strchrnul(p, PATH_SEP);
strbuf_reset(&buf);
diff -ruwN git-2.13.1/setup.c source/setup.c
--- git-2.13.1/setup.c 2017-06-04 19:08:11.000000000 -0600
+++ source/setup.c 2025-04-18 10:00:11.320697447 -0600
diff -ruwN source/setup.c source-new/setup.c
--- source/setup.c 2017-06-05 08:08:11.000000000 +0700
+++ source-new/setup.c 2025-09-01 04:41:10.339224568 +0700
@@ -1146,11 +1146,11 @@
/* if any standard file descriptor is missing open it to /dev/null */
void sanitize_stdfds(void)

View File

@ -1,6 +1,6 @@
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
diff -ruwN source/bashline.c source-new/bashline.c
--- source/bashline.c 2022-04-18 05:37:12.000000000 +0700
+++ source-new/bashline.c 2025-09-01 04:36:35.272926519 +0700
@@ -2645,7 +2645,7 @@
const char *text;
int state;
@ -10,9 +10,9 @@ diff -ruwN bash-5.2.15/bashline.c source/bashline.c
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
diff -ruwN source/builtins/ulimit.def source-new/builtins/ulimit.def
--- source/builtins/ulimit.def 2021-11-05 20:19:53.000000000 +0700
+++ source-new/builtins/ulimit.def 2025-09-01 04:36:35.272926519 +0700
@@ -609,7 +609,7 @@
}
else
@ -22,38 +22,9 @@ diff -ruwN bash-5.2.15/builtins/ulimit.def source/builtins/ulimit.def
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. */
diff -ruwN source/config-top.h source-new/config-top.h
--- source/config-top.h 2021-11-05 20:11:12.000000000 +0700
+++ source-new/config-top.h 2025-09-19 21:55:55.439030906 +0700
@@ -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. */
@ -61,9 +32,9 @@ diff -ruwN bash-5.2.15/config-top.h source/config-top.h
+
+/* 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
diff -ruwN source/configure source-new/configure
--- source/configure 2022-09-23 21:13:22.000000000 +0700
+++ source-new/configure 2025-09-01 04:52:47.542177017 +0700
@@ -3298,6 +3298,7 @@
*-nsk*) opt_bash_malloc=no ;; # HP NonStop
*-haiku*) opt_bash_malloc=no ;; # Haiku OS
@ -72,9 +43,9 @@ diff -ruwN bash-5.2.15/configure source/configure
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
diff -ruwN source/configure.ac source-new/configure.ac
--- source/configure.ac 2022-09-23 21:12:27.000000000 +0700
+++ source-new/configure.ac 2025-09-01 04:36:35.275926660 +0700
@@ -92,6 +92,7 @@
*-nsk*) opt_bash_malloc=no ;; # HP NonStop
*-haiku*) opt_bash_malloc=no ;; # Haiku OS
@ -83,9 +54,9 @@ diff -ruwN bash-5.2.15/configure.ac source/configure.ac
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
diff -ruwN source/execute_cmd.c source-new/execute_cmd.c
--- source/execute_cmd.c 2022-12-14 00:09:02.000000000 +0700
+++ source-new/execute_cmd.c 2025-09-01 04:36:35.275926660 +0700
@@ -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)
@ -100,9 +71,9 @@ diff -ruwN bash-5.2.15/execute_cmd.c source/execute_cmd.c
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
diff -ruwN source/general.c source-new/general.c
--- source/general.c 2022-11-24 05:10:12.000000000 +0700
+++ source-new/general.c 2025-09-19 17:09:24.754782168 +0700
@@ -589,6 +589,7 @@
void
check_dev_tty ()
@ -119,22 +90,9 @@ diff -ruwN bash-5.2.15/general.c source/general.c
}
/* 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
diff -ruwN source/include/posixwait.h source-new/include/posixwait.h
--- source/include/posixwait.h 2019-03-30 00:25:52.000000000 +0700
+++ source-new/include/posixwait.h 2025-09-01 04:36:35.276926707 +0700
@@ -34,7 +34,7 @@
/* How to get the status of a job. For Posix, this is just an
@ -153,9 +111,9 @@ diff -ruwN bash-5.2.15/include/posixwait.h source/include/posixwait.h
# 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
diff -ruwN source/lib/readline/input.c source-new/lib/readline/input.c
--- source/lib/readline/input.c 2022-04-09 02:43:24.000000000 +0700
+++ source-new/lib/readline/input.c 2025-09-01 04:36:35.276926707 +0700
@@ -805,7 +805,7 @@
int result;
unsigned char c;
@ -165,9 +123,9 @@ diff -ruwN bash-5.2.15/lib/readline/input.c source/lib/readline/input.c
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
diff -ruwN source/lib/readline/terminal.c source-new/lib/readline/terminal.c
--- source/lib/readline/terminal.c 2022-04-05 21:44:17.000000000 +0700
+++ source-new/lib/readline/terminal.c 2025-09-01 04:36:35.286927174 +0700
@@ -102,7 +102,7 @@
static int tcap_initialized;
@ -177,9 +135,9 @@ diff -ruwN bash-5.2.15/lib/readline/terminal.c source/lib/readline/terminal.c
# 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
diff -ruwN source/lib/sh/getcwd.c source-new/lib/sh/getcwd.c
--- source/lib/sh/getcwd.c 2012-03-10 22:48:50.000000000 +0700
+++ source-new/lib/sh/getcwd.c 2025-09-01 04:36:35.286927174 +0700
@@ -20,7 +20,7 @@
#include <config.h>
@ -189,9 +147,9 @@ diff -ruwN bash-5.2.15/lib/sh/getcwd.c source/lib/sh/getcwd.c
#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
diff -ruwN source/lib/sh/input_avail.c source-new/lib/sh/input_avail.c
--- source/lib/sh/input_avail.c 2021-05-24 22:16:33.000000000 +0700
+++ source-new/lib/sh/input_avail.c 2025-09-01 04:36:35.298927735 +0700
@@ -33,7 +33,7 @@
# include <sys/file.h>
#endif /* HAVE_SYS_FILE_H */
@ -201,9 +159,9 @@ diff -ruwN bash-5.2.15/lib/sh/input_avail.c source/lib/sh/input_avail.c
# 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
diff -ruwN source/lib/sh/strtoimax.c source-new/lib/sh/strtoimax.c
--- source/lib/sh/strtoimax.c 2021-09-10 21:32:35.000000000 +0700
+++ source-new/lib/sh/strtoimax.c 2025-09-01 04:36:35.301927876 +0700
@@ -55,6 +55,8 @@
extern long long strtoll PARAMS((const char *, char **, int));
#endif
@ -222,9 +180,9 @@ diff -ruwN bash-5.2.15/lib/sh/strtoimax.c source/lib/sh/strtoimax.c
#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
diff -ruwN source/parse.y source-new/parse.y
--- source/parse.y 2022-12-14 00:09:02.000000000 +0700
+++ source-new/parse.y 2025-09-01 04:36:35.302927923 +0700
@@ -2625,6 +2625,7 @@
parser_state |= PST_ENDALIAS;
/* We need to do this to make sure last_shell_getc_is_singlebyte returns
@ -241,9 +199,9 @@ diff -ruwN bash-5.2.15/parse.y source/parse.y
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
diff -ruwN source/y.tab.c source-new/y.tab.c
--- source/y.tab.c 2022-12-14 00:09:02.000000000 +0700
+++ source-new/y.tab.c 2025-09-01 04:36:35.307928157 +0700
@@ -4936,6 +4936,7 @@
parser_state |= PST_ENDALIAS;
/* We need to do this to make sure last_shell_getc_is_singlebyte returns