threads / patch / 45807

patchtravis-ci: printf $STATUS as string

Subject: [PATCH v1] travis-ci: printf $STATUS as string

## tl;dr

2 messages between Apr 26, 2017 and Apr 26, 2017. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Lars Schneider· Apr 26, 2017, 19:39 UTC · lore

If the $STATUS variable contains a "%" character then printf will interpret that as invalid format string. Fix this by formatting $STATUS as string.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
---
Notes:
    Base Ref: master
    Web-Diff: https://github.com/larsxschneider/git/commit/f08d4dc6a0
    Checkout: git fetch https://github.com/larsxschneider/git travisci/win-fix-v1 && git checkout f08d4dc6a0
 ci/run-windows-build.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to ci/run-windows-build.sh +1 −1
diff --git a/ci/run-windows-build.sh b/ci/run-windows-build.sh
index 4e3a50b60e..e043440799 100755
--- a/ci/run-windows-build.sh
+++ b/ci/run-windows-build.sh
@@ -55,7 +55,7 @@ while true
 do
 	LAST_STATUS=$STATUS
 	STATUS=$(gfwci "action=status&buildId=$BUILD_ID")
-	test "$STATUS" = "$LAST_STATUS" || printf "\nStatus: $STATUS "
+	test "$STATUS" = "$LAST_STATUS" || printf "\nStatus: %s " "$STATUS"
 	printf "."
 
 	case "$STATUS" in

base-commit: e2cb6ab84c94f147f1259260961513b40c36108a
-- 
2.12.2
Johannes Schindelin· Apr 26, 2017, 19:49 UTC · re: Lars Schneider · lore

Re: [PATCH v1] travis-ci: printf $STATUS as string

Hi,
On Wed, 26 Apr 2017, Lars Schneider wrote:
Show 5 quoted lines
> If the $STATUS variable contains a "%" character then printf will
> interpret that as invalid format string. Fix this by formatting $STATUS
> as string.
> 
> Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
ACK.

For reference, the status should always be a single all-ASCII word, but sometimes it looks as if there is a server error that returns a full-blown HTML error page (including a style that contains something like 'width: 10%;' which would be misinterpreted by printf as a format string).

Ciao, Dscho

← back to recent threads