Skip to contentSkip to conversation

fc046a75d539a78e6b2c16534c4078617a69a327 fails on OpenBSD 3.8

DISCUSSION Randal L. Schwartz 3 participants 6 messages Jun 15, 2016 – Aug 11, 2016

lore
Share & tools
lore
#0 lore raw

gcc -o upload-pack.o -c -g -O2 -Wall -I/usr/local/include -DSHA1_HEADER='<openssl/sha.h>' -DNO_STRCASESTR upload-pack.c In file included from /usr/include/sys/poll.h:54,
from upload-pack.c:9:
/usr/include/ctype.h:67: error: syntax error before ']' token
/usr/include/ctype.h:68: error: syntax error before ']' token
/usr/include/ctype.h:70: error: syntax error before ']' token
/usr/include/ctype.h:75: error: syntax error before ']' token
/usr/include/ctype.h:78: error: syntax error before '(' token
/usr/include/ctype.h:79: error: syntax error before '(' token
/usr/include/ctype.h:93: error: syntax error before "c"
In file included from /usr/include/sys/poll.h:54,
from upload-pack.c:9:
/usr/include/ctype.h:91:1: unterminated #if
/usr/include/ctype.h:40:1: unterminated #ifndef
In file included from upload-pack.c:9:
/usr/include/sys/poll.h:53:1: unterminated #ifndef
/usr/include/sys/poll.h:28:1: unterminated #ifndef
gmake: *** [upload-pack.o] Error 1

The lines in ctype.h that are probably relevant are:

    #if defined(__GNUC__) || defined(_ANSI_LIBRARY) || defined(lint)
    int	isalnum(int);
    int	isalpha(int);
    int	iscntrl(int);
    int	isdigit(int);
    int	isgraph(int);
    int	islower(int);
    int	isprint(int);
    int	ispunct(int);
    int	isspace(int);
    int	isupper(int);
    int	isxdigit(int);
    int	tolower(int);
    int	toupper(int);

Line 67 is "int isalnum(int)"

Are you defining a macro when you shouldn't be in upload-pack?

Signature · 4 lines
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[email protected]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
#2 lore raw
In reply to Junio C Hamano
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Junio" == Junio C Hamano <[email protected]> writes:

Quoted 6 lines · Junio> [email protected] (Randal L. Schwartz) writes:
Quoted 6 lines

gcc -o upload-pack.o -c -g -O2 -Wall -I/usr/local/include -DSHA1_HEADER='<openssl/sha.h>' -DNO_STRCASESTR upload-pack.c In file included from /usr/include/sys/poll.h:54,
from upload-pack.c:9:
/usr/include/ctype.h:67: error: syntax error before ']' token
/usr/include/ctype.h:68: error: syntax error before ']' token
/usr/include/ctype.h:70: error: syntax error before ']' token

Quoted 8 lines
Quoted 8 lines

/usr/include/ctype.h:75: error: syntax error before ']' token /usr/include/ctype.h:78: error: syntax error before '(' token /usr/include/ctype.h:79: error: syntax error before '(' token /usr/include/ctype.h:93: error: syntax error before "c" In file included from /usr/include/sys/poll.h:54, from upload-pack.c:9:
/usr/include/ctype.h:91:1: unterminated #if /usr/include/ctype.h:40:1: unterminated #ifndef

Junio> Crap. Including <sys/poll.h> pollutes your namespace with ctype Junio> macros?

Quoted 1 line

From /usr/include/sys/poll.h:

    #ifndef _KERNEL
    #include <ctype.h>

So, I guess, it's ... Yes.

This sounds familiar. Maybe the mailing list archive has me reporting this bug last time too. :)

Signature · 4 lines
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[email protected]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
#3 lore raw
Quoted 9 lines · [email protected] (Randal L. Schwartz) writes:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Junio" == Junio C Hamano <[email protected]> writes:

...

Quoted 4 lines
Quoted 4 lines

In file included from /usr/include/sys/poll.h:54,
from upload-pack.c:9:
/usr/include/ctype.h:91:1: unterminated #if
/usr/include/ctype.h:40:1: unterminated #ifndef

Junio> Crap. Including <sys/poll.h> pollutes your namespace with ctype Junio> macros?

I should stop imitating others -- not my style. Sorry. Would this work for you?

upload-pack.c +3 -3
index 2b70c3d..b18eb9b 100644
@@ -1,3 +1,6 @@
+#include <signal.h>
+#include <sys/wait.h>
+#include <sys/poll.h>
 #include "cache.h"
 #include "refs.h"
 #include "pkt-line.h"
@@ -5,9 +8,6 @@ #include "tag.h"
 #include "object.h"
 #include "commit.h"
 #include "exec_cmd.h"
-#include <signal.h>
-#include <sys/poll.h>
-#include <sys/wait.h>
 
 static const char upload_pack_usage[] = "git-upload-pack [--strict] [--timeout=nn] <dir>";
 
#4 lore raw

[PATCH/RFT] upload-pack.c: <sys/poll.h> includes <ctype.h> on OpenBSD 3.8

Merlyn reports that <sys/poll.h> on OpenBSD 3.8 includes <ctype.h> and having our custom ctype (done in git-compat-util.h which is included via cache.h) makes upload-pack.c uncompilable. Try to work it around by including the system headers first.

---

* Can somebody with OpenBSD who can reproduce the original problem confirm or reject this patch, so that the issue can be resolved before 1.4.1, please?

upload-pack.c +3 -3
index 2b70c3d..b18eb9b 100644
@@ -1,3 +1,6 @@
+#include <signal.h>
+#include <sys/wait.h>
+#include <sys/poll.h>
 #include "cache.h"
 #include "refs.h"
 #include "pkt-line.h"
@@ -5,9 +8,6 @@ #include "tag.h"
 #include "object.h"
 #include "commit.h"
 #include "exec_cmd.h"
-#include <signal.h>
-#include <sys/poll.h>
-#include <sys/wait.h>
 
 static const char upload_pack_usage[] = "git-upload-pack [--strict] [--timeout=nn] <dir>";
 
#5 lore raw

Re: [PATCH/RFT] upload-pack.c: <sys/poll.h> includes <ctype.h> on OpenBSD 3.8

Quoted 1 line · Junio C Hamano

Try to work it around by including the system headers first.

Shouldn't it be always the case?

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#1 lore raw
In reply to Randal L. Schwartz
Quoted 6 lines · [email protected] (Randal L. Schwartz) writes:

gcc -o upload-pack.o -c -g -O2 -Wall -I/usr/local/include -DSHA1_HEADER='<openssl/sha.h>' -DNO_STRCASESTR upload-pack.c In file included from /usr/include/sys/poll.h:54,
from upload-pack.c:9:
/usr/include/ctype.h:67: error: syntax error before ']' token
/usr/include/ctype.h:68: error: syntax error before ']' token
/usr/include/ctype.h:70: error: syntax error before ']' token

Quoted 8 lines

/usr/include/ctype.h:75: error: syntax error before ']' token /usr/include/ctype.h:78: error: syntax error before '(' token /usr/include/ctype.h:79: error: syntax error before '(' token /usr/include/ctype.h:93: error: syntax error before "c" In file included from /usr/include/sys/poll.h:54,
from upload-pack.c:9:
/usr/include/ctype.h:91:1: unterminated #if /usr/include/ctype.h:40:1: unterminated #ifndef

Crap. Including <sys/poll.h> pollutes your namespace with ctype macros?