From 2fcc3f86c084887c7435e2daa02d8496c7cce6dd Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Sun, 26 Aug 2018 06:29:58 +0200 Subject: [PATCH] Introduce environment variable UPX_DISABLE_GITREV_WARNING. --- .github/travis_testsuite_1.sh | 1 + src/main.cpp | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/travis_testsuite_1.sh b/.github/travis_testsuite_1.sh index 58d79f9f..758329f1 100644 --- a/.github/travis_testsuite_1.sh +++ b/.github/travis_testsuite_1.sh @@ -168,6 +168,7 @@ if [[ $BM_B =~ (^|\+)coverage($|\+) ]]; then fi export UPX="--prefer-ucl --no-color --no-progress" +export UPX_DISABLE_GITREV_WARNING=1 # let's go if ! $upx_run --version; then echo "UPX-ERROR: FATAL: upx --version FAILED"; exit 1; fi diff --git a/src/main.cpp b/src/main.cpp index c4c79077..b5c64f45 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1540,11 +1540,18 @@ int __acc_cdecl_main main(int argc, char *argv[]) if (gitrev[0]) { - FILE *f = stdout; - int fg = con_fg(f,FG_RED); - con_fprintf(f,"\nWARNING: this is an unstable beta version - use for testing only! Really.\n"); - fg = con_fg(f,fg); - UNUSED(fg); + bool warn = true; + const char *ee = getenv("UPX_DISABLE_GITREV_WARNING"); + if (ee && ee[0] && strcmp(ee, "1") == 0) + warn = false; + if (warn) + { + FILE *f = stdout; + int fg = con_fg(f, FG_RED); + con_fprintf(f, "\nWARNING: this is an unstable beta version - use for testing only! Really.\n"); + fg = con_fg(f, fg); + UNUSED(fg); + } } #if 0 && defined(__GLIBC__)