From 9b748d07af1d4e9223f12e54991675cafec083e4 Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Wed, 31 Jul 2024 02:50:33 +0300 Subject: [PATCH] Mock - compatibility fix for shell calls echo does not seem to have escape mode with GH actions runner --- tests/host/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/host/Makefile b/tests/host/Makefile index 7308b10e60..97a4c671fb 100644 --- a/tests/host/Makefile +++ b/tests/host/Makefile @@ -71,8 +71,8 @@ $(shell mkdir -p $(BINDIR)) # Core files sometimes override libc functions, check when necessary to hide them # TODO proper configure script / other build system? ifeq (,$(wildcard $(BINDIR)/.have_strlcpy)) -$(shell echo -e '#include \nint main(){char a[4]{}; char b[4]{}; strlcpy(&a[0], &b[0], sizeof(a)); return 0;}' | \ - $(CXX) -x c++ - -o $(BINDIR)/.have_strlcpy 2>/dev/null || ( echo -e '#!/bin/sh\nexit 1' > $(BINDIR)/.have_strlcpy ; chmod +x $(BINDIR)/.have_strlcpy; )) +$(shell printf '#include \nint main(){char a[4]{}; char b[4]{}; strlcpy(&a[0], &b[0], sizeof(a)); return 0;}\n' | \ + $(CXX) -x c++ - -o $(BINDIR)/.have_strlcpy 2>/dev/null || ( printf '#!/bin/sh\nexit 1\n' > $(BINDIR)/.have_strlcpy ; chmod +x $(BINDIR)/.have_strlcpy; )) endif $(shell $(BINDIR)/.have_strlcpy) @@ -81,8 +81,8 @@ FLAGS += -DSTRLCPY_MISSING endif ifeq (,$(wildcard $(BINDIR)/.have_strlcat)) -$(shell echo -e '#include \nint main(){char a[4]{}; strlcat(&a[0], "test", sizeof(a)); return 0;}' | \ - $(CXX) -x c++ - -o $(BINDIR)/.have_strlcat 2>/dev/null || ( echo -e '#!/bin/sh\nexit 1' > $(BINDIR)/.have_strlcat ; chmod +x $(BINDIR)/.have_strlcat; )) +$(shell printf '#include \nint main(){char a[4]{}; strlcat(&a[0], "test", sizeof(a)); return 0;}\n' | \ + $(CXX) -x c++ - -o $(BINDIR)/.have_strlcat 2>/dev/null || ( printf '#!/bin/sh\nexit 1\n' > $(BINDIR)/.have_strlcat ; chmod +x $(BINDIR)/.have_strlcat; )) endif $(shell $(BINDIR)/.have_strlcat)