Skip to content

another parsing failure of malformed author/committer timestamp #1322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yuja opened this issue Mar 16, 2024 · 2 comments · Fixed by #1323
Closed

another parsing failure of malformed author/committer timestamp #1322

yuja opened this issue Mar 16, 2024 · 2 comments · Fixed by #1323
Labels
acknowledged an issue is accepted as shortcoming to be fixed

Comments

@yuja
Copy link
Contributor

yuja commented Mar 16, 2024

Current behavior 😯

gix fails to parse the following commit because the timezone is invalid:
rails/rails@4cf9497

% git cat-file -p 4cf94979c9f4d6683c9338d694d5eb3106a4e734
tree 7989dfb2ec2f41914611a22fb30bbc2b3849df9a
parent 8845ae683e2688bc619baade49510c17e978518f
author Vijay Dev <[email protected]> 1312735823 +051800
committer Vijay Dev <[email protected]> 1312735823 +051800

edit changelog to mention about x_sendfile_header default change%

Expected behavior 🤔

I have no idea what's the most reasonable behavior. On one hand, the current behavior is correct because the commit object is malformed. On the other hand, it's often useful to get lossy parsing output because author/committer metadata isn't so important compared to tree/parent hashes.

This is similar to #950.

Git behavior

git show works (maybe because it doesn't parse the timestamp strictly?)

git fsck reports the error.

% git fsck
Checking object directories: 100% (256/256), done.
error in commit 4cf94979c9f4d6683c9338d694d5eb3106a4e734: badTimezone: invalid author/committer line - bad time zone
...

Steps to reproduce 🕹

No response

@martinvonz
Copy link
Contributor

According to gitpython-developers/GitPython#741 (which you commented on, @Byron :)), jGit falls back to UTC. That seems reasonable to me.

@Byron
Copy link
Member

Byron commented Mar 17, 2024

Thanks for digging up this gem from 6 years ago… will I ever learn ;)?

I plan to fix this tomorrow similar to how it's done in GitPython, even though I will double-check to see what happens in Git. The fix will then be released right away as well.

@Byron Byron added the acknowledged an issue is accepted as shortcoming to be fixed label Mar 17, 2024
@Byron Byron mentioned this issue Mar 17, 2024
5 tasks
Byron added a commit that referenced this issue Mar 18, 2024
That way this won't fail, but *just* silently degenerates information.

The idea is that during FSCK, objects should be decoded and then
re-encoded to see if they are still the same. If not, this means
some leniency kicked in.

Maybe for FSCK, there would also have to be a refactor so there
is a lenient and strict parsing mode. One problem at a time.
Byron added a commit that referenced this issue Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged an issue is accepted as shortcoming to be fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants