Hello, I just started another attempt to port dillo to Irix. With gcc 4.7 it compiles without any serious warnings. It starts and about:splash shows up correctly, But if you want to use it something goes wrong: ftp works without problems. files show up if the path is very short (less than 32 bytes). If you browse directories and you want to change from /tmp to /tmp/x for example. I changes to /x http doesn't work at all. If you go to a non existing url. For example: http://test.yy you get the following console output, but nothing happens in the dollo window: Nav_open_url: new url='http:test.yy' a_Capi_ccc : OpStart [2B] Info=10262fa8 Flags=0 a_Dpi_ccc : OpStart [2B] Info=10262da0 Flags=0 a_IO_ccc : OpStart [2B] Info=10262e90 Flags=0 a_Capi_ccc : OpStart [1B] Info=10262eb8 Flags=0 a_Http_ccc : OpStart [1B] Info=10262f80 Flags=0 a_IO_ccc : OpStart [1B] Info=10262e40 Flags=0 Http_must_use_proxy: http:test.yy NO DNS error: HOST_NOT_FOUND Dns_server [0]: is (nil) a_IO_ccc : OpAbort [1B] Info=10262e40 Flags=0 a_Capi_ccc : OpAbort [1F] Info=10262eb8 Flags=0 a_Capi_ccc : OpAbort [2B] Info=10262fa8 Flags=0 a_Dpi_ccc : OpAbort [2B] Info=10262da0 Flags=0 a_IO_ccc : OpAbort [2B] Info=10262e90 Flags=0 If you are opening an existing url like dillo.org it puts out: Nav_open_url: new url='http://www.dillo.org/' a_Capi_ccc : OpStart [2B] Info=10262fd0 Flags=0 a_Dpi_ccc : OpStart [2B] Info=10262f08 Flags=0 a_IO_ccc : OpStart [2B] Info=10262e68 Flags=0 a_Capi_ccc : OpStart [1B] Info=10262ee0 Flags=0 a_Http_ccc : OpStart [1B] Info=10262e90 Flags=0 a_IO_ccc : OpStart [1B] Info=10262f30 Flags=0 Http_must_use_proxy: http://www.dillo.org/ NO Dns_server [0]: www.dillo.org is 85.214.105.140 Connecting to 85.214.105.140 a_IO_ccc : OpSend [1B] Info=10262f30 Flags=0 a_Capi_ccc : OpSend [1F] Info=10262ee0 Flags=0 a_Capi_ccc : OpSend [2B] Info=10262fd0 Flags=0 a_Dpi_ccc : OpSend [2B] Info=10262f08 Flags=0 a_IO_ccc : OpSend [2B] Info=10262e68 Flags=0 http, referer='Referer: http://www.dillo.org/ ' Query: {GE} a_IO_ccc : OpSend [1B] Info=10262f30 Flags=0 and after some seconds: a_IO_ccc : OpEnd [2F] Info=10262e68 Flags=0 a_Dpi_ccc : OpEnd [2F] Info=10262f08 Flags=0 a_Capi_ccc : OpEnd [2F] Info=10262fd0 Flags=0 a_Capi_ccc : OpEnd [1B] Info=10262ee0 Flags=0 a_Http_ccc : OpEnd [1B] Info=10262e90 Flags=0 a_IO_ccc : OpEnd [1B] Info=10262f30 Flags=0 but nothing happens in the dillo window. I would be very happy to get any hint what is going wrong here. Thanks you, Jan
I wrote:
Jan wrote:
eocene wrote:
Jan wrote:
Query: {GE} a_IO_ccc : OpSend [1B] Info=10262f30 Flags=0
"GE" is the entire query?
Yes exactly. Any idea?
Can you watch what goes wrong in a_Http_make_query_str()?
Between this and the file path thing, I wonder whether irix doesn't like that va_list/va_copy/vsnprintf stuff in the dStr code in dlib/dlib.c.
eocene wrote:
I wrote:
Jan wrote:
eocene wrote:
Jan wrote:
Query: {GE} a_IO_ccc : OpSend [1B] Info=10262f30 Flags=0 "GE" is the entire query? Yes exactly. Any idea? Can you watch what goes wrong in a_Http_make_query_str()?
Between this and the file path thing, I wonder whether irix doesn't like that va_list/va_copy/vsnprintf stuff in the dStr code in dlib/dlib.c.
I had a brief look at the dlib code. I don't think it's a problem with the va stuff. I have one warning when compiling dlib.c: /usr/nekoware/gcc-4.7/bin/gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I/usr/local/include -I/usr/nekoware/include -I/usr/nekoware/gcc-4.7/include/c++/4.7.1 -I/usr/local/include -mtune=r5000 -mips4 -mabi=n32 -DD_DNS_THREADED -D_REENTRANT -D_THREAD_SAFE -Wall -W -Wno-unused-parameter -Waggregate-return -MT dlib.o -MD -MP -MF .deps/dlib.Tpo -c -o dlib.o dlib.c dlib.c: In function 'dStr_printable': dlib.c:514:7: warning: array subscript has type 'char' [-Wchar-subscripts] mv -f .deps/dlib.Tpo .deps/dlib.Po rm -f libDlib.a ar cru libDlib.a dlib.o : libDlib.a This is the line: if (isprint(in->str[i]) || (in->str[i] == '\n')) { isprintf is defined in Irix extern int isprint(int);
Jan wrote:
I had a brief look at the dlib code. I don't think it's a problem with the va stuff. I have one warning when compiling dlib.c:
/usr/nekoware/gcc-4.7/bin/gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I/usr/local/include -I/usr/nekoware/include -I/usr/nekoware/gcc-4.7/include/c++/4.7.1 -I/usr/local/include -mtune=r5000 -mips4 -mabi=n32 -DD_DNS_THREADED -D_REENTRANT -D_THREAD_SAFE -Wall -W -Wno-unused-parameter -Waggregate-return -MT dlib.o -MD -MP -MF .deps/dlib.Tpo -c -o dlib.o dlib.c dlib.c: In function 'dStr_printable': dlib.c:514:7: warning: array subscript has type 'char' [-Wchar-subscripts] mv -f .deps/dlib.Tpo .deps/dlib.Po rm -f libDlib.a ar cru libDlib.a dlib.o : libDlib.a
This is the line:
if (isprint(in->str[i]) || (in->str[i] == '\n')) {
isprintf is defined in Irix
extern int isprint(int);
The subscript 'i'?
eocene wrote:
Jan wrote:
I had a brief look at the dlib code. I don't think it's a problem with the va stuff. I have one warning when compiling dlib.c:
/usr/nekoware/gcc-4.7/bin/gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I/usr/local/include -I/usr/nekoware/include -I/usr/nekoware/gcc-4.7/include/c++/4.7.1 -I/usr/local/include -mtune=r5000 -mips4 -mabi=n32 -DD_DNS_THREADED -D_REENTRANT -D_THREAD_SAFE -Wall -W -Wno-unused-parameter -Waggregate-return -MT dlib.o -MD -MP -MF .deps/dlib.Tpo -c -o dlib.o dlib.c dlib.c: In function 'dStr_printable': dlib.c:514:7: warning: array subscript has type 'char' [-Wchar-subscripts] mv -f .deps/dlib.Tpo .deps/dlib.Po rm -f libDlib.a ar cru libDlib.a dlib.o : libDlib.a
This is the line:
if (isprint(in->str[i]) || (in->str[i] == '\n')) {
isprintf is defined in Irix
extern int isprint(int);
The subscript 'i'?
int i; it's defined in the function dStr_printable: /* * Return a printable representation of the provided Dstr, limited to a length * of roughly maxlen. * * This is NOT threadsafe. */ const char *dStr_printable(Dstr *in, int maxlen) { int i; static const char *const HEX = "0123456789ABCDEF"; static Dstr *out = NULL; if (in == NULL) return NULL; if (out) dStr_truncate(out, 0); else out = dStr_sized_new(in->len); for (i = 0; (i < in->len) && (out->len < maxlen); ++i) { if (isprint(in->str[i]) || (in->str[i] == '\n')) { dStr_append_c(out, in->str[i]); } else { dStr_append_l(out, "\\x", 2); dStr_append_c(out, HEX[(in->str[i] >> 4) & 15]); dStr_append_c(out, HEX[in->str[i] & 15]); } } if (out->len >= maxlen) dStr_append(out, "..."); return out->str; }
Back in April, I wrote:
I wrote:
Jan wrote:
eocene wrote:
Jan wrote:
Query: {GE} a_IO_ccc : OpSend [1B] Info=10262f30 Flags=0
"GE" is the entire query?
Yes exactly. Any idea?
Can you watch what goes wrong in a_Http_make_query_str()?
Between this and the file path thing, I wonder whether irix doesn't like that va_list/va_copy/vsnprintf stuff in the dStr code in dlib/dlib.c.
It did turn out to be irix's idea of vsnprintf(). Modifying dStr_vsprintfa(), I browsed around for a few minutes without problems. Now to look into how to solve this properly...
In the typical vsnprintf() (i.e., following the c99 standard), if you have space for 10 bytes and you want to write 20 bytes (including '\0'), you return 19, whereas irix returns 9. Some options: 1. It's possible to make irix and the standard run with a change like diff -r 5f63e28334b2 dlib/dlib.c --- a/dlib/dlib.c Tue Sep 16 00:21:49 2014 +0000 +++ b/dlib/dlib.c Tue Sep 16 04:59:20 2014 +0000 @@ -406,11 +406,11 @@ va_copy(argp2, argp); n = vsnprintf(ds->str + ds->len, ds->sz - ds->len, format, argp2); va_end(argp2); - if (n > -1 && n < ds->sz - ds->len) { + if (n > -1 && n+1 < ds->sz - ds->len) { ds->len += n; /* Success! */ break; } else if (n > -1) { /* glibc >= 2.1 */ - n_sz = ds->len + n + 1; + n_sz = ds->len + n + 2; } else { /* old glibc */ n_sz = ds->sz * 2; } ...although it would need tweaking to waste less running time. But of course even if dillo is partly about retrocomputing, it'll be 99% linux+bsd retrocomputing and 1% other-stuff retrocomputing, so... 2. Throw an ifdef at it. Dillo has never had many ifdefs, and I'd thought they were discouraged, but maybe the changes needed for all of that stuff at the bottom of Compatibility.html like SGI O2 running IRIX Tru64 (OSF1) 4.0 on Alpha QNX RTP 6.1/x86 (with occasional memory faults out of GTK+) AIX 4.3 (with some tweaks) Atari-based 68k-systems running MiNT Microsoft Windows using Cygwin RISC OS ...just didn't make it back into mainline dillo1? 3. We could always borrow fltk's vsnprintf(), which is about 250 lines. I lean toward giving it an ifdef. -------------- Extra verbiage: Autoconf's manual says: The C99 standard says that if the output array isn't big enough and if no other errors occur, snprintf and vsnprintf truncate the output and return the number of bytes that ought to have been produced. Some older systems return the truncated length (e.g., GNU C Library 2.0.x or IRIX 6.5), some a negative value (e.g., earlier GNU C Library versions), and some the buffer length without truncation (e.g., 32-bit Solaris 7). Also, some buggy older systems ignore the length and overrun the buffer (e.g., 64-bit Solaris 7). glibc-2.1: 1999 solaris 7: 1998 irix 6.5: major release 1998 regular minor releases until 2005 "The last version of IRIX was 6.5.30, released in August 2006."
eocene wrote:
1. It's possible to make irix and the standard run with a change like
dilo 3.0.4 works fine with your pach on Irix. Thank you very much for your help!
I lean toward giving it an ifdef.
I would also be happy to maintain a patch for Irix dillo. In this case you should make some notes in the README file.
Jan wrote:
eocene wrote:
1. It's possible to make irix and the standard run with a change like
dilo 3.0.4 works fine with your pach on Irix. Thank you very much for your help!
It would also be nice to deal with the other issues if possible. - You said you had to comment out a setenv, iirc? - I had to fix up src/Makefile in a small way which maybe could be avoided.
On Tue, Sep 16, 2014 at 06:29:27AM +0000, eocene wrote:
In the typical vsnprintf() (i.e., following the c99 standard), if you have space for 10 bytes and you want to write 20 bytes (including '\0'), you return 19, whereas irix returns 9.
Some options:
1. It's possible to make irix and the standard run with a change like
diff -r 5f63e28334b2 dlib/dlib.c --- a/dlib/dlib.c Tue Sep 16 00:21:49 2014 +0000 +++ b/dlib/dlib.c Tue Sep 16 04:59:20 2014 +0000 @@ -406,11 +406,11 @@ va_copy(argp2, argp); n = vsnprintf(ds->str + ds->len, ds->sz - ds->len, format, argp2); va_end(argp2); - if (n > -1 && n < ds->sz - ds->len) { + if (n > -1 && n+1 < ds->sz - ds->len) { ds->len += n; /* Success! */ break; } else if (n > -1) { /* glibc >= 2.1 */ - n_sz = ds->len + n + 1; + n_sz = ds->len + n + 2; } else { /* old glibc */ n_sz = ds->sz * 2; }
...although it would need tweaking to waste less running time.
But of course even if dillo is partly about retrocomputing, it'll be 99% linux+bsd retrocomputing and 1% other-stuff retrocomputing, so...
2. Throw an ifdef at it. Dillo has never had many ifdefs, and I'd thought they were discouraged, but maybe the changes needed for all of that stuff at the bottom of Compatibility.html like
SGI O2 running IRIX Tru64 (OSF1) 4.0 on Alpha QNX RTP 6.1/x86 (with occasional memory faults out of GTK+) AIX 4.3 (with some tweaks) Atari-based 68k-systems running MiNT Microsoft Windows using Cygwin RISC OS
...just didn't make it back into mainline dillo1?
3. We could always borrow fltk's vsnprintf(), which is about 250 lines.
I lean toward giving it an ifdef.
I would suggest testing for this specific (v)snprintf() behaviour in configure and ifdef based on the result rather than on the OS. There might even be some builtin support for this check in autoconf as the issue is mentioned in [1]. Johannes [1] https://www.gnu.org/software/autoconf/manual/autoconf-2.64/html_node/Functio...
Johannes wrote:
I would suggest testing for this specific (v)snprintf() behaviour in configure and ifdef based on the result rather than on the OS.
I thought about that, and between - it sounding like Irix == this behaviour and - relearning enough about autoconf to do anything is always somewhere between unpleasant and painful I felt disinclined, but I could give it some effort.
There might even be some builtin support for this check in autoconf as the issue is mentioned in [1].
I looked a bit yesterday and didn't get the impression that there was anything.
On Tue, Sep 16, 2014 at 05:49:26PM +0000, eocene wrote:
Johannes wrote:
I would suggest testing for this specific (v)snprintf() behaviour in configure and ifdef based on the result rather than on the OS.
I thought about that, and between - it sounding like Irix == this behaviour and - relearning enough about autoconf to do anything is always somewhere between unpleasant and painful I felt disinclined, but I could give it some effort.
There might even be some builtin support for this check in autoconf as the issue is mentioned in [1].
I looked a bit yesterday and didn't get the impression that there was anything.
AX_FUNC_SNPRINTF might help. It worked on my system after I installed an autoconf-archive package. Here is some documentation: http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4... I think it will define PREFER_PORTABLE_SNPRINTF in config.h in case it detects a broken (v)snprintf().
On Tue, Sep 16, 2014 at 06:29:27AM +0000, eocene wrote:
In the typical vsnprintf() (i.e., following the c99 standard), if you have space for 10 bytes and you want to write 20 bytes (including '\0'), you return 19, whereas irix returns 9.
Some options:
1. It's possible to make irix and the standard run with a change like
diff -r 5f63e28334b2 dlib/dlib.c --- a/dlib/dlib.c Tue Sep 16 00:21:49 2014 +0000 +++ b/dlib/dlib.c Tue Sep 16 04:59:20 2014 +0000 @@ -406,11 +406,11 @@ va_copy(argp2, argp); n = vsnprintf(ds->str + ds->len, ds->sz - ds->len, format, argp2); va_end(argp2); - if (n > -1 && n < ds->sz - ds->len) { + if (n > -1 && n+1 < ds->sz - ds->len) { ds->len += n; /* Success! */ break; } else if (n > -1) { /* glibc >= 2.1 */ - n_sz = ds->len + n + 1; + n_sz = ds->len + n + 2; } else { /* old glibc */ n_sz = ds->sz * 2; }
...although it would need tweaking to waste less running time.
But of course even if dillo is partly about retrocomputing, it'll be 99% linux+bsd retrocomputing and 1% other-stuff retrocomputing, so...
2. Throw an ifdef at it. Dillo has never had many ifdefs, and I'd thought they were discouraged, but maybe the changes needed for all of that stuff at the bottom of Compatibility.html like
SGI O2 running IRIX Tru64 (OSF1) 4.0 on Alpha QNX RTP 6.1/x86 (with occasional memory faults out of GTK+) AIX 4.3 (with some tweaks) Atari-based 68k-systems running MiNT Microsoft Windows using Cygwin RISC OS
...just didn't make it back into mainline dillo1?
3. We could always borrow fltk's vsnprintf(), which is about 250 lines.
I lean toward giving it an ifdef.
Me too, it clearly is an IRIX issue and the #ifdef would make it cristal clear (compared to a soln. using fltk's vsnprintf() for instance). +1 -- Cheers Jorge.-
On Thu, Sep 18, 2014 at 12:44:33PM -0300, Jorge Arellano Cid wrote:
On Tue, Sep 16, 2014 at 06:29:27AM +0000, eocene wrote:
In the typical vsnprintf() (i.e., following the c99 standard), if you have space for 10 bytes and you want to write 20 bytes (including '\0'), you return 19, whereas irix returns 9.
Some options:
1. It's possible to make irix and the standard run with a change like
diff -r 5f63e28334b2 dlib/dlib.c --- a/dlib/dlib.c Tue Sep 16 00:21:49 2014 +0000 +++ b/dlib/dlib.c Tue Sep 16 04:59:20 2014 +0000 @@ -406,11 +406,11 @@ va_copy(argp2, argp); n = vsnprintf(ds->str + ds->len, ds->sz - ds->len, format, argp2); va_end(argp2); - if (n > -1 && n < ds->sz - ds->len) { + if (n > -1 && n+1 < ds->sz - ds->len) { ds->len += n; /* Success! */ break; } else if (n > -1) { /* glibc >= 2.1 */ - n_sz = ds->len + n + 1; + n_sz = ds->len + n + 2; } else { /* old glibc */ n_sz = ds->sz * 2; }
...although it would need tweaking to waste less running time.
But of course even if dillo is partly about retrocomputing, it'll be 99% linux+bsd retrocomputing and 1% other-stuff retrocomputing, so...
2. Throw an ifdef at it. Dillo has never had many ifdefs, and I'd thought they were discouraged, but maybe the changes needed for all of that stuff at the bottom of Compatibility.html like
SGI O2 running IRIX Tru64 (OSF1) 4.0 on Alpha QNX RTP 6.1/x86 (with occasional memory faults out of GTK+) AIX 4.3 (with some tweaks) Atari-based 68k-systems running MiNT Microsoft Windows using Cygwin RISC OS
...just didn't make it back into mainline dillo1?
3. We could always borrow fltk's vsnprintf(), which is about 250 lines.
I lean toward giving it an ifdef.
Me too, it clearly is an IRIX issue and the #ifdef would make it cristal clear (compared to a soln. using fltk's vsnprintf() for instance).
+1
A bit more elaboration: I'd add an my_vsnprintf() in dlibc and make dStr_vsprintfa() use it, and make it like: my_vsnprintf() { #if IRIX /* compute required length by using IRIX's rules */ #else /* use vsnprintf(), no problem */ #fi } To avoid autoconf, the IRIX test can be placed in the same function with a static int: static int IRIX = -1; if (IRIX == -1) { /* very simple snprintf() test here */ IRIX = test ? 1 : 0; } -- Cheers Jorge.-
Having thought about it probably too much over the past however many days, I haven't thought of a good reason not to stick it all in an ifdef like #if defined(__sgi) /* IRIX does not conform to C99; if the entire argument did not fit * into the buffer, n = buffer space used (minus 1 for terminator) */ if (n > -1 && n + 1 < ds->sz - ds->len) { ds->len += n; /* Success! */ break; } else { n_sz = ds->sz * 2; } #else if (n > -1 && n < ds->sz - ds->len) { ds->len += n; /* Success! */ break; } else if (n > -1) { /* glibc >= 2.1 */ n_sz = ds->len + n + 1; } else { /* old glibc */ n_sz = ds->sz * 2; } #endif and be done with it.
On Fri, Sep 19, 2014 at 03:00:01AM +0000, eocene wrote:
Having thought about it probably too much over the past however many days, I haven't thought of a good reason not to stick it all in an ifdef like
#if defined(__sgi) /* IRIX does not conform to C99; if the entire argument did not fit * into the buffer, n = buffer space used (minus 1 for terminator) */ if (n > -1 && n + 1 < ds->sz - ds->len) { ds->len += n; /* Success! */ break; } else { n_sz = ds->sz * 2; } #else if (n > -1 && n < ds->sz - ds->len) { ds->len += n; /* Success! */ break; } else if (n > -1) { /* glibc >= 2.1 */ n_sz = ds->len + n + 1; } else { /* old glibc */ n_sz = ds->sz * 2; } #endif
and be done with it.
Fair enough, and IMHO simpler than my proposal. +1 -- Cheers Jorge.-
On IRIX, dpid starts but use of the dpis fails with "Dpi_get_server_port: can't read server port from dpid." Jorge, do you have any time to look into that?
On Mon, Apr 07, 2014 at 05:58:16PM +0200, Jan Diegelmann wrote:
eocene wrote:
Jan wrote:
Query: {GE} a_IO_ccc : OpSend [1B] Info=10262f30 Flags=0
"GE" is the entire query?
Yes exactly. Any idea?
Yes, that sould be a full HTTP protocol request! Something went wrong before that point. -- Cheers Jorge.-
participants (5)
-
diegel@work.de
-
eocene@gmx.com
-
jcid@dillo.org
-
Johannes.Hofmann@gmx.de
-
johannes.hofmann@gmx.de