Skip to content

index: preserve extension parsing errors#4858

Merged
ethomson merged 1 commit into
libgit2:masterfrom
tiennou:fix/index-ext-read
Jan 25, 2019
Merged

index: preserve extension parsing errors#4858
ethomson merged 1 commit into
libgit2:masterfrom
tiennou:fix/index-ext-read

Conversation

@tiennou

@tiennou tiennou commented Oct 22, 2018

Copy link
Copy Markdown
Contributor

Previously, we would clobber any extension-specific error message with an "extension is truncated" message. This makes read_extension correctly preserve those errors, takes responsibility for truncation errors, and adds a new message with the actual extension signature for unsupported mandatory extensions.

Inspired by #4857.

@ethomson

Copy link
Copy Markdown
Member

The index changes look good to me - (the tests are failing on Linux though).

@tiennou

tiennou commented Oct 23, 2018

Copy link
Copy Markdown
Contributor Author

I'm not sure why though. It seems the "splitindex" test repo I added isn't there ? If that makes any sense ?

Wait, the macOS build should be red as well, the test is failing there (at 16957).

@ethomson

Copy link
Copy Markdown
Member

Wait, the macOS build should be red as well, the test is failing there (at 16957).

Ugh, it certainly is. I think the hoops that I had to jump through to get leaks to play nicely (it wants to background itself but keep some file descriptors open 😡) must not have worked right. Sigh.

It's already very brittle (if you can't convince it to close that last file descriptor then it will just never exit and hang the builds), so I think I may have to disable leaks until I can make it more stable.

@tiennou

tiennou commented Oct 23, 2018

Copy link
Copy Markdown
Contributor Author

/rebuild

@libgit2-azure-pipelines

Copy link
Copy Markdown

Okay, @tiennou, I started to rebuild this pull request.

@tiennou

tiennou commented Oct 23, 2018

Copy link
Copy Markdown
Contributor Author

I'm really confused by CI here, I can run that new testcase using the new test resource locally and I get a successful run, but CI fails because the resource is missing. Also, I suspect the Windows also has a problem with considering the build green while it failed…

@tiennou

tiennou commented Jan 11, 2019

Copy link
Copy Markdown
Contributor Author

Rebased, was hoping to get CI to play nice but it still doesn't want to play along. I feel like I'm missing something, as I can't see anything wrong with the testcase setup…

@ethomson

ethomson commented Jan 21, 2019

Copy link
Copy Markdown
Member

Rebased, was hoping to get CI to play nice but it still doesn't want to play along. I feel like I'm missing something, as I can't see anything wrong with the testcase setup…

This has happened to me before, and to troubleshoot I'll often clone a new version of the repository and check out my PR branch.

I'm not positive, but I suspect that your tests/resources/splitindex/.gitted directory contains an empty objects and refs directory. You can't check these in, of course, so they're not part of the test resource. And lacking those two folders means that we don't think that it's a real git repository.

I think that if you create some empty files to preserve the objects and refs directory (like you'd see in tests/resources/empty_bare.git) then you'll be 👍.

diff --git a/tests/resources/splitindex/.gitted/objects/info/dummy-marker.txt b/tests/resources/splitindex/.gitted/objects/info/dummy-marker.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/tests/resources/splitindex/.gitted/objects/pack/dummy-marker.txt b/tests/resources/splitindex/.gitted/objects/pack/dummy-marker.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/tests/resources/splitindex/.gitted/refs/heads/dummy-marker.txt b/tests/resources/splitindex/.gitted/refs/heads/dummy-marker.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/tests/resources/splitindex/.gitted/refs/tags/dummy-marker.txt b/tests/resources/splitindex/.gitted/refs/tags/dummy-marker.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391

(For what it's worth, if you create branches in libgit2/libgit2 instead of your fork, I or another maintainer could push up a fix into your branch and then merge it.)

@tiennou tiennou force-pushed the fix/index-ext-read branch from 00f17de to 4271c6b Compare January 21, 2019 11:18
@tiennou

tiennou commented Jan 21, 2019

Copy link
Copy Markdown
Contributor Author

OMG I've been wrangling with the repository open code and it didn't register that there were missing directories… Thanks for the pointer @ethomson, I've now rebased it with some .gitkeep files, and will take a note that a nicer validity message would be ❤️.

@tiennou

tiennou commented Jan 21, 2019

Copy link
Copy Markdown
Contributor Author

(For what it's worth, if you create branches in libgit2/libgit2 instead of your fork, I or another maintainer could push up a fix into your branch and then merge it.)

I don't think I have the permissions to do that (and I'm kinda evading doing that, because I'm a rebase-junkie and I like to keep it separated). I also was under the impression that it's only dependent on whether "Allow edit from maintainers" being checked ?

BTW, kudos for the Git Advent series, especially the one about fetching PRs 😉.

@ethomson

Copy link
Copy Markdown
Member

I don't think I have the permissions to do that (and I'm kinda evading doing that, because I'm a rebase-junkie and I like to keep it separated). I also was under the impression that it's only dependent on whether "Allow edit from maintainers" being checked ?

My workflow in ethomson/foo branches is to rebase also, so I wouldn't feel bad about that. I'm not in front of my normal computer right now but we should get you these permissions. Whether you choose to use them will remain up to you. (It would make my life the tiniest bit easier, since I wouldn't have to set up your fork as a remote to fetch your PRs and build them locally, but that's not yet so common that I'm going to encourage you strongly to change your behavior.)

Comment thread src/index.c Outdated
@ethomson

Copy link
Copy Markdown
Member

I'm 👍 on this. @tiennou let me know if you want to make that change that @pks-t pointed out. If not, we can go ahead and merge this. If so, I'll hold off.

@tiennou tiennou force-pushed the fix/index-ext-read branch from 4271c6b to 4138c0d Compare January 23, 2019 21:10
@tiennou

tiennou commented Jan 23, 2019

Copy link
Copy Markdown
Contributor Author

Rebased, with style-fix applied. Thanks for the review!

@pks-t pks-t left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's now two semantic conflicts due to #4917

Comment thread src/index.c Outdated
Comment thread tests/index/splitindex.c Outdated
@tiennou tiennou force-pushed the fix/index-ext-read branch from 4138c0d to 4ccb301 Compare January 24, 2019 11:04
Previously, we would clobber any extension-specific error message with
an "extension is truncated" message. This makes `read_extension`
correctly preserve those errors, takes responsibility for truncation
errors, and adds a new message with the actual extension signature for
unsupported mandatory extensions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants