Re,
Thanks for this cleanup.
Alperen Erkan, le dim. 20 sept. 2026 11:49:26 +0300, a ecrit:
> ---
> hurd/boot/boot.c | 296
> ++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------
> 1 file changed, 184 insertions(+), 112 deletions(-)
>
> diff --git a/hurd/boot/boot.c b/hurd/boot/boot.c
> --- a/hurd/boot/boot.c
> +++ b/hurd/boot/boot.c
> @@ -616,12 +613,9 @@ const char *default_boot_script =
> " -T device ${root-device} $(task-create) $(task-resume)"
> "\n"
>
> - /* Now the exec server; to load the dynamically-linked exec server
> - program, we have the boot loader in fact load and run ld.so,
> - which in turn loads and runs /hurd/exec. This task is created,
> - and its task port saved in ${exec-task} to be passed to the fs
> - above, but it is left suspended; the fs will resume the exec task
> - once it is ready. */
> + /* Now the exec server. It is created suspended; the bootstrap
> + filesystem resumes it once it is ready. Its task port is saved
> + in ${exec-task} to be passed to the fs above. */
> "/hurd/exec.static $(exec-task=task-create)"
> "\n";
Keep the part about the task being left suspended and fs resuming
it.
> @@ -658,8 +664,14 @@ main (int argc, char **argv, char **envp)
> if (privileged)
> strcat (bootstrap_args, "f");
>
> err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_PORT_SET,
> &receive_set);
> if (err)
> error (12, err, "mach_port_allocate");
> +
> + if (pipe2 (wake_pipe, O_NONBLOCK | O_CLOEXEC) < 0
> + || pipe2 (select_pipe, O_NONBLOCK | O_CLOEXEC) < 0)
> + error (13, errno, "pipe2");
These are unused yet and thus don't belong to this patch.
> @@ -788,49 +805,66 @@ main (int argc, char **argv, char **envp)
> VAL_STR, (intptr_t) bootstrap_args))
> {
> static const char msg[] = "error setting variable";
> - size_t len = strlen (msg);
> - ssize_t err2 = write (2, msg, len);
> - assert_backtrace (err2 == len);
> + write_diag (msg, sizeof msg - 1);
> host_exit (1);
> }
>
> /* Turn each `FOO=BAR' word in the command line into a boot script
> variable ${FOO} with value BAR. */
> {
> - int len = strlen (kernel_command_line) + 1;
> - char *s = memcpy (alloca (len), kernel_command_line, len);
> + char *s = strdup (kernel_command_line);
> char *word;
>
> + if (! s)
> + error (1, ENOMEM, "strdup");
> +
> while ((word = strsep (&s, " \t")) != 0)
> {
> char *eq = strchr (word, '=');
> if (eq == 0)
> continue;
> *eq++ = '\0';
> + if (! strcmp (word, "host-port")
> + || ! strcmp (word, "device-port")
> + || ! strcmp (word, "kernel-task")
> + || ! strcmp (word, "kernel-command-line")
> + || ! strcmp (word, "root-device")
> + || ! strcmp (word, "boot-args"))
> + {
> + fprintf (stderr, "ignoring reserved boot variable %s\n", word);
> + continue;
> + }
This if part deserves being put in a separate patch, as it's a really
different kind of cleanup.
Samuel