2024-04-01 06:51:06 +00:00
|
|
|
From 5e546a30789e5c9b3c94674b94cb63e16ee2e951 Mon Sep 17 00:00:00 2001
|
2021-03-19 02:34:51 +00:00
|
|
|
From: Philip McGrath <philip@philipmcgrath.com>
|
|
|
|
Date: Thu, 4 Mar 2021 04:11:50 -0500
|
2022-08-27 18:55:45 +00:00
|
|
|
Subject: [PATCH] rktio: patch rktio_process for "/bin/sh" on Guix
|
2021-03-19 02:34:51 +00:00
|
|
|
|
|
|
|
Racket provides the functions `system` and `process`,
|
|
|
|
which execute shell commands using `sh` (or `cmd` on Windows).
|
|
|
|
Racket assumes that `sh` can be found at "/bin/sh",
|
|
|
|
which is not necessarily true on Guix.
|
|
|
|
|
|
|
|
This patch adds a special case for "/bin/sh" to `rktio_process`,
|
|
|
|
the C function that implements the core of `system`, `process`,
|
|
|
|
and related Racket functions.
|
|
|
|
|
|
|
|
If:
|
|
|
|
|
2022-08-27 18:55:45 +00:00
|
|
|
1. The nonstandard but ubiquitous macro `_PATH_BSHELL` from
|
|
|
|
<paths.h> is defined; and
|
2021-03-19 02:34:51 +00:00
|
|
|
|
|
|
|
2. `rktio_process` is called with the exact path "/bin/sh"; and
|
|
|
|
|
2022-08-27 18:55:45 +00:00
|
|
|
3. The file specified by `_PATH_BSHELL` exists;
|
2021-03-19 02:34:51 +00:00
|
|
|
|
2022-08-27 18:55:45 +00:00
|
|
|
then `rktio_process` will execute the file specified by `_PATH_BSHELL`
|
|
|
|
instead of "/bin/sh".
|
2021-03-19 02:34:51 +00:00
|
|
|
|
2022-08-27 18:55:45 +00:00
|
|
|
Checking that the path specified by `_PATH_BSHELL` exists safeguards
|
|
|
|
against obscure errors if attempting to use stand-alone executables
|
|
|
|
built by the patched Racket in non-Guix envoronments.
|
2021-03-19 02:34:51 +00:00
|
|
|
---
|
2024-04-01 06:51:06 +00:00
|
|
|
|
|
|
|
Notes:
|
|
|
|
See also chez-scheme-bin-sh.patch, racket-chez-scheme-bin-sh.patch,
|
|
|
|
and zuo-bin-sh.patch.
|
|
|
|
|
2022-08-27 18:55:45 +00:00
|
|
|
racket/src/rktio/rktio_process.c | 17 ++++++++++++++++-
|
|
|
|
1 file changed, 16 insertions(+), 1 deletion(-)
|
2021-03-19 02:34:51 +00:00
|
|
|
|
gnu: racket-minimal: Bootstrap from C.
This commit bootstraps the Racket compiler and runtime system from source,
including Racket CS as well as both variants of Racket BC. (One remaining
limitation is discussed in comments added to gnu/packages/racket.scm.)
In the process, it moves to building minimal Racket from the Git repository,
rather than the packaged source tarballs. The Git repository is slightly
better as the ``corresponding source'':
1. A few packages especially closely tied to the Racket core implementation
(like "compiler-lib", "base", and "racket-doc") are developed in the
same Git repository. Having them use the same Guix origin, too, will
help to keep them in sync.
2. The top-level Makefile in the Git repository is an important
``script[] used to control compilation and installation.''
In particular, it cooperates with the "distro-build" package to
create the source tarballs and installers for a Racket distribution.
(Racket supports a notion of custom distributions.)
3. It is ``the preferred form ... for making modifications'' to the core
Racket implementation.
Racket releases are tagged in the Git repository (e.g. "v8.1"). At the
beginning of each release cycle, a branch is created to stabilizer a version
for extra testing. Active development happens on the "master" branch.
* gnu/packages/racket-minimal-sh-via-rktio.patch: Adjust for extra directory
layer.
* gnu/local/racket.scm (cfg-flag:sh-for-rktio, cfg-flag:enable-lt,
cfg-flag:enable-racket, unpack-nanopass+stex,
%main-repo-main-distribution-pkgs): New private variables.
* gnu/local/racket.scm (racket-minimal)[source]: Use Git.
[source](snippet): Unbundle nanopass, stex, and libffi.
[native-inputs]: Use racket-bootstrap-chez-bootfiles, plus its
dependencies (for Chez, plus a Racket for bootstrap pig).
[arguments]: Revise extensively.
* gnu/local/racket.scm (racket-minimal-bc-3m, racket-minimal-bc-cgc): New
packages, hidden at least for now.
(racket-bootstrap-chez-bootfiles): Another new package, but this one is
especially likely to stay hidden.
* gnu/local/racket.scm (racket)[origin](snippet): Unbundle packages
developed in the main Git repository, but leave their links.rktd and
pkgs.rktd entries in place.
[native-inputs]: Add the main Racket Git repository.
[arguments](#:phases): Adjust 'unpack-packages to also unpack package
sources from the main Racket Git repository.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-07-19 06:31:43 +00:00
|
|
|
diff --git a/racket/src/rktio/rktio_process.c b/racket/src/rktio/rktio_process.c
|
2024-04-01 06:51:06 +00:00
|
|
|
index 862850d93a..87daafef76 100644
|
gnu: racket-minimal: Bootstrap from C.
This commit bootstraps the Racket compiler and runtime system from source,
including Racket CS as well as both variants of Racket BC. (One remaining
limitation is discussed in comments added to gnu/packages/racket.scm.)
In the process, it moves to building minimal Racket from the Git repository,
rather than the packaged source tarballs. The Git repository is slightly
better as the ``corresponding source'':
1. A few packages especially closely tied to the Racket core implementation
(like "compiler-lib", "base", and "racket-doc") are developed in the
same Git repository. Having them use the same Guix origin, too, will
help to keep them in sync.
2. The top-level Makefile in the Git repository is an important
``script[] used to control compilation and installation.''
In particular, it cooperates with the "distro-build" package to
create the source tarballs and installers for a Racket distribution.
(Racket supports a notion of custom distributions.)
3. It is ``the preferred form ... for making modifications'' to the core
Racket implementation.
Racket releases are tagged in the Git repository (e.g. "v8.1"). At the
beginning of each release cycle, a branch is created to stabilizer a version
for extra testing. Active development happens on the "master" branch.
* gnu/packages/racket-minimal-sh-via-rktio.patch: Adjust for extra directory
layer.
* gnu/local/racket.scm (cfg-flag:sh-for-rktio, cfg-flag:enable-lt,
cfg-flag:enable-racket, unpack-nanopass+stex,
%main-repo-main-distribution-pkgs): New private variables.
* gnu/local/racket.scm (racket-minimal)[source]: Use Git.
[source](snippet): Unbundle nanopass, stex, and libffi.
[native-inputs]: Use racket-bootstrap-chez-bootfiles, plus its
dependencies (for Chez, plus a Racket for bootstrap pig).
[arguments]: Revise extensively.
* gnu/local/racket.scm (racket-minimal-bc-3m, racket-minimal-bc-cgc): New
packages, hidden at least for now.
(racket-bootstrap-chez-bootfiles): Another new package, but this one is
especially likely to stay hidden.
* gnu/local/racket.scm (racket)[origin](snippet): Unbundle packages
developed in the main Git repository, but leave their links.rktd and
pkgs.rktd entries in place.
[native-inputs]: Add the main Racket Git repository.
[arguments](#:phases): Adjust 'unpack-packages to also unpack package
sources from the main Racket Git repository.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-07-19 06:31:43 +00:00
|
|
|
--- a/racket/src/rktio/rktio_process.c
|
|
|
|
+++ b/racket/src/rktio/rktio_process.c
|
2022-08-27 18:55:45 +00:00
|
|
|
@@ -9,6 +9,7 @@
|
|
|
|
# include <sys/wait.h>
|
|
|
|
# include <errno.h>
|
|
|
|
# include <unistd.h>
|
|
|
|
+# include <paths.h> /* PATCHED for Guix */
|
|
|
|
# ifdef USE_ULIMIT
|
|
|
|
# include <ulimit.h>
|
|
|
|
# endif
|
2024-04-01 06:51:06 +00:00
|
|
|
@@ -1358,12 +1359,14 @@ int rktio_process_allowed_flags(rktio_t *rktio)
|
2021-03-19 02:34:51 +00:00
|
|
|
/*========================================================================*/
|
|
|
|
|
|
|
|
rktio_process_result_t *rktio_process(rktio_t *rktio,
|
|
|
|
- const char *command, int argc, rktio_const_string_t *argv,
|
|
|
|
+ /* PATCHED for Guix (next line) */
|
|
|
|
+ const char *_guix_orig_command, int argc, rktio_const_string_t *argv,
|
|
|
|
rktio_fd_t *stdout_fd, rktio_fd_t *stdin_fd, rktio_fd_t *stderr_fd,
|
|
|
|
rktio_process_t *group_proc,
|
|
|
|
const char *current_directory, rktio_envvars_t *envvars,
|
|
|
|
int flags)
|
|
|
|
{
|
|
|
|
+ const char *command; /* PATCHED for Guix */
|
|
|
|
rktio_process_result_t *result;
|
|
|
|
intptr_t to_subprocess[2], from_subprocess[2], err_subprocess[2];
|
|
|
|
int pid;
|
2024-04-01 06:51:06 +00:00
|
|
|
@@ -1390,6 +1393,18 @@ rktio_process_result_t *rktio_process(rktio_t *rktio,
|
2021-03-19 02:34:51 +00:00
|
|
|
int i;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+/* BEGIN PATCH for Guix */
|
2022-08-27 18:55:45 +00:00
|
|
|
+#if defined(_PATH_BSHELL)
|
2021-03-19 02:34:51 +00:00
|
|
|
+ command =
|
|
|
|
+ ((0 == strcmp(_guix_orig_command, "/bin/sh"))
|
2022-08-27 18:55:45 +00:00
|
|
|
+ && rktio_file_exists(rktio, _PATH_BSHELL))
|
|
|
|
+ ? _PATH_BSHELL
|
2021-03-19 02:34:51 +00:00
|
|
|
+ : _guix_orig_command;
|
|
|
|
+#else
|
|
|
|
+ command = _guix_orig_command;
|
|
|
|
+#endif
|
|
|
|
+/* END PATCH for Guix */
|
|
|
|
+
|
|
|
|
/* avoid compiler warnings: */
|
|
|
|
to_subprocess[0] = -1;
|
|
|
|
to_subprocess[1] = -1;
|
2022-08-27 18:55:45 +00:00
|
|
|
|
2024-04-01 06:51:06 +00:00
|
|
|
base-commit: 78fef00d4d16a79fdf6ab31924b3a80cadf4b368
|
2021-03-19 02:34:51 +00:00
|
|
|
--
|
2024-04-01 06:51:06 +00:00
|
|
|
2.41.0
|
2021-03-19 02:34:51 +00:00
|
|
|
|