From b0a1a393d63e23b011e57ccbaf3a58d749591b76 Mon Sep 17 00:00:00 2001
From: Emanuele Aina <emanuele.aina@collabora.com>
Date: Thu, 9 Dec 2021 00:10:13 +0100
Subject: [PATCH] Handle multi-line values when dumping the environment

If the value of a environment variable contains a newline, a naive
`sort` will mangle the output.

Use null-terminated chunks to handle newlines properly.

Signed-off-by: Emanuele Aina <emanuele.aina@collabora.com>
---
 gitlab-ci/update-test-binaries.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gitlab-ci/update-test-binaries.yaml b/gitlab-ci/update-test-binaries.yaml
index c182a34..e1b2a12 100644
--- a/gitlab-ci/update-test-binaries.yaml
+++ b/gitlab-ci/update-test-binaries.yaml
@@ -7,7 +7,7 @@
     GIT_PUSH_URL: https://${GITLAB_CI_USER}:${GITLAB_CI_PASSWORD}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git/
     REPOSITORY: $CI_PROJECT_NAME
   script:
-    - env | sort
+    - env --null | sort -z | tr '\0' '\n'
     - cd ..
     - test -d $REPOSITORY
     - wget ${CI_SERVER_URL}/tests/helper-tools/-/raw/${osname}/${release}/update_test_binaries.sh -O /tmp/update_test_binaries.sh
-- 
GitLab