Discussion:
Many error msgs for all user-documents in lout 3.38 (MS Vista + Cygwin)
(too old to reply)
Volker Renneberg
2009-01-25 21:47:45 UTC
Permalink
Hi there again!

Finally, I succeeded to compile lout 3.38 under Cygwin/Windows Vista.
However, I cannot compile any of the delivered lout documents (slides,
expert, user, design).

It gives a lot of messages of the form:
lout file "all":
69,1: width missing from 0i
69,1: /, | and & must be enclosed in double quotes

I have attached the compilation report for the slides-document.

I have set OSDOS to 1 and OSUNIX to 0. I have tried it with locale
turned on and off. I did not change any of the include-files.

Right now, I do not know where this problem comes from neither where to
look at.... Any ideas?

Cheers
Volker
--
Volker Renneberg, Dipl.-Inform. (univ.)
Universität der Bundeswehr München * Fakultät für Informatik
Werner-Heisenberg-Weg * 85579 Neubiberg * Deutschland
Phone: +49 89 6004 3776 Fax: +49 89 6004 4447
Email: ***@unibw.de Web: http://www.unibw.de/inf2/
Ludovic Courtès
2009-01-25 23:18:56 UTC
Permalink
Hello,
Post by Volker Renneberg
I have set OSDOS to 1 and OSUNIX to 0.
Did you try the opposite? Cygwin is supposed to provide a Unix-like
environment, so perhaps that would work better.

Thanks,
Ludo'.
KHMan
2009-01-26 11:54:19 UTC
Permalink
Post by Ludovic Courtès
Hello,
Post by Volker Renneberg
I have set OSDOS to 1 and OSUNIX to 0.
Did you try the opposite? Cygwin is supposed to provide a Unix-like
environment, so perhaps that would work better.
I can confirm that the errors also appear with the following
Makefile changes in WinXP/Cygwin:

PREFIX = /usr/local
USELOC = 0

That is, "OSUNIX = 1". Program was run after a "make install".
The same configuration and procedure worked fine in Ubuntu-8.04.

Anyone using Lout on Cygwin? I wanted to try it sometime ago but
haven't got around to it.
--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia
KHMan
2009-01-26 12:47:06 UTC
Permalink
Post by Volker Renneberg
Hi there again!
Finally, I succeeded to compile lout 3.38 under Cygwin/Windows Vista.
However, I cannot compile any of the delivered lout documents (slides,
expert, user, design).
69,1: width missing from 0i
69,1: /, | and & must be enclosed in double quotes
I have attached the compilation report for the slides-document.
I have set OSDOS to 1 and OSUNIX to 0. I have tried it with locale
turned on and off. I did not change any of the include-files.
Right now, I do not know where this problem comes from neither where to
look at.... Any ideas?
A follow up.

I guess the likely problem is in z19.c:223. I think there is a
small difference between the implementation of [s]scanf in newlibc
and gnulibc. From the ISO C standard draft n1256, it looks like
newlibc is correct, or maybe both are valid interpretations. The
use of sscanf in that part of the code looks like it really needs
to depend on pretty specific behaviour, fairly brittle usage.

I will patch my version later today and see if it runs properly on
cygwin with the fix.
--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia
KHMan
2009-01-26 13:17:47 UTC
Permalink
Post by Volker Renneberg
Finally, I succeeded to compile lout 3.38 under Cygwin/Windows Vista.
However, I cannot compile any of the delivered lout documents (slides,
expert, user, design).
69,1: width missing from 0i
69,1: /, | and & must be enclosed in double quotes
I have attached the compilation report for the slides-document.
I have set OSDOS to 1 and OSUNIX to 0. I have tried it with locale
turned on and off. I did not change any of the include-files.
Right now, I do not know where this problem comes from neither where to
look at.... Any ideas?
[Sorry for threading messages like this, I can never get back my
own e-mail from gmail, it's a known problem...]

Here's a stopgap measure, I got all the docs generated on
Cygwin/WinXP with the attached very ugly hack (z17.diff).
Basically I think the scanf theory holds.

I used the following changes to the Makefile:

PREFIX = /usr/local
USELOC = 0

And I have it installed to /usr/local before processing the
documents. Appears to go normally, the slides output is correct,
but I haven't tried to scrutinize the other docs yet.

I'm not really sure if newlib's sscanf is really at fault, because
its behaviour sounds wrong if we use "man scanf", but sounds right
if we use the ISO C draft standard n1256. So it seems all very
ambiguous...
--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia
Jeff Kingston
2009-01-26 18:15:38 UTC
Permalink
Could you explain what the issue is? What is wrong, or ambiguous,
about %f in a scanf format? It seems totally normal and unambiguous.

Jeff
Post by KHMan
I'm not really sure if newlib's sscanf is really at fault, because
its behaviour sounds wrong if we use "man scanf", but sounds right
if we use the ISO C draft standard n1256. So it seems all very
ambiguous...
- if( sscanf((char *) str, "%f", &num) != 1 )
+ if( sscanf((char *) str, "%31[0-9.]", &conv) != 1)
KHMan
2009-01-26 19:06:16 UTC
Permalink
Post by Jeff Kingston
Could you explain what the issue is? What is wrong, or ambiguous,
about %f in a scanf format? It seems totally normal and unambiguous.
It appears that in Cygwin, the sscanf works in a slightly
different manner. Possibly, it's a Cygwin newlib bug -- but I'll
study the newlib sources etc first before risking being flamed on
the Cygwin list...

When Lout sees "0i":

(1) On gnulibc, since 'i' is not a valid %f character, only '0' is
converted because conversion stops before the 'i'. "man scanf"
gives this interpretation.
(2) On newlib (Cygwin), sscanf grabs in a greedy manner, I think,
and sees '0i', and conversion fails.

Behaviour (2) seems likely wrong versus the man page. I'll look at
the newlib sources and the POSIX specifications later...
Post by Jeff Kingston
Post by KHMan
I'm not really sure if newlib's sscanf is really at fault, because
its behaviour sounds wrong if we use "man scanf", but sounds right
if we use the ISO C draft standard n1256. So it seems all very
ambiguous...
- if( sscanf((char *) str, "%f", &num) != 1 )
+ if( sscanf((char *) str, "%31[0-9.]", &conv) != 1)
--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia
KHMan
2009-01-28 15:22:51 UTC
Permalink
Post by Jeff Kingston
Could you explain what the issue is? What is wrong, or ambiguous,
about %f in a scanf format? It seems totally normal and unambiguous.
An update. As far as I can tell, it's a Cygwin bug, and I've
posted a query on the Cygwin list.

For the following test cases:

#include <stdio.h>
int main()
{
char *foo1 = "10i";
char *foo2 = "0i";
char *foo3 = "0.0i";
char *foo4 = "1.0i";
char *foo5 = "0.1i";
float f;
printf("%d ", sscanf(foo1, "%f", &f)); printf("%f\n", f);
printf("%d ", sscanf(foo2, "%f", &f)); printf("%f\n", f);
printf("%d ", sscanf(foo3, "%f", &f)); printf("%f\n", f);
printf("%d ", sscanf(foo4, "%f", &f)); printf("%f\n", f);
printf("%d ", sscanf(foo5, "%f", &f)); printf("%f\n", f);
}

On Cygwin:
$ ./test
1 10.000000
0 10.000000
1 0.000000
1 1.000000
1 0.100000

So it works fine for most things except '0'. Looks like a Cygwin
bug for sure. Once there is more information from the Cygwin
people, I will put up a brief wiki page on this for the Lout wiki.
Post by Jeff Kingston
Post by KHMan
I'm not really sure if newlib's sscanf is really at fault, because
its behaviour sounds wrong if we use "man scanf", but sounds right
if we use the ISO C draft standard n1256. So it seems all very
ambiguous...
- if( sscanf((char *) str, "%f", &num) != 1 )
+ if( sscanf((char *) str, "%31[0-9.]", &conv) != 1)
--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia
Volker Renneberg
2009-01-26 22:13:51 UTC
Permalink
Hi - thanks! This patch works fine for me (Vista and XP).

Cheers
Volker
Here's a stopgap measure, I got all the docs generated on Cygwin/WinXP
with the attached very ugly hack (z17.diff). Basically I think the
scanf theory holds. [.........................................]
KHMan
2009-01-28 18:28:27 UTC
Permalink
Post by Volker Renneberg
Hi - thanks! This patch works fine for me (Vista and XP).
Last update to the list. It's a bug and Redhat has patched newlib,
so the problem will disappear in a future version of the cygwin
runtime. No change to Lout mainline sources is necessary.

In the meantime, the ugly hack should be okay as a stopgap
measure, and I'll find some time to add a Lout-on-Cygwin wiki page.
Post by Volker Renneberg
Here's a stopgap measure, I got all the docs generated on Cygwin/WinXP
with the attached very ugly hack (z17.diff). Basically I think the
scanf theory holds. [.........................................]
--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia
k***@cas.mcmaster.ca
2009-01-27 19:26:33 UTC
Permalink
Hallo Volker! ;-)
Post by Volker Renneberg
Finally, I succeeded to compile lout 3.38 under Cygwin/Windows Vista.
However, I cannot compile any of the delivered lout documents (slides,
expert, user, design).
[...]
Post by Volker Renneberg
I have set OSDOS to 1 and OSUNIX to 0. I have tried it with locale
turned on and off. I did not change any of the include-files.
I think Cygwin counts as UNIX.


Hope this helps!


Wolfram
Loading...