[nhc-bugs] cygwin, java and cygpath (and some arithmetic)
C.Reinke
C.Reinke@ukc.ac.uk
Thu, 31 May 2001 21:16:04 +0100
[nhc98-1.04, built with gcc on cygwin/NT4]
1. Unless java has been compiled with cygwin (not the standard case:-),
java on windows seems to need its paths translated from cygwin's unix
world to plain windows world.
2. I do not understand the order in which nhc-compiled code evaluates
arithmetic expressions.
3. Has anyone had success using hi under cygwin?
Regards,
Claus
1. ------------------------- I think I've reported this before:
cygwin gives a unix-like environment on top of windows, including
unix-style paths. However, the unix-style directory structure is
embedded in the usual Windows directory tree. Programs running
"inside" cygwin happily see /tmp, /usr/local/bin, etc., but
programs not running "inside" cygwin, *such as Sun's java*, see
only the windows paths. They don't know what to do with cygwin's
unix-style paths, because /tmp might actually be C:\cygwin\tmp
or such, depending on your installation.
This affects the driver scripts for the java tools in nhc98
(e.g., hood and hat). Example:
$ CLASSPATH=/usr/local/lib/nhc98/hood.jar;export CLASSPATH
$ echo $CLASSPATH
/usr/local/lib/nhc98/hood.jar
$ java Hood observe.xml
Exception in thread "main" java.lang.NoClassDefFoundError: Hood
The workaround is simple, as cygwin provides a tool for the
filename conversion, cygpath:
$ CLASSPATH=`cygpath -w -p /usr/local/lib/nhc98/hood.jar`;export CLASSPATH
$ echo $CLASSPATH
C:\cygwin\usr\local\lib\nhc98\hood.jar
$ java Hood observe.xml
Message: file:/C:/cygwin/tmp/observe.xml
..
(I think Sun recommends to use "java -cp <classpath>" instead of $CLASSPATH)
For reference:
$ cygpath -h
Usage: cygpath [-p|--path] (-u|--unix)|(-w|--windows [-s|--short-name]) filename
-a|--absolute output absolute path
-c|--close handle close handle (for use in captured process)
-f|--file file read file for path information
-u|--unix print Unix form of filename
-w|--windows print Windows form of filename
-s|--short-name print Windows short form of filename
-W|--windir print `Windows' directory
-S|--sysdir print `system' directory
-p|--path filename argument is a path
-i|--ignore ignore missing argument
2. ------------------------- what exactly is going on here?
f = print $ (error "a") + (error "b")
g = print $ (((error "a") + (error "b"))::Integer)
h = print $ (((error "a") + (error "b"))::Double)
i = print $ (((error "a") + (error "b"))::Int)
main = f => output: a
main = g => output: a
main = h => output: b
main = i => output: b
I would have expected a in all cases (which hugs gives me), but Haskell
probably doesn't specify order of evaluation, not even consistent order
of evaluation. Is this effect intensional?
(sigh) It is disappointing that our beloved, semantically beautiful
functional language Haskell actually has less of a semantics than Java,
(not to mention SML, Lisp, ..).
3. ---------------------- btw
While playing with 2, I accidentally remembered a tool named hi, but
that crashes on me even with the simplest expressions:
$ hi
__ __ __ _____________________________________
|| || ______ ___ || _ ____ hmake interactive (hi):
||___|| || || || ___|| ||/ ||__|| Copyright (c) May 2000
||---|| || || || ||__|| ||\_ ||__ http://www.cs.york.ac.uk/fp/hmake/
|| || Report bugs to: malcolm@cs.york.ac.uk
|| || Version: 2.02 (2001-02-08) -------------------------------------
... Using compiler nhc98 ...
Type :? for help
[Std module... /usr/local/include/nhc98/Prelude.hi]
Prelude> 42
[Compiling... 0 [main] HInteractive 378 open_stackdumpfile: Dumping sta
ck trace to HInteractive.exe.stackdump
Segmentation fault (core dumped)