git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* ERANGE strikes again on my Windows build; RFH
@ 2019-12-28 15:41 Johannes Sixt
  2019-12-29 14:29 ` Torsten Bögershausen
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Johannes Sixt @ 2019-12-28 15:41 UTC (permalink / raw)
  To: Git Mailing List

In sha1-file.c:read_object_file_extended() we have the following pattern:

	errno = 0;
	data = read_object(r, repl, type, size);
	if (data)
		return data;

	if (errno && errno != ENOENT)
		die_errno(_("failed to read object %s"), oid_to_hex(oid));

That is, it is expected that read_object() does not change the value of
errno in the non-error case. I find it intriguing that we expect a quite
large call graph that is behind read_object() to behave this way.

What if a subordinate callee starts doing

	if (some_syscall(...) < 0) {
		if (errno == EEXIST) {
			/* never mind, that's OK */
			...
		}
	}

Would it be required to reset errno to its previous value in this
failure-is-not-an-error case?

The problem in my Windows build is that one of these subordinate
syscalls is vsnprintf() (as part of a strbuf_add variant, I presume),
and it fails with ERANGE when the buffer is too short. Do I have to
modify the vsnprintf emulation to restore errno?

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-01-05 15:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-28 15:41 ERANGE strikes again on my Windows build; RFH Johannes Sixt
2019-12-29 14:29 ` Torsten Bögershausen
2019-12-29 14:43   ` Andreas Schwab
2019-12-29 17:25   ` Alban Gruin
2019-12-29 18:08     ` Johannes Sixt
2019-12-30 17:42 ` Junio C Hamano
2019-12-30 18:06 ` Jonathan Nieder
2019-12-30 18:46   ` Johannes Sixt
2019-12-30 18:49     ` Jonathan Nieder
2020-01-05 15:27       ` Michal Suchánek

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).