Skip to contentSkip to conversation

bash: Set HEREDOC_PIPESIZE deterministically

PATCH New Richard Purdie 1 participant 3 messages Jan 7, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 bash: Set HEREDOC_PIPESIZE deterministically

We had reproducibility issues where the pipe size appears to vary on some build hosts between 65535 and 4096. It should be the former on Linux in general so standarise on that. Easiest way is to pass in CFLAGS.

---
 meta/recipes-extended/bash/bash.inc | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-extended/bash/bash.inc +3 -0
index feb7483dc34..b0281dadbc2 100644
@@ -15,6 +15,9 @@ INHIBIT_PRUNE_M4 = "1"
 # This is what other major distros do. And this is what we wanted. See bug#5359 and bug#7137.
 CFLAGS += "-DNON_INTERACTIVE_LOGIN_SHELLS"
 
+# This can vary depending upon the host
+CFLAGS += "-DHEREDOC_PIPESIZE=65536"
+
 ALTERNATIVE_${PN} = "bash sh"
 ALTERNATIVE_LINK_NAME[bash] = "${base_bindir}/bash"
 ALTERNATIVE_TARGET[bash] = "${base_bindir}/bash"
Signature · 1 line
2.27.0
#1 lore raw

PATCH 2/3 qemu: Fix mingw builds

After the recent upgrade, mingw builds failed. Add a hack whilst a solution is discussed upstream.

---
 meta/recipes-devtools/qemu/qemu.inc           |  1 +
 .../recipes-devtools/qemu/qemu/mingwfix.patch | 21 +++++++++++++++++++
 2 files changed, 22 insertions(+)
 create mode 100644 meta/recipes-devtools/qemu/qemu/mingwfix.patch
meta/recipes-devtools/qemu/qemu.inc +1 -0
index 4c1502da7f1..286901fb1f0 100644
@@ -26,6 +26,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
            file://0010-configure-Add-pkg-config-handling-for-libgcrypt.patch \
            file://0001-Add-enable-disable-udev.patch \
            file://0001-qemu-Do-not-include-file-if-not-exists.patch \
+           file://mingwfix.patch \
            "
 UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
 
meta/recipes-devtools/qemu/qemu/mingwfix.patch new file +21 -0
new file mode 100644
index 00000000000..8d76cef6388
@@ -0,0 +1,21 @@
+OE assumes that mingw files are in a unix like file layout. The
+'flattening' done by configure in qemu for mingw32 breaks things
+for us. We are discussing with upstream but for now, hack this to
+disable it and use the unix like layout everywhere.
+
+Signed-off-by: Richard Purdie <[email protected]>
+Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2021-01/msg01073.html]
+
+Index: qemu-5.2.0/configure
+===================================================================
+--- qemu-5.2.0.orig/configure
++++ qemu-5.2.0/configure
+@@ -1541,7 +1541,7 @@ libdir="${libdir:-$prefix/lib}"
+ libexecdir="${libexecdir:-$prefix/libexec}"
+ includedir="${includedir:-$prefix/include}"
+ 
+-if test "$mingw32" = "yes" ; then
++if test "$mingw32" = "dontwantthis" ; then
+     mandir="$prefix"
+     datadir="$prefix"
+     docdir="$prefix"
Signature · 1 line
2.27.0
#2 lore raw

PATCH 3/3 ppp: Fix reproducibility issue

In reply to Richard Purdie

Depending on which patches the make program has, the internal or external utmp could would be used. Add add a patch which avoids the issue and makes the build determnistic. We saw the regression on ubuntu1604.

---
 .../ppp/ppp/bashfix.patch                     | 38 +++++++++++++++++++
 meta/recipes-connectivity/ppp/ppp_2.4.9.bb    |  1 +
 2 files changed, 39 insertions(+)
 create mode 100644 meta/recipes-connectivity/ppp/ppp/bashfix.patch
meta/recipes-connectivity/ppp/ppp/bashfix.patch new file +38 -0
new file mode 100644
index 00000000000..d557fe1902f
@@ -0,0 +1,38 @@
+We were seeing reproducibility issues where one host would use the internal 
+logwtmp wrapper, another would use the one in libutil. The issue was that in
+some cases the "\#include" was making it to CC, in others, "#include". The
+issue seems to be related to shell escaping.
+
+The root cause looks to be:
+http://git.savannah.gnu.org/cgit/make.git/commit/?id=c6966b323811c37acedff05b576b907b06aea5f4
+
+Instead of relying on shell quoting, use make to indirect the variable
+and avoid the problem.
+
+Upstream-Status: Submitted [https://github.com/paulusmack/ppp/issues/233]
+Signed-off-by: Richard Purdie <[email protected]>
+
+Index: ppp-2.4.9/pppd/Makefile.linux
+===================================================================
+--- ppp-2.4.9.orig/pppd/Makefile.linux
++++ ppp-2.4.9/pppd/Makefile.linux
+@@ -80,7 +80,8 @@ PLUGIN=y
+ #USE_SRP=y
+ 
+ # Use libutil; test if logwtmp is declared in <utmp.h> to detect
+-ifeq ($(shell echo '\#include <utmp.h>' | $(CC) -E - 2>/dev/null | grep -q logwtmp && echo yes),yes)
++UTMPHEADER = "\#include <utmp.h>"
++ifeq ($(shell echo $(UTMPHEADER) | $(CC) -E - 2>/dev/null | grep -q logwtmp && echo yes),yes)
+ USE_LIBUTIL=y
+ endif
+ 
+@@ -143,7 +144,8 @@ CFLAGS   += -DHAS_SHADOW
+ #LIBS     += -lshadow $(LIBS)
+ endif
+ 
+-ifeq ($(shell echo '\#include <crypt.h>' | $(CC) -E - >/dev/null 2>&1 && echo yes),yes)
++CRYPTHEADER = "\#include <utmp.h>"
++ifeq ($(shell echo $(CRYPTHEADER) | $(CC) -E - >/dev/null 2>&1 && echo yes),yes)
+ CFLAGS  += -DHAVE_CRYPT_H=1
+ LIBS	+= -lcrypt
+ endif
meta/recipes-connectivity/ppp/ppp_2.4.9.bb +1 -0
index f05f40dd06f..72e7ae5e9db 100644
@@ -12,6 +12,7 @@ LIC_FILES_CHKSUM = "file://pppd/ccp.c;beginline=1;endline=29;md5=e2c43fe6e81ff77
                     file://chat/chat.c;beginline=1;endline=15;md5=0d374b8545ee5c62d7aff1acbd38add2"
 
 SRC_URI = "https://download.samba.org/pub/${BPN}/${BP}.tar.gz \
+           file://bashfix.patch \
            file://pon \
            file://poff \
            file://init \
Signature · 1 line
2.27.0