-
Notifications
You must be signed in to change notification settings - Fork 140
ERANGE strikes again: RFH #498
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
Conversation
The incarnation of vsnprintf that I have to use requires our replacement from vsnprintf, because it returns -1 when the resulting string does not fit into the supplied buffer. An additional behavior is that it returns ERANGE when this overflow happens. There seem to be code paths in the Windows compatibility layer where a usable errno value is turned into ERANGE. A symptom is that in t0410-partial-clone.sh I observe ++ git -C repo fsck Checking object directories: 100% (256/256), done. Checking objects: 100% (1/1), done. fatal: failed to read object 3836707...snip...6591523: Result too large where the expected result is Checking object directories: 100% (256/256), done. Checking objects: 100% (1/1), done. dangling tag e5f4cb9fd329c512b08fb81a8e6b1f5e27658263 There are other cases where the wrong error happens as well: t0000-basic.sh t5310-pack-bitmaps.sh t5318-commit-graph.sh t5500-fetch-pack.sh t5616-partial-clone.sh t6050-replace.sh t6501-freshen-objects.sh Unfortunately, due to a lacking tool chain, I am unable to dig into the root cause of the problem. So, let's do the second best thing: ensure that errno is preserved across the compatibility vsnprintf. Signed-off-by: Johannes Sixt <[email protected]>
Welcome to GitGitGadgetHi @j6t, and welcome to GitGitGadget, the GitHub App to send patch series to the Git mailing list from GitHub Pull Requests. Please make sure that this Pull Request has a good description, as it will be used as cover letter. Also, it is a good idea to review the commit messages one last time, as the Git project expects them in a quite specific form:
It is in general a good idea to await the automated test ("Checks") in this Pull Request before contributing the patches, e.g. to avoid trivial issues such as unportable code. Contributing the patchesBefore you can contribute the patches, your GitHub username needs to be added to the list of permitted users. Any already-permitted user can do that, by adding a comment to your PR of the form Both the person who commented An alternative is the channel
Once on the list of permitted usernames, you can contribute the patches to the Git mailing list by adding a PR comment After you submit, GitGitGadget will respond with another comment that contains the link to the cover letter mail in the Git mailing list archive. Please make sure to monitor the discussion in that thread and to address comments and suggestions. If you want to see what email(s) would be sent for a submit request, add a PR comment If you do not want to subscribe to the Git mailing list just to be able to respond to a mail, you can download the mbox ("raw") file corresponding to the mail you want to reply to from the Git mailing list. If you use GMail, you can upload that raw mbox file via: curl -g --user "<EMailAddress>:<Password>" --url "imaps://imap.gmail.com/INBOX" -T /path/to/raw.txt Need help?New contributors who want advice are encouraged to join [email protected], where volunteers who regularly contribute to Git are willing to answer newbie questions, give advice, or otherwise provide mentoring to interested contributors. You must join in order to post or view messages, but anyone can join. You may also be able to find help in real time in the developer IRC channel, |
/allow |
User j6t is now allowed to use GitGitGadget. WARNING: j6t has no public email address set on GitHub |
I retract this patch for now. I have asked the mailing list to clarify whether restoration of |
I have to build with SNPRINTF_RETURNS_BOGUS. We know already that compat/snprintf overwrites errno with ERANGE in the case where a too small buffer is passed to the function.
I observe failures such as this one in t0410-partial-clone.sh:
++ git -C repo fsck
Checking object directories: 100% (256/256), done.
Checking objects: 100% (1/1), done.
fatal: failed to read object 3836707...snip...6591523: Result too large
The messages is from read_object_file_extended() in sha1-file.c.
It looks like we call into strbuf after a lower-level error return,
but before the error is checked. Does someone know where this
could happen?
The reason I'm asking is that today's tool chain is sufficiently broken for me
on Windows that I can't use the debugger. A hint where to start debugging
with fprintf would be helpful.