From 22f88490075dd2b96915e85ade0bb91dc0c96cbe Mon Sep 17 00:00:00 2001 From: vasilito Date: Mon, 3 Aug 2026 20:09:10 +0300 Subject: [PATCH] git: rebase the setup.c hunks onto 2.55.0 (patch still needs a full re-port) git.patch is written against git 2.13.1 (2017); the recipe fetches 2.55.0. The setup.c hunks were the first to fail, so the build stopped there. Rebased them. 2.55.0 rewrote sanitize_stdfds() to use xopen/xdup, which die internally, so the old die_errno hunk is obsolete and the rebase is smaller than the original: - xopen("/dev/null", O_RDWR) -> xopen(DEV_NULL, O_RDWR) - #if !defined(__redox__) around setsid() Both preserve the original Redox intent: scheme paths instead of /dev/null, and no setsid() on Redox. This does NOT make git build. With setup.c applying, the patch runs further and six more files turn out to have drifted over the same eight years: compat/bswap.h 1/1 hunk compat/terminal.c 1/1 configure 1/1 daemon.c 2/4 git-compat-util.h 1/2 Makefile 1/1 run-command.c 1/1 git-compat-util.h matters most: it is where DEV_NULL is defined, so the setup.c change above depends on that hunk being re-ported too. An eight-year, 2.13 -> 2.55 span is a re-port, not a hunk rebase, and PATCH-GOVERNANCE.md is explicit that the patch is rebased rather than dropped. Committing this piece so it is not lost and the remaining scope is written down. --- recipes/dev/git/git.patch | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/recipes/dev/git/git.patch b/recipes/dev/git/git.patch index 998bd9d6f7..ce9ae32162 100644 --- a/recipes/dev/git/git.patch +++ b/recipes/dev/git/git.patch @@ -210,30 +210,25 @@ 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); -diff -ruwN git-2.13.1/setup.c source/setup.c ---- git-2.13.1/setup.c 2017-06-05 08:08:11.000000000 +0700 -+++ source/setup.c 2025-09-01 04:41:10.339224568 +0700 -@@ -1146,11 +1146,11 @@ +diff -ruwN git-2.55.0/setup.c source/setup.c +--- git-2.55.0/setup.c ++++ source/setup.c +@@ -2176,7 +2176,7 @@ /* if any standard file descriptor is missing open it to /dev/null */ void sanitize_stdfds(void) { -- int fd = open("/dev/null", O_RDWR, 0); -+ int fd = open(DEV_NULL, O_RDWR, 0); - while (fd != -1 && fd < 2) - fd = dup(fd); - if (fd == -1) -- die_errno("open /dev/null or dup failed"); -+ die_errno("open %s or dup failed", DEV_NULL); +- int fd = xopen("/dev/null", O_RDWR); ++ int fd = xopen(DEV_NULL, O_RDWR); + while (fd < 2) + fd = xdup(fd); if (fd > 2) - close(fd); - } -@@ -1169,8 +1169,10 @@ - default: +@@ -2211,8 +2211,10 @@ + reassign_tempfile_ownership(parent_pid, child_pid); exit(0); } +#if !defined(__redox__) if (setsid() == -1) - die_errno("setsid failed"); + die_errno(_("setsid failed")); +#endif close(0); close(1);