Re: [nhc-bugs] Building nhc98 on Windows 2000

1) what exactly is "fullname" supposed to do in configure?
if fullname 2>>/dev/null # cope with symbolic links in directory
What it says in the comment... :-) If `fullname' is available it gives the absolute pathname to its argument, i.e. it expands symbolic links fully in the directory part.
I can't see this under Solaris either, so the number of systems having it might be limited?
Updating targets/ix86-CYGWIN_NT-5.0/hmake3.config... fullname: not found
If your system doesn't have it, it won't be executed. You definitely shouldn't see the `not found' message, because that was redirected to /dev/null.
?? you seem to assume that the redirection affects the executing shell itself, whereas, IMO, it only affects the command. so, if the shell can't find the command, no redirection, and the shell reports the error as usual, no?
Curiously enough, the only reason I introduced `fullname' was because of Cygwin. Remember the business with $(PWD) vs $(shell pwd) in Makefiles (Cygwin requires the latter)? Well in Unix systems, the two forms give different results if there are symbolic links in the directory path. Hence `fullpath' is used as a hack to try to patch up the difference.
I admire everyone who is fighting to smooth over incompatibilities to produce portable systems!-)
No, and if you look closely it isn't the line I wrote either... :-) It actually reads $ grep '^NHC98INCDIR' ...
oops, my bad!
I think I can see how this is failing now. Consider this code:
runAndReadStdout cmd = do ... s <- readFile output removeFile output -- file will not be removed until readFile closes it return (safeinit s) -- strip trailing newline added by shell
I was indeed homing in on that strange artifact (btw, don't you want to force the call to safeinit, so that readFile can complete and removeFile can proceed?).
The file-removal assumes the unix-like property that you can unlink a file while it still has a (lazy) reader attached to it, and the file contents will stick around until the reader has finished with it. It is perfectly possible to create a new (different) file with the same name as the old one whilst the old one is still being read.
Ah, I had almost forgotten about that old magic:) Old wizards used to say: don't use magic for ordinary tasks. It may be cute that it works on real systems, but it isn't really needed here, so why not go for the ordinary, boring way?
Am I right in guessing that the Cygwin filesystem doesn't have these semantics?
Windows doesn't seem to agree with these semantics, so you might not want to run your Haskell-code in plain-Windows hugs/ghc.. Cygwin itself tries to smooth things over, but there seem to be an awful lot of ways that can go wrong. The particular problem most relevant to our case seems to be described here: http://www.cygwin.com/ml/cygwin/2001-07/msg01799.html in other words, the open-unlink-read thing kind of works, but if you then try a write on top of it all (as in the second call to runAndReadStdout), the current unlink hackery doesn't seem to cope (I don't know the details, but one rumour has it that unlinks of open files are simply queued for later removal), which might explain the permission problem. Forcing the call to safeinit, so that output is no longer open via readFile when removeFile is called, should get rid of that? Claus

If `fullname' is available it gives the absolute pathname to its argument
I can't see this under Solaris either, so the number of systems having it might be limited?
We have it locally under both Linux and Solaris, but I guessed it might be fairly non-standard. However, my own local setup was the one I was most interested in getting to work at the time, so if it works for anyone else that is just a bonus... :-)
?? you seem to assume that the redirection affects the executing shell itself, whereas, IMO, it only affects the command. so, if the shell can't find the command, no redirection, and the shell reports the error as usual, no?
There seems to be a difference between bash and sh - the former behaves as I would like, the latter as you describe.
(btw, don't you want to force the call to safeinit, so that readFile can complete and removeFile can proceed?).
Maybe that's the easiest hack, but it would of course need to be a deepSeq, not just a seq.
The file-removal assumes the unix-like property that you can unlink a file while it still has a (lazy) reader attached to it, and the file contents will stick around until the reader has finished with it. It is perfectly possible to create a new (different) file with the same name as the old one whilst the old one is still being read.
Ah, I had almost forgotten about that old magic:) Old wizards used to say: don't use magic for ordinary tasks.
Magic? It's just data-structure persistence and automatic garbage collection, both of which are ideas we love in functional programming. Should I avoid higher-order functions and laziness, since many imperative programmers regard them as magic too?
It may be cute that it works on real systems, but it isn't really needed here, so why not go for the ordinary, boring way?
Working out a decent way of forcing exactly the right degree of evaluation to match the broken operating system is much harder than doing it the natural lazy way! Btw, thanks for your help in tracking down these issues, Claus. It never fails to surprise me how many seemingly-small incompatibilities there are between Cygwin and real Unix, and how easy it is to trip over them. Regards, Malcolm

?? you seem to assume that the redirection affects the executing shell itself, whereas, IMO, it only affects the command. so, if the shell can't find the command, no redirection, and the shell reports the error as usual, no?
There seems to be a difference between bash and sh - the former behaves as I would like, the latter as you describe.
Under sh, something like if (basename >/dev/null 2>&1); then echo foo; fi will hide the shell's stderr. Jon
participants (3)
-
C.Reinke
-
Jon Bernard
-
Malcolm Wallace