git/list[1] front-page[2] threads[3] people[4] search[5] about
 

uname check fails on Solaris due to different return value

From
JKJakub Kulik <jakub.kulik@oracle.com>
Date
Nov 12, 2026, 15:52 UTC
Message-ID
<SJ0PR10MB578540903B4931FFD985580C8A702@SJ0PR10MB5785.namprd10.prod.outlook.com>
Hi, I encountered one more minor Solaris failure.
On Solaris, uname syscall returns non-negative value on success and -1 on failure [1], which is different from seemingly all other supported platforms, which return 0 on success (and still -1 on failure). As such, the current check in version.c doesn't work on Solaris.
I managed to fix this with:

--- git-2.56.0/version.c +++ git-2.56.0/version.c

@@ -83,7 +83,7 @@ int get_uname_info(struct strbuf *buf, u
 {
 	struct utsname uname_info;
 
-	if (uname(&uname_info)) {
+	if (uname(&uname_info) < 0) {
 		strbuf_addf(buf, _("uname() failed with error '%s' (%d)\n"),
 			    strerror(errno),
 			    errno);


which *I think* should work on other platforms as well ([2]), but I might be missing some where this change wouldn't work. Still, I wanted to at least report this.

Thanks and Best regards,
Jakub

[1] https://docs.oracle.com/cd/E88353_01/html/E37841/uname-2.html
    https://smartos.org/man/2/uname
[2] https://pubs.opengroup.org/onlinepubs/009604599/functions/uname.html
Next: Junio C Hamano
Message 1 of 4 in “uname check fails on Solaris due to different return value”
  1. Jakub KulikNov 12, 2026
  2. Junio C HamanoNov 12, 2026
  3. version: accept positive uname(2) return valuesJakub Kulik, Nov 18, 2026
  4. Junio C HamanoNov 18, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.