Arc Forumnew | comments | leaders | submitlogin
2 points by fallintothis 4985 days ago | link | parent

/dev/urandom is a special file in Unix-like operating systems that spits out random bits (see http://en.wikipedia.org/wiki//dev/random). Arc isn't so great at the cross-platform thing, since it hard-codes Unix-like paths & shell commands. In this case, srv.arc breaks when trying to generate a random string because it calls rand-string from arc.arc, which tries to open /dev/urandom to get random data. The file doesn't exist in Windows (and just creating one won't do the job, since Windows doesn't say "hey, I know, I'll generate random bits when people read from this file"), hence the error.

This was discussed awhile back in a thread that has some fixes for other Windows issues: http://arclanguage.org/item?id=9263.



1 point by Andrew_Quentin 4985 days ago | link

Hey. Thanks a lot for your reply. Are you speaking of this solution: http://jfkbits.blogspot.com/2008/01/digging-into-arc-in-24-m...

It seems to work fine if you take off the 'before make directory, but what exactly do I do with dev/urandom in both ac.scr and arc.arc?

-----

3 points by fallintothis 4985 days ago | link

Are you speaking of this solution

Well, strictly I was speaking of the solutions in the thread that I linked to, but that blog post is about the issue they discussed.

It seems to work fine if you take off the 'before make directory

Yeah, those forum/blog posts were from quite awhile ago, when xdef expected its first argument to be quoted (see http://ycombinator.com/arc/tut.txt -- or any of the myriad other Lisp tutorials out there -- for an introduction to quoting).

but what exactly do I do with dev/urandom in both ac.scr and arc.arc?

I linked to that thread because it was relevant, though it didn't fix this specific bug: it's still true that pg expects Windows snafus to be fixed downstream. As rocketnia mentioned (http://arclanguage.org/item?id=12397), most seem to be solved by using Cygwin, which will give you /dev/urandom & such.

The outstanding issues I'm aware of are generally fixable outside of Cygwin, but would require a bit of code drudgery.

- The setuid bug, apparently fixed (by doing nothing when it's called, so I'm suspicious, but I don't know): http://arclanguage.org/item?id=10625.

- pipe-from in ac.scm runs rm -f, which could be replaced by Racket's delete-file wrapped in the proper error-catching code (http://docs.racket-lang.org/reference/Filesystem.html#%28def...). It also uses /dev/urandom to generate a random filename, but that could be replaced by Racket's make-temporary-file (cf. http://arclanguage.org/item?id=2333 and http://docs.racket-lang.org/reference/Filesystem.html#%28def...).

- shash in arc.arc just uses openssl, which has a Windows binary that should work. It worked a few years ago, anyway: http://arclanguage.org/item?id=190. shash also creates a file in /tmp/, but that shouldn't be an issue, if I recall correctly from the few times I've run Arc on Windows.

- ensure-dir in arc.arc has been patched in that thread I linked to -- again, just using Racket's functions.

- load-items in news.arc has

  (system (+ "rm " storydir* "*.tmp"))
which seems like it could be done with Racket's delete-file and find-files (http://docs.racket-lang.org/reference/Filesystem.html#%28def...).

- rand-string uses /dev/urandom, which takes a little more doing to fix, as evidenced by the lack of changes on Anarki (the community-maintained repository for changes to Arc: http://github.com/nex3/arc). You might could rewrite it to use Racket's random number generators, but I don't really know.

-----