Kentzo / git-archive-all

A python script wrapper for git-archive that archives a git superproject and its submodules, if it has any. Takes into account .gitattributes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hangs forever with older git version (1.8.5)

benningm opened this issue · comments

git-archive-all uses the git check-attr command with -z options which did behave different before this commit:

git/git@f7cd8c5

git-archive-all expects the new behaviour and waits forever in the read on line 373.

Both RHEL/Centos 6 and 7 still use version <= 1.8.3.

Thanks for reporting. Would you be able to help with testing?

Please check version from the issue-65 branch.

Works on CentOS 6:

[root@ae62b49a33e1 git-archive-all]# cat /etc/redhat-release 
CentOS release 6.10 (Final)
[root@ae62b49a33e1 git-archive-all]# git --version
git version 1.7.1

On master branch:

[root@ae62b49a33e1 git-archive-all]# git show --oneline
c558c3c Add shield for Homebrew.
[root@ae62b49a33e1 git-archive-all]# ./git_archive_all.py bla.tar.gz
# aborting with ^C after some minutes...
^CTraceback (most recent call last):
  File "./git_archive_all.py", line 499, in <module>
    main()
  File "./git_archive_all.py", line 491, in main
    archiver.create(output_file_path, options.dry_run, compresslevel=options.compresslevel)
  File "./git_archive_all.py", line 195, in create
    self.archive_all_files(archiver)
  File "./git_archive_all.py", line 228, in archive_all_files
    for file_path in self.walk_git_files():
  File "./git_archive_all.py", line 264, in walk_git_files
    if self.is_file_excluded(repo_abspath, repo_file_path):
  File "./git_archive_all.py", line 214, in is_file_excluded
    attrs = self._check_attr_gens[repo_abspath].send(repo_file_path)
  File "./git_archive_all.py", line 400, in check_attr
    for path, attr, value in read_attrs(process, repo_file_path):
  File "./git_archive_all.py", line 373, in read_attrs
    b = process.stdout.read(1)
KeyboardInterrupt

With issue-65 branch:

[root@ae62b49a33e1 git-archive-all]# git checkout issue-65
Branch issue-65 set up to track remote branch issue-65 from origin.
Switched to a new branch 'issue-65'
[root@ae62b49a33e1 git-archive-all]# git log -1 --oneline
40de44f Fix reading attributes on Git < 1.8.5
[root@ae62b49a33e1 git-archive-all]# ./git_archive_all.py bla.tar.gz
[root@ae62b49a33e1 git-archive-all]# tar tzvf bla.tar.gz        
-rw-rw-r-- root/root       860 2018-11-27 09:57 bla/.appveyor.yml
-rw-rw-r-- root/root       122 2018-11-27 09:57 bla/.gitignore
-rw-rw-r-- root/root      4297 2018-11-27 09:57 bla/.travis.yml
-rw-r--r-- root/root      1612 2018-11-27 10:33 bla/CHANGES.rst
-rw-rw-r-- root/root      1063 2018-11-27 09:57 bla/LICENSE.txt
-rw-rw-r-- root/root        13 2018-11-27 09:57 bla/MANIFEST.in
-rw-rw-r-- root/root       385 2018-11-27 09:57 bla/Makefile
-rw-rw-r-- root/root      2419 2018-11-27 09:57 bla/README.rst
-rwxr-xr-x root/root     21328 2018-11-27 10:33 bla/git_archive_all.py
-rw-rw-r-- root/root       126 2018-11-27 09:57 bla/requirements.txt
-rw-rw-r-- root/root      1216 2018-11-27 09:57 bla/setup.cfg
-rw-rw-r-- root/root      1058 2018-11-27 09:57 bla/setup.py
-rw-rw-r-- root/root     12977 2018-11-27 09:57 bla/test_git_archive_all.py

With CentOS 7:

[root@dd68d8757a9d /]# cat /etc/redhat-release 
CentOS Linux release 7.5.1804 (Core) 
[root@dd68d8757a9d /]# git --version
git version 1.8.3.1

On master:

[root@dd68d8757a9d git-archive-all]# git show --oneline
c558c3c Add shield for Homebrew.
[root@dd68d8757a9d git-archive-all]# ./git_archive_all.py bla.tar.gz
^CTraceback (most recent call last):
  File "./git_archive_all.py", line 499, in <module>
    main()
  File "./git_archive_all.py", line 491, in main
    archiver.create(output_file_path, options.dry_run, compresslevel=options.compresslevel)
  File "./git_archive_all.py", line 195, in create
    self.archive_all_files(archiver)
  File "./git_archive_all.py", line 228, in archive_all_files
    for file_path in self.walk_git_files():
  File "./git_archive_all.py", line 264, in walk_git_files
    if self.is_file_excluded(repo_abspath, repo_file_path):
  File "./git_archive_all.py", line 214, in is_file_excluded
    attrs = self._check_attr_gens[repo_abspath].send(repo_file_path)
  File "./git_archive_all.py", line 400, in check_attr
    for path, attr, value in read_attrs(process, repo_file_path):
  File "./git_archive_all.py", line 373, in read_attrs
    b = process.stdout.read(1)
KeyboardInterrupt

On issue-65 branch:

[root@dd68d8757a9d git-archive-all]# git checkout issue-65
Switched to branch 'issue-65'
[root@dd68d8757a9d git-archive-all]# ./git_archive_all.py bla.tar.gz
[root@dd68d8757a9d git-archive-all]# tar tzvf bla.tar.gz 
-rw-rw-r-- 1000/1000       860 2018-11-27 09:57 bla/.appveyor.yml
-rw-rw-r-- 1000/1000       122 2018-11-27 09:57 bla/.gitignore
-rw-rw-r-- 1000/1000      4297 2018-11-27 09:57 bla/.travis.yml
-rw-r--r-- root/root      1612 2018-11-27 10:42 bla/CHANGES.rst
-rw-rw-r-- 1000/1000      1063 2018-11-27 09:57 bla/LICENSE.txt
-rw-rw-r-- 1000/1000        13 2018-11-27 09:57 bla/MANIFEST.in
-rw-rw-r-- 1000/1000       385 2018-11-27 09:57 bla/Makefile
-rw-rw-r-- 1000/1000      2419 2018-11-27 09:57 bla/README.rst
-rwxr-xr-x root/root     21328 2018-11-27 10:42 bla/git_archive_all.py
-rw-rw-r-- 1000/1000       126 2018-11-27 09:57 bla/requirements.txt
-rw-rw-r-- 1000/1000      1216 2018-11-27 09:57 bla/setup.cfg
-rw-rw-r-- 1000/1000      1058 2018-11-27 09:57 bla/setup.py
-rw-rw-r-- 1000/1000     12977 2018-11-27 09:57 bla/test_git_archive_all.py

On Debian with a v2 git client:

root@b62a05ae77c8:/git-archive-all# cat /etc/debian_version 
9.6
root@b62a05ae77c8:/git-archive-all# git --version
git version 2.11.0

On master:

root@b62a05ae77c8:/git-archive-all# git log --oneline -1
c558c3c Add shield for Homebrew.
root@b62a05ae77c8:/git-archive-all# ./git_archive_all.py bla.tar.gz
root@b62a05ae77c8:/git-archive-all# tar tzvf bla.tar.gz 
-rw-rw-r-- 1000/1000       860 2018-11-27 09:57 bla/.appveyor.yml
-rw-rw-r-- 1000/1000       122 2018-11-27 09:57 bla/.gitignore
-rw-rw-r-- 1000/1000      4297 2018-11-27 09:57 bla/.travis.yml
-rw-r--r-- root/root      1306 2018-11-27 10:47 bla/CHANGES.rst
-rw-rw-r-- 1000/1000      1063 2018-11-27 09:57 bla/LICENSE.txt
-rw-rw-r-- 1000/1000        13 2018-11-27 09:57 bla/MANIFEST.in
-rw-rw-r-- 1000/1000       385 2018-11-27 09:57 bla/Makefile
-rw-rw-r-- 1000/1000      2419 2018-11-27 09:57 bla/README.rst
-rwxr-xr-x root/root     18601 2018-11-27 10:47 bla/git_archive_all.py
-rw-rw-r-- 1000/1000       126 2018-11-27 09:57 bla/requirements.txt
-rw-rw-r-- 1000/1000      1216 2018-11-27 09:57 bla/setup.cfg
-rw-rw-r-- 1000/1000      1058 2018-11-27 09:57 bla/setup.py
-rw-rw-r-- 1000/1000     12977 2018-11-27 09:57 bla/test_git_archive_all.py

On issue-65 branch:

root@b62a05ae77c8:/git-archive-all# git log --oneline -1
40de44f Fix reading attributes on Git < 1.8.5
root@b62a05ae77c8:/git-archive-all# ./git_archive_all.py bla.tar.gz
root@b62a05ae77c8:/git-archive-all# tar tzvf bla.tar.gz 
-rw-rw-r-- 1000/1000       860 2018-11-27 09:57 bla/.appveyor.yml
-rw-rw-r-- 1000/1000       122 2018-11-27 09:57 bla/.gitignore
-rw-rw-r-- 1000/1000      4297 2018-11-27 09:57 bla/.travis.yml
-rw-r--r-- root/root      1612 2018-11-27 10:48 bla/CHANGES.rst
-rw-rw-r-- 1000/1000      1063 2018-11-27 09:57 bla/LICENSE.txt
-rw-rw-r-- 1000/1000        13 2018-11-27 09:57 bla/MANIFEST.in
-rw-rw-r-- 1000/1000       385 2018-11-27 09:57 bla/Makefile
-rw-rw-r-- 1000/1000      2419 2018-11-27 09:57 bla/README.rst
-rwxr-xr-x root/root     21328 2018-11-27 10:48 bla/git_archive_all.py
-rw-rw-r-- 1000/1000       126 2018-11-27 09:57 bla/requirements.txt
-rw-rw-r-- 1000/1000      1216 2018-11-27 09:57 bla/setup.cfg
-rw-rw-r-- 1000/1000      1058 2018-11-27 09:57 bla/setup.py
-rw-rw-r-- 1000/1000     12977 2018-11-27 09:57 bla/test_git_archive_all.py

Looks good. Many thanks!