threads / discuss / 4721

fc046a75d539a78e6b2c16534c4078617a69a327 fails on OpenBSD 3.8

Subject: fc046a75d539a78e6b2c16534c4078617a69a327 fails on OpenBSD 3.8

## tl;dr

6 messages between Jun 30, 2006 and Jun 30, 2006.

replies: 5people: 3as markdown or json

Randal L. Schwartz· Jun 30, 2006, 16:57 UTC · lore
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?
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <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!
Junio C Hamano· Jun 30, 2006, 17:06 UTC · re: Randal L. Schwartz · lore

Re: fc046a75d539a78e6b2c16534c4078617a69a327 fails on OpenBSD 3.8

merlyn@stonehenge.com (Randal L. Schwartz) writes:
Show 14 quoted 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
> /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?

Randal L. Schwartz· Jun 30, 2006, 17:09 UTC · re: Junio C Hamano · lore

Re: fc046a75d539a78e6b2c16534c4078617a69a327 fails on OpenBSD 3.8

>>>>> "Junio" == Junio C Hamano <junkio@cox.net> writes:
Junio> merlyn@stonehenge.com (Randal L. Schwartz) writes:
Show 14 quoted 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
>> /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?

>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. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <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!
Junio C Hamano· Jun 30, 2006, 17:38 UTC · re: Randal L. Schwartz · lore

Re: fc046a75d539a78e6b2c16534c4078617a69a327 fails on OpenBSD 3.8

merlyn@stonehenge.com (Randal L. Schwartz) writes:
Show 9 quoted lines
>>>>>> "Junio" == Junio C Hamano <junkio@cox.net> writes:
>...
>>> 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?

diff --git a/upload-pack.c b/upload-pack.c
index 2b70c3d..b18eb9b 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -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>";
 
Junio C Hamano· Jun 30, 2006, 18:30 UTC · re: Junio C Hamano · lore

[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.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 * 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?
diff --git a/upload-pack.c b/upload-pack.c
index 2b70c3d..b18eb9b 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -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>";
 
Jakub Narebski· Jun 30, 2006, 19:00 UTC · re: Junio C Hamano · lore

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

Junio C Hamano wrote:
> Try to work it around by including the system headers first.
Shouldn't it be always the case?
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

← back to recent threads