Re: git can't read file

Top Page
Attachments:
Message as email
+ (text/plain)
+ signature.asc (application/pgp-signature)
+ (text/plain)
Delete this message
Reply to this message
Author: Joseph Sinclair via PLUG-discuss
Date:  
To: der.hans, Joseph Sinclair via PLUG-discuss
CC: Joseph Sinclair
Subject: Re: git can't read file
Inline responses.

On 2022-11-24 01:28 AM, der.hans wrote:
> Am 03. Nov, 2022 schwätzte Joseph Sinclair via PLUG-discuss so:
>
> moin moin,
>
> Thanks for the response. I ran out of time before SeaGL to work this
> issue.
>
> Finally able to get back to it.
>
>> First step is remove the git.log file, run git gc, and see if the error
>> returns. The missing file issue can be transient, but can also be a
>> case of file corruption; often due to using a remote filesystem that has
>> synchronization issues (e.g. SMB).
>
> I did this backwards and ran git gc first, then deleted the file, then ran
> git gc again. Still getting an error.
>
> ----
> :) $ LANG=en_US git gc
> Enumerating objects: 84147, done.
> Counting objects: 100% (84147/84147), done.
> Delta compression using up to 24 threads
> Compressing objects: 100% (39727/39727), done.
> fatal: unable to read 68eb6d43932bb63c600911ef6592a522d6eda333
> fatal: failed to run repack
> :( 128 $ cat .git/gc.log error: pack-objects died of signal 11
> fatal: failed to run repack
> :) $ ----
>
>> If the error returns after removing the log file and rerunning git gc,
>> then you can look for that file in the .git folder structure and see if
>> there's a filesystem lock, file permission issue, or something similar
>> blocking git from reading and modifying the file.
>
> Do you mean look at the objects file?


Each file in the objects folders is an item (file, typically) in the repo. The filename in objects is a hash.
The files are a differential format. You might check permissions (ls -l) and extended attributes (lsattr/chattr) on that file to see why git doesn't like that file.

>
> I'd gotten an error earlier pointing to an object file.
>
> ----
> Komprimiere Objekte: 100% (39706/39706), fertig.
> error: inflate: data stream error (incorrect data check)
> error: Fehlerhaftes loses Objekt
> 'c3e7ea989038d655ba08765acad29d2110f845de'.
> fatal: Loses Objekt c3e7ea989038d655ba08765acad29d2110f845de (gespeichert
> in .git/objects/c3/e7ea989038d655ba08765acad29d2110f845de) ist beschädigt.
> fatal: failed to run repack
> ----


This is a different error (different object) from the earlier error. This time, instead of a file it cannot read, git is trying to rebuild the structure, and is finding a file with an invalid gzip encoding (usually resultant from a partial success on some earlier process, or failure reading from a remote filesystem)
From the look of things, something is messed up in that particular object file. You might check which "real" file it represents, copy the (likely binary) file out of the repo, git rm the file, rerun git gc, then re-add the file to git.
If re-adding doesn't clear it up, perhaps push the repo to a different folder, remove this clone, then re-clone from the other folder (or, if you already have a remote, just push to the remote, remove the local, then re-clone from remote). Sometimes that will clean up issues that don't respond to git gc.

Side note, git doesn't like binary files much. It can handle them, but most git errors I see are related to binary files. Also, don't ever run git on a remote filesystem, particularly samba (not sure if you are here, just noting this in passing); git operations seem to make remote filesystems very unhappy, and even a slight blip in filesystem driver can absolutely wreck the git repo structure. I've seen a simple git fetch on a samba mount generate a few thousand samba error files, and utterly destroy the git repo (requiring a re-clone).


>
> ----
> :) $ pigz -d
> <.git/objects/c3/e7ea989038d655ba08765acad29d2110f845de | strings | head
> -20
> blob 333043117
> webmB
> t@=M
> Lavf58.20.100WA
> Lavf58.20.100D
> V_VP8
> A_OPUSV
> OpusHead
> COMMENTD
> {"t": "v", "c": "vp8", "s": 1615733905219805, "u": 1615733905231922}g
> ENCODERD
> Lavf58.20.100ss
> ENCODERD
> Lavc58.35.100 libvpxss
> COMMENTD
> {"t": "a", "c": "opus", "s": 1615733905219703, "u": 1615733905220216}ss
> DURATIOND
> 00:58:53.000000000
> DURATIOND
> 00:58:52.994000000
> :) $ ----
>
> OpesHead along with ENCODERD and DURATIOND make me think this is for an
> audio or video file.
>
> Perhaps the webmB indicates the type :).
>
> Is e7ea989038d655ba08765acad29d2110f845de the checksum of a file? If so,
> how do I determine which file?
>
> Seemingly, I can still check new work in, but I keep getting an error.
>
> ciao,
>
> der.hans
>
>> On 2022-11-03 03:42 PM, der.hans via PLUG-discuss wrote:
>>> moin moin,
>>>
>>> I tried to get the error in English.
>>>
>>> ----
>>> $ LANG=en_US git add Infos.adoc
>>> $ LANG=en_US git commit Infos.adoc -m 'Infos zur Vortraege'
>>> Auto packing the repository in background for optimum performance.
>>> See "git help gc" for manual housekeeping.
>>> warning: The last gc run reported the following. Please correct the root
>>> cause
>>> and remove .git/gc.log.
>>> Automatic cleanup will not be performed until the file is removed.
>>>
>>> fatal: kann 68eb6d43932bb63c600911ef6592a522d6eda333 nicht lesen
>>> fatal: failed to run repack
>>>
>>> [master 783813fb6] Infos zur Vortraege
>>> 1 file changed, 47 insertions(+)
>>> create mode 100644 Commerz/Fachpr???sentation/2022/Tux-Tage/Infos.adoc
>>> $
>>> ----
>>>
>>> fatal: can't read 68eb6d43932bb63c600911ef6592a522d6eda333
>>>
>>> Any suggestions on how to find what that file is?
>>>
>>> What I'm finding online make it seem like that might have been a temporary
>>> file that git cleaned up, but git didn't say anything about cleaning up a
>>> file.
>>>
>>> Those error lines are in .git/gc.log and the hasn't changed in a few hours
>>> despite new commits. Is git just kicking those out to me no matter what
>>> because they're in the gc.log file? Do I just need to remove that and see
>>> if the problem goes away?
>>>
>>> ----
>>> $ cat
>>> .git/gc.log
>>> fatal: kann 68eb6d43932bb63c600911ef6592a522d6eda333 nicht lesen
>>> fatal: failed to run repack
>>> $
>>> ----
>>>
>>> ciao,
>>>
>>> der.hans
>>>
>>>
>>> ---------------------------------------------------
>>> PLUG-discuss mailing list:
>>> To subscribe, unsubscribe, or to change your mail settings:
>>> https://lists.phxlinux.org/mailman/listinfo/plug-discuss
>>>
>>
>>
>


---------------------------------------------------
PLUG-discuss mailing list:
To subscribe, unsubscribe, or to change your mail settings:
https://lists.phxlinux.org/mailman/listinfo/plug-discuss