Bug#838198: 9base: FTBFS on hurd-i386: fatal error:can't create y.tab.h, :1

2016-09-18 Thread Ola Ekström
I missed that one, can't say I understand it's purpose in the source
tree if it's not referenced. I'm not familiar with sam or 9P, I've
only used 9base to run the werc web framework on lighttpd.

> 2016-09-18 11:54 GMT+00:00 Kalle Olavi Niemitalo :
>> sam/_libc.h has:
>>
>> OREAD = 0,
>> OWRITE = 1,
>> ORDWR = 2,
>> OCEXEC = 4,
>>
>> but it looks like nothing #includes that file, so perhaps that
>> doesn't have to be patched.  Have you tested sam on the Hurd?
>>
>> If these flags are sent in the Topen and Tcreate requests of the
>> 9P protocol, then changing their values breaks compatibility
>> between network hosts that run different implementations.
>> Do the Debian packages support that protocol?



Bug#838198: 9base: FTBFS on hurd-i386: fatal error:can't create y.tab.h, :1

2016-09-18 Thread Kalle Olavi Niemitalo
sam/_libc.h has:

OREAD = 0,
OWRITE = 1,
ORDWR = 2,
OCEXEC = 4,

but it looks like nothing #includes that file, so perhaps that
doesn't have to be patched.  Have you tested sam on the Hurd?

If these flags are sent in the Topen and Tcreate requests of the
9P protocol, then changing their values breaks compatibility
between network hosts that run different implementations.
Do the Debian packages support that protocol?



Bug#838198: 9base: FTBFS on hurd-i386: fatal error:can't create y.tab.h, :1

2016-09-18 Thread Ola Ekström
Package: 9base
Severity: important
Version: 1:6-7
Tags: patch
User: debian-h...@lists.debian.org
Usertags: hurd
X-Debbugs-CC: debian-h...@lists.debian.org

The package fails to build on hurd-i386 because of incorrect values
supplied to fopen() and missing (__GNU__)-defines.

Failing build log:
https://buildd.debian.org/status/package.php?p=9base=sid

The supplied patch fixes this.

TODO: Write a Hurd-specific disksize()-function in lib9/_p9dir.c

Cheers,
Ola Ekström
diff -rupN 9base-6-original/lib9/date.c 9base-6-new/lib9/date.c
--- 9base-6-original/lib9/date.c	2010-06-04 10:46:05.0 +
+++ 9base-6-new/lib9/date.c	2016-09-17 06:11:07.0 +
@@ -8,7 +8,7 @@
 #define _HAVETMZONE 1
 #define _HAVETMTZOFF 1
 
-#if defined(__linux__)
+#if defined(__linux__) || defined(__GNU__)
 #	undef _HAVETMZONE
 #	undef _HAVETMTZOFF
 
diff -rupN 9base-6-original/lib9/dirfwstat.c 9base-6-new/lib9/dirfwstat.c
--- 9base-6-original/lib9/dirfwstat.c	2010-06-04 10:46:05.0 +
+++ 9base-6-new/lib9/dirfwstat.c	2016-09-17 06:11:54.0 +
@@ -4,7 +4,7 @@
 #include 
 #include 
 
-#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__OpenBSD__) || defined(__linux__)
+#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__OpenBSD__) || defined(__linux__) || defined(__GNU__)
 /* do nothing -- futimes exists and is fine */
 
 #elif defined(__SunOS5_9__)
diff -rupN 9base-6-original/lib9/dirread.c 9base-6-new/lib9/dirread.c
--- 9base-6-original/lib9/dirread.c	2010-06-04 10:46:05.0 +
+++ 9base-6-new/lib9/dirread.c	2016-09-17 06:07:55.0 +
@@ -6,7 +6,7 @@
 
 extern int _p9dir(struct stat*, struct stat*, char*, Dir*, char**, char*);
 
-#if defined(__linux__) || defined(__FreeBSD_kernel__)
+#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
 static int
 mygetdents(int fd, struct dirent *buf, int n)
 {
diff -rupN 9base-6-original/lib9/libc.h 9base-6-new/lib9/libc.h
--- 9base-6-original/lib9/libc.h	2010-06-04 10:46:05.0 +
+++ 9base-6-new/lib9/libc.h	2016-09-17 21:04:11.0 +
@@ -594,10 +594,17 @@ extern	void		freenetconninfo(NetConnInfo
 #define	MCACHE	0x0010	/* cache some data */
 #define	MMASK	0x0017	/* all bits on */
 
-#define	OREAD	0	/* open for read */
-#define	OWRITE	1	/* write */
-#define	ORDWR	2	/* read and write */
-#define	OEXEC	3	/* execute, == read but check execute permission */
+#if defined(__GNU__)
+ #define	OREAD	O_RDONLY	/* open for read */
+ #define	OWRITE	O_WRONLY	/* write */
+ #define	ORDWR	O_RDWR		/* read and write */
+ #define	OEXEC	O_EXEC		/* execute, == read but check execute permission */
+#else
+ #define	OREAD	0	/* open for read */
+ #define	OWRITE	1	/* write */
+ #define	ORDWR	2	/* read and write */
+ #define	OEXEC	3	/* execute, == read but check execute permission */
+#endif
 #define	OTRUNC	16	/* or'ed in (except for exec), truncate file first */
 #define	OCEXEC	32	/* or'ed in, close on exec */
 #define	ORCLOSE	64	/* or'ed in, remove on close */
diff -rupN 9base-6-original/lib9/u.h 9base-6-new/lib9/u.h
--- 9base-6-original/lib9/u.h	2010-06-04 10:46:05.0 +
+++ 9base-6-new/lib9/u.h	2016-09-17 06:09:40.0 +
@@ -58,7 +58,7 @@ extern "C" {
 
 typedef long p9jmp_buf[sizeof(sigjmp_buf)/sizeof(long)];
 
-#if defined(__linux__)
+#if defined(__linux__) || defined(__GNU__)
 #	include 
 #	if defined(__Linux26__)
 #		include