Bug 1963954
| Summary: | feeding unmodified [...] to diffcore, while `git status` is empty | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Pavel Raiskup <praiskup> |
| Component: | GitPython | Assignee: | Lubomír Sedlář <lsedlar> |
| Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 34 | CC: | amahdal, athoscribeiro, besser82, chrisw, cqi, dennis, dgoodwin, igor.raits, jkeating, johannes, kevin, lsedlar, onosek, opohorel, pcahyna, pstodulk, puiterwijk, sebastian.kisela, s, tmz |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | GitPython-3.1.14-2.fc35 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-05-31 09:00:21 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Pavel Raiskup
2021-05-24 13:18:51 UTC
Note that I filled this as git issue mostly because I can not easily tell what is going on here. It may be a bug in 'fedpkg import', though git should give me an useful hint (not an empty output from 'git status'). FTR, the Copr bug report is here: https://pagure.io/copr/copr/issue/1700 This looks just like an ancient bug in GitPython:
https://github.com/gitpython-developers/GitPython/issues/430
The files in question have mode 0700 in the SRPM. When they are imported by fedpkg, they are added to the git index with the wrong mode:
$ fedpkg import ../thunderbird-78.8.1-1.fc35.src.rpm --offline --skip-diff
$ ll get-calendar-langpacks.sh node-stdout-nonblocking-wrapper
-rwx------. 1 tmz tmz 3.5K May 24 11:05 get-calendar-langpacks.sh
-rwx------. 1 tmz tmz 47 May 24 11:05 node-stdout-nonblocking-wrapper
$ rpm -qplv ../thunderbird-78.8.1-1.fc35.src.rpm |& grep -- -rwx------
-rwx------ 1 jhorak jhorak 3553 Nov 12 2019 get-calendar-langpacks.sh
-rwx------ 1 jhorak jhorak 47 Nov 12 2019 node-stdout-nonblocking-wrapper
$ git ls-files -s | egrep -v '644|755'
100744 854cae2f8a1a10673fa4e13d57d14b93849a8c2d 0 get-calendar-langpacks.sh
100744 b2814b8d40392ffe76c24d7676c91a353a23b76a 0 node-stdout-nonblocking-wrapper
The modes for those files should end in 644 or 755, not 744. Something (GitPython, I suspect) is setting the modes incorrectly which leads git to evaluate them again.
I'm going to re-assign this to fedpkg, though it likely will get further re-assigned to rpkg or (more likely) GitPython. I think the fedpkg/rpkg folks will be able to create a reproducer for this to show that it's a GitPython issue.
(In reply to Todd Zullinger from comment #2) > I think the fedpkg/rpkg > folks will be able to create a reproducer > for this to show that it's a > GitPython issue. I was curious, so here's a trivial reproduction recipe with only GitPython: $ git init -q /tmp/git-test; cd /tmp/git-test ; touch foo ; chmod 700 foo $ python -c 'import git; repo = git.Repo(); repo.index.add(["foo"])' $ git ls-files -s 100744 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 foo I'll re-assign to (hopefully) save the fedpkg/rpkg maintainers a little time. Essentially, the upstream fix for https://github.com/gitpython-developers/GitPython/issues/430 does not properly handle a mode of 0700. I handles 0600, 0644, and 0755. It mishandles (most) other modes. The code for this is in `stat_mode_to_index_mode()` (https://github.com/gitpython-developers/GitPython/blob/eae0e37c88a71a3b8ca816b820eed71fd1590f11/git/index/fun.py#L118). Running it directly shows the broken mode it returns: $ python -c 'import os; from stat import S_IFREG; st = os.lstat("foo"); print(oct(S_IFREG | 0o644 | (st.st_mode & 0o111)))' 0o100744 If the mode of foo is most anything other than 0644, 0600, or 0755 the code returns an index mode which is not either 0644 or 0755. I filed an issue and submitted a fix upstream:
https://github.com/gitpython-developers/GitPython/issues/1253
https://github.com/gitpython-developers/GitPython/pull/1254
Your patch fixes copr/issue/1700, thank you Todd! Thanks for testing and confirming Pavel. I filed https://src.fedoraproject.org/rpms/GitPython/pull-request/5 to apply this to the GitPython rawhide branch. I'm not familiar enough with the changes from 3.1.11 (f33) and 3.1.13 (f34) to know if it's reasonable to update those branches to 3.1.14 which is in rawhide. It looks like it should be alright, but I'll leave that to the maintainers to determine. FEDORA-2021-e9f199eb7c has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2021-e9f199eb7c FEDORA-2021-e9f199eb7c has been pushed to the Fedora 35 stable repository. If problem still persists, please make note of it in this bug report. |