Arc Forumnew | comments | leaders | submitlogin
Anarki Windows Compatibility
4 points by eds 6113 days ago | 7 comments
I am wondering if the webserver code in arc is compatible with Windows. I remember having tried the hello world example after some bugfixes of the initial arc0 on Anarki, but for some reason the current Anarki doesn't work (obtained on Tue Feb 26 16:01:32 PST 2008).

  Use (quit) to quit, (tl) to return here after an interrupt.
  arc> (defop hello req (pr "hello world"))
  #<procedure:gs1657>
  arc> (asv)
  The syntax of the command is incorrect.
  ready to serve port 8080
and after I redirect my browser to http://localhost:8080/hello I get a blank page and this error message in arc

  'uname' is not recognized as an internal or external command,
  operable program or batch file.
  make-string: expects argument of type <non-negative exact integer>; given -1
  
   === context ===
   cut
   date
   memodate
   srvlog
   gs1078
   handle-request-thread
Has anyone gotten the basic arc2 web examples to work on Windows? (And can we get these fixes on Anarki?) I could work on it myself, but I wanted to check that it hadn't already been done, especially since if I recall correctly it used to work prior to arc2.


4 points by nex3 6113 days ago | link

You probably want to look at the uname and date functions in arc.arc. If you can get these two to avoid using system (maybe by using the $ drop-to-Scheme operator) everything should work. Hopefully.

Edit: never mind, I just did this. All the date stuff is now platform-independent... does it work now?

-----

2 points by eds 6113 days ago | link

Now I am getting:

  arc> (defop hello req (pr "hello world"))
  #<procedure:gs1665>
  arc> (asv)
  The syntax of the command is incorrect.
  ready to serve port 8080
and upon going to http://localhost:8080/hello (which is still blank)

  open-output-file: cannot open output file: "C:\User\Programming\Arc\arc-wiki\arc
  /logs/srv-2008-02-26" (The system cannot find the path specified.; errno=3)
  
   === context ===
   srvlog
   gs1086
   handle-request-thread
If I instead manually create a directory arc/logs before attempting (asv), everything works fine.

It looks like (asv) calls (serve port), which calls (ensure-dir logdir* ), which would seem to be our culprit

  arc> (ensure-dir logdir* )
  The syntax of the command is incorrect.
  nil
since ensure-dir calls directly out to mkdir and Windows breaks on the forward slashes in the command. Changing that part of the definition of ensure-dir from

  (system (string "mkdir -p " path))
to using the convenient definitions in files.arc

  (mkdir path)
should do the trick.

EDIT: Verified that the fix works with both (asv) and (nsv); pushed to Anarki. This should resolve web server problems on Windows.

-----

2 points by nex3 6113 days ago | link

I was working on this, too, and I got rid of your commit and added mine (sorry!). There are some complications with just using make-directory - specifically, it doesn't create parents directories. We need make-directory* to do this, and that sets the sticky bit on directories in Unix. So my solution was to use system on Unix and make-directory*.

-----

1 point by eds 6113 days ago | link

Whatever, just so long as it works :)

-----

1 point by eds 6113 days ago | link

Just found this, which discusses the issue, but it doesn't really answer my question.

http://arclanguage.org/item?id=3442

No one responded to nex3's post in the other thread. Does this mean that Anarki works for other people, or did they just not check?

-----

1 point by mec 6113 days ago | link

I got the snapshot he posted and it won't even load in mzscheme:

  G:\Anarki\arc-wiki>mzscheme -m -f as.scm
  compile: bad yntax; function application is not allowed, because no %app syntax transformer is bound in: (quote nil)

   === context ===
  G:\Anarki\arc-wiki\ac.scm:978:0: aload1

  >
It'll only load in DrScheme but then I get:

  arc> (load "news.arc")
  nil
  arc> (nsv)
  The syntax of the command is incorrect.

  The syntax of the command is incorrect.
 
  The syntax of the command is incorrect.

  The syntax of the command is incorrect.

  load items: Error: "directory-list: could not open \"G:\\Anarki\\arc-wiki\\arc\\news\\story\\\" (The system cannot find the path specified.; errno=3)"
  arc>

-----

1 point by nex3 6113 days ago | link

Anarki was briefly incompatible with the latest MzScheme. The snapshot may have been made then. The latest revision should be better, though, at least with respect to MzScheme syntax errors.

-----