chdir seems not to work on ABCL with run-program
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ASDF |
Fix Released
|
Medium
|
Faré |
Bug Description
For me (Mac OS X), test-run-
I believe that I have found that it is an unsuccessful interaction between run-shell-command on that platform and UIOP:CHDIR:
ASDF-TEST(4): (chdir *test-directory*)
"/Users/
;;; note that the echoed value here does not agree with what we're setting...
ASDF-TEST(5): (run-shell-command "./good-
; $ ./good-
127
The internal program doesn't work, either, and is more forthcoming about the cause of error:
ASDF-TEST(7): (ext:run-
/bin/sh: ./good-
127
I check that the "current working directory" is what's expected:
ASDF-TEST(8): *test-directory*
#P"/Users/
ASDF-TEST(9): (getcwd)
#P"/Users/
Looking into UIOP:CHDIR, I see that it sets something internal to the JVM:
(java:jstatic "setProperty" "java.lang.System" "user.dir" (namestring x))
presumably this property does not align with the OS notion of working directory, and doesn't get passed through to running the shell command?
Changed in asdf: | |
status: | Fix Committed → Fix Released |
Indeed, I used the user.dir system property by following online recipes. But that wasn't enough for run-program, and now that I tested it a bit more, it looks like it didn't work with probe-file, either.
The underlying problem is that the JVM doesn't give access to native chdir without some extensions (using Java Native foo) that aren't available with ABCL. There's a user.dir system property whereby some Java programs kind of fake it, that I tried to use previously, but ABCL apparently doesn't play nice with it.
Therefore, I committed a change whereby ABCL uses *default- pathname- defaults* as our "current directory". I make sure to chdir to it before to run commands with run-program. I try to make the run-program chdir feature work on Windows, but that's untested.