]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
autopoint: Don't risk failing because of user or system git configurations.
authorBruno Haible <bruno@clisp.org>
Mon, 8 Apr 2019 01:07:08 +0000 (03:07 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 8 Apr 2019 01:09:38 +0000 (03:09 +0200)
Reported by Jamie Kirkpatrick <jkp@kirkconsulting.co.uk>
in <https://savannah.gnu.org/support/?107689>.

* 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.

gettext-tools/misc/autopoint.in
gettext-tools/misc/convert-archive.in

index 6122382fa3a55865a20e171e086e4245bd3a6e9a..d872fd1cd355ef6ebfd67c65d22063a85d9d3b4a 100644 (file)
@@ -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"
     }
index ee63473bbe6a2b8e7edcf0de7a575542d3426d1f..b5780bd91e86d605d74dc348f3619117cc9be0d4 100644 (file)
@@ -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'