Bug 1963954 - feeding unmodified [...] to diffcore, while `git status` is empty
Summary: feeding unmodified [...] to diffcore, while `git status` is empty
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: GitPython
Version: 34
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lubomír Sedlář
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-05-24 13:18 UTC by Pavel Raiskup
Modified: 2021-05-31 09:00 UTC (History)
20 users (show)

Fixed In Version: GitPython-3.1.14-2.fc35
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-05-31 09:00:21 UTC
Type: Bug


Attachments (Terms of Use)

Description Pavel Raiskup 2021-05-24 13:18:51 UTC
Upon "fedpkg import" of specific source RPM, I'm getting this:

$ git checkout f34
error: feeding unmodified get-calendar-langpacks.sh to diffcore
error: feeding unmodified node-stdout-nonblocking-wrapper to diffcore
Switched to branch 'f34'
Your branch is up to date with 'origin/f34'.

While git status doesn't tell me anything useful.

When I do 'git stash', errors are not printed anymore - but the stash
instance is empty:

$ git stash
error: feeding unmodified get-calendar-langpacks.sh to diffcore
error: feeding unmodified get-calendar-langpacks.sh to diffcore
Saved working directory and index state WIP on main: 000fed9 done
$ git checkout f34
Switched to branch 'f34'
Your branch is up to date with 'origin/f34'.
$ git stash show
(empty, no output)

Component: git-2.31.1-3.fc34.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. wget https://copr-be.cloud.fedoraproject.org/issue-1700/thunderbird-78.8.1-1.fc35.src.rpm
2. fedpkg clone -a thunderbird && cd thunderbird
3. fedpkg import ../thunderbird-78.8.1-1.fc35.src.rpm --offline --skip-diff
4. git commit -m "done"
5. git checkout f34

Actual results:
error: feeding unmodified get-calendar-langpacks.sh to diffcore
error: feeding unmodified node-stdout-nonblocking-wrapper to diffcore
Switched to branch 'f34'
Your branch is up to date with 'origin/f34'.

Expected results:
No errors.

Additional info:
This is probably causing some Copr DistGit import failures.

Comment 1 Pavel Raiskup 2021-05-24 13:22:04 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

Comment 2 Todd Zullinger 2021-05-24 15:28:29 UTC
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.

Comment 3 Todd Zullinger 2021-05-24 17:36:37 UTC
(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.

Comment 4 Todd Zullinger 2021-05-24 17:58:40 UTC
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.

Comment 5 Todd Zullinger 2021-05-24 22:02:43 UTC
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

Comment 6 Pavel Raiskup 2021-05-25 05:53:30 UTC
Your patch fixes copr/issue/1700, thank you Todd!

Comment 7 Todd Zullinger 2021-05-27 14:44:00 UTC
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.

Comment 8 Fedora Update System 2021-05-31 08:57:32 UTC
FEDORA-2021-e9f199eb7c has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2021-e9f199eb7c

Comment 9 Fedora Update System 2021-05-31 09:00:21 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.