From: Bruno Haible Date: Mon, 8 Apr 2019 01:07:08 +0000 (+0200) Subject: autopoint: Don't risk failing because of user or system git configurations. X-Git-Tag: v0.20~68 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48caeb171a1cfff1a87193f98d3d82e80981edf8;p=thirdparty%2Fgettext.git autopoint: Don't risk failing because of user or system git configurations. Reported by Jamie Kirkpatrick in . * gettext-tools/misc/autopoint.in: Set/unset environment variables, so that git does not read the user's git configuration nor the system's git configuration. * gettext-tools/misc/convert-archive.in: Likewise. --- diff --git a/gettext-tools/misc/autopoint.in b/gettext-tools/misc/autopoint.in index 6122382fa..d872fd1cd 100644 --- a/gettext-tools/misc/autopoint.in +++ b/gettext-tools/misc/autopoint.in @@ -1,6 +1,6 @@ #! /bin/sh # -# Copyright (C) 2002-2018 Free Software Foundation, Inc. +# Copyright (C) 2002-2019 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -610,7 +610,12 @@ case "@ARCHIVE_FORMAT@" in (git --version) >/dev/null 2>/dev/null || func_fatal_error "git program not found" mkdir "$work_dir/archive" gzip -d -c < "$gettext_datadir/archive.git.tar.gz" | (cd "$work_dir/archive" && tar xf -) - (cd "$work_dir/archive" && git checkout -q "gettext-$ver") || { + (unset GIT_CONFIG + unset XDG_CONFIG_HOME + unset HOME + GIT_CONFIG_NOSYSTEM=1; export GIT_CONFIG_NOSYSTEM + cd "$work_dir/archive" && git checkout -q "gettext-$ver" + ) || { rm -rf "$work_dir" func_fatal_error "infrastructure files for version $ver not found; this is autopoint from GNU $package $version" } diff --git a/gettext-tools/misc/convert-archive.in b/gettext-tools/misc/convert-archive.in index ee63473bb..b5780bd91 100644 --- a/gettext-tools/misc/convert-archive.in +++ b/gettext-tools/misc/convert-archive.in @@ -1,6 +1,6 @@ #! /bin/sh # -# Copyright (C) 2009-2010, 2014, 2018 Free Software Foundation, Inc. +# Copyright (C) 2009-2010, 2014, 2018-2019 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -208,23 +208,27 @@ ba mkdir "$work_dir/master" || func_fatal_error "mkdir failed" gzip -d -c < "$fromfile" | (cd "$work_dir/master" && tar xf -) - cd "$work_dir" - tags=`cd master && git tag` - test -n "$tags" || func_fatal_error "no release tags found" - for tag in $tags; do - if test $tag != empty; then - version=$tag - (cd master && git checkout -q $tag) \ - || func_fatal_error "git checkout failed" - rm -f master/.gitignore - mv master/.git .git - mkdir "$unpacked/$version" || func_fatal_error "mkdir failed" - (cd master && tar cf - .) | (cd "$unpacked/$version" && tar xf -) \ - || func_fatal_error "file copy failed" - mv .git master/.git - fi - done - cd .. + (unset GIT_CONFIG + unset XDG_CONFIG_HOME + unset HOME + GIT_CONFIG_NOSYSTEM=1; export GIT_CONFIG_NOSYSTEM + cd "$work_dir" + tags=`cd master && git tag` + test -n "$tags" || func_fatal_error "no release tags found" + for tag in $tags; do + if test $tag != empty; then + version=$tag + (cd master && git checkout -q $tag) \ + || func_fatal_error "git checkout failed" + rm -f master/.gitignore + mv master/.git .git + mkdir "$unpacked/$version" || func_fatal_error "mkdir failed" + (cd master && tar cf - .) | (cd "$unpacked/$version" && tar xf -) \ + || func_fatal_error "file copy failed" + mv .git master/.git + fi + done + ) rm -rf "$work_dir" ;; esac @@ -320,6 +324,9 @@ case "$to" in git_dir=`pwd`/tmpgit$$ mkdir "$git_dir" || func_fatal_error "mkdir failed" unset GIT_CONFIG + unset XDG_CONFIG_HOME + unset HOME + GIT_CONFIG_NOSYSTEM=1; export GIT_CONFIG_NOSYSTEM (cd "$git_dir" && { git init -q git config user.name 'GNU Gettext Build'