configure: set SED to gsed (MacOS et al) or sed (GNU).
What changed, and why it matters
This commit changes the project's build configuration script so it picks the correct version of the 'sed' text-editing tool. On macOS it will prefer 'gsed' (the GNU version), and on Linux it will use the standard 'sed'. This is a build-system portability fix, not a security patch. It does not fix a vulnerability or change any runtime code that handles money, network messages, or cryptography.
No security action required. Treat as a normal build-system portability improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The configure script now calls a new default_sed() helper that probes for a sed implementation supporting GNU extensions (tested by checking whether ‘s/x/\t/’ produces a literal tab). It prefers ‘gsed’ then falls back to ‘sed’, and exports the chosen binary as the SED variable. This addresses portability issues on macOS/BSD where the default sed lacks GNU-specific syntax used elsewhere in the build. No source code, protocol handling, or cryptographic logic is modified.
Changed components
configure (build configuration script)Inspect captured patch +21 / −0
diff --git a/configure b/configure
index 7375b3d4..10ab1762 100755
--- a/configure
+++ b/configure
@@ -82,6 +82,24 @@ default_python()
done
}
+# We want GNU sed, which, among other things, recognizes '\t'.
+# We don't want to get confused with some random program called gsed,
+# so we actually test.
+default_sed()
+{
+ SED_BINS="gsed sed"
+ for s in $SED_BINS; do
+ if [ "$(which $s)" != "" ] ; then
+ if [ "$(printf x | $s 's/x/\t/')" = " " ]; then
+ echo "$s"
+ return
+ fi
+ fi
+ done
+ echo "No valid sed found?" >&2
+ exit 1
+}
+
# Takes PYTHON var
default_pytest()
{
@@ -184,6 +202,7 @@ set_defaults()
fi
echo CSANFLAGS = $CSANFLAGS
PYTHON=${PYTHON-$(default_python)}
+ SED=${SED-$(default_sed)}
PYTEST=${PYTEST-$(default_pytest $PYTHON)}
COPTFLAGS=${COPTFLAGS-$(default_coptflags "$DEBUGBUILD")}
CONFIGURATOR_CC=${CONFIGURATOR_CC-$CC}
@@ -212,6 +231,7 @@ usage()
echo " To override compile line for configurator itself"
usage_with_default "PYTEST" "$PYTEST"
usage_with_default "VALGRIND" "$VALGRIND"
+ usage_with_default "SED" "$SED"
echo "Options include:"
usage_with_default "--prefix=" "$PREFIX"
@@ -554,6 +574,7 @@ add_var SHA256SUM "$SHA256SUM"
add_var FUZZING "$FUZZING"
add_var RUST "$RUST"
add_var PYTHON "$PYTHON"
+add_var SED "$SED"
# Hack to avoid sha256 name clash with libwally: will be fixed when that
# becomes a standalone shared lib.
Why this scored 20/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.