#2 Don't modify the user's git config in %%prep (#1696417)
Closed 4 years ago by adamwill. Opened 4 years ago by tmz.
rpms/ tmz/dionaea master  into  master

file modified
+7 -4
@@ -3,7 +3,7 @@ 

  Summary:        Low interaction honeypot

  

  # Show as the RPM release number (keep same number line for tarball and git builds)

- %global         rel              5

+ %global         rel              6

  

  # Dionaea package is licensed with GPLv2

  # On top of that it is granting one exception extra - it is permitted by the license
@@ -48,7 +48,7 @@ 

  

  

  %if 0%{?build_release}  > 0

- Release:        %{rel}%{?dist}.1

+ Release:        %{rel}%{?dist}

  Source0:        https://github.com/%{gituser}/%{gitname}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz

  %else

  #               not using 0. on the beginning of release as this git snapshot is past the 0.6.0 release
@@ -236,8 +236,8 @@ 

  # Remove the .gitignore to prevent ignoring changes in some files

  rm -f .gitignore

  git init -q

- git config --global user.email "rpmbuild"

- git config --global user.name "rpmbuild"

+ git config user.email "rpmbuild"

+ git config user.name "rpmbuild"

  git add .

  git commit -a -m "base"

  
@@ -489,6 +489,9 @@ 

  

  

  %changelog

+ * Thu Apr 04 2019 Todd Zullinger <tmz@pobox.com> - 0.7.0-6

+ - Don't modify the user's git config in %%prep (#1696417)

+ 

  * Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0-5.1

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

  

Using 'git config --global' modified ~/.gitconfig rather than the
repository .git/config file.  Avoid changing the global config of the
user running a local build or just calling 'fedpkg prep' to unpack the
sources.

This is the minimal fix for the bug. It seems like a better fix would be to use the -S git option to %autosetup and let it initialize a git repo. Neither of the source tarballs from a release version or commit snapshot appear to have an included .git dir, so the steps to remove that and recreate it don't seem to be necessary. Even if there were a .git repo, you could use add -f to the git add . to add all files, regardless of any .gitignore files. That would also allow the rm -f .gitignore to be removed.

Whatever the eventual solution, dropping the --global should be done ASAP. It has already caused one commit to be written with the wrong author: 3e7a0d9 ("Disable -Werror to fix build (see upstream #225)", 2018-07-30).

The fix should be applied to the current fedora and epel7 branches as well. This is filed as bug 1696417.

I did this myself on all branches (noticed as my name was highlighted as the unfortunate who got bit by the bug) :) closing PR.

Pull-Request has been closed by adamwill

4 years ago

It seems like a better fix would be to use the -S git option to %autosetup and let it initialize a git repo. Neither of the source tarballs from a release version or commit snapshot appear to have an included .git dir, so the steps to remove that and recreate it don't seem to be necessary. Even if there were a .git repo, you could use add -f to the git add . to add all files, regardless of any .gitignore files. That would also allow the rm -f .gitignore to be removed.

In case the dionaea maintainers would like to test the route outlined above, here's a commit which implements it (lightly tested):

https://src.fedoraproject.org/fork/tmz/rpms/dionaea/c/2128f18?branch=simplify-git-prep