Open nabato opened 1 year ago
What is the value of your XDG_*_HOME
environment variables, if you have them set?
XDG_HOME
I don't have one.
I edited the question, list any environment variable starting with XDG
I edited the question, list any environment variable starting with
XDG
printenv | grep xdg
:
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
I don't see any mention of XDG_CONFIG_DIRS
in the code. According to the spec they should be used (in order) in addition to XDG_CONFIG_HOME
.
Still I'd be curious where the ?
comes from.
cc @rads
I have a system with the same behaviour.
On this system the output of bb -e '(print (System/getProperty "user.home"))'
returns ?
Trying the same in a clj repl prints my home directory so I assume it's happening here (in fact, if I change that code to set the property to the desired directory, bbin works as expected).
I found a JDK bug that seems to suggest that there is an issue on systems with LDAP authentication, even though on the system where I re-create the behaviour there are only 64-bit libs installed (and I use LDAP authentication there).
Perhaps this is an issue with GraalVM?
You can repro this as follows:
Repro.java:
public class Repro {
public static void main(String [] args) {
System.out.println(System.getProperty("user.dir"));
}
}
javac Repro.java
java Repro # test if it works
$GRAALVM_HOME/bin/native-image Repro --no-fallback
./repro # test if it works in native-image
If it turns out to be a GraalVM issue, please file an issue on their Github.
I guess it is not a GraalVM issue. I tried the program with "user.dir" and "user.home". Both are displayed. I tried it with a GraalVM JDK 21 and JDK 17. I compiled the program with Java 17 and Java 8 (sic!). Everytime my home directory was printed.
@akutschera Did you try it inside of a native-image rather than just a JDK? This wasn't clear from your answer.
Sorry for the misunderstanding. I tried to follow your suggestions. Here's what I did:
I created a file Repro.java like you suggested. I added the following line System.out.println(System.getProperty("user.home"));
I compiled the file with both JDK8 and JDK17
For each class file I created a GraalVM native image with both a GraalVM 17 and 21 with
$GRAALVM_HOME/bin/native-image Repro --no-fallback
So I ended up with 2 class files and 4 native images.
Each printed out my current and my home directory as expected.
Which GraalVM did you use, the CE version or Oracle GraalVM?
I have another repro for you which is closer to how bb (SCI) works:
public class Repro {
public static void main(String [] args) throws NoSuchMethodException, IllegalAccessException, java.lang.reflect.InvocationTargetException {
var clazz = System.class;
var meth = clazz.getMethod("getProperty", String.class);
System.out.println(meth.invoke(clazz, "user.dir"));
}
}
Can you also try that one?
I downloaded the GraalVMs from https://www.graalvm.org/downloads I downloaded both the Java 17 and the Java 21 version. I will have to try the new Repro later.
Now, that's a bit embarassing. I found a solution/workaround for this. All I tried all the time was the static build of babashka. If I use the non-static build, everything is fine. That one can talk to sssd and get the home directory from the LDAP server.
Btw, my repro above contains a mistake and should have user.home
, not user.dir
.
I just tried the above on a Linux x64 Ubuntu 20.04 in WSL and both the static version and non-static version return the right value for user.home
for me.
I also tried it in a Docker image:
FROM ubuntu:20.04
RUN apt-get update && apt-get install curl -y
RUN curl -sLO https://raw.githubusercontent.com/babashka/babashka/master/install
RUN chmod +x install
RUN ./install --dir /tmp
RUN /tmp/bb -e "(System/getProperty \"user.home\")"
/tmp/bb -e '(System/getProperty "user.home")'
"/root"
bbin 0.2.0
creates a directory with a singe letter name?
with subdirectories.clojure
,.deps.clj
,.gitlibs
,.local
and installs bbins in there, which makesbbin
and installed bbins unusable. The path to an installed bbin looks like$HOME/?/.local/bin/installed-bbin-name
.Calling
(System/getProperty "user.home")
returns correct name not a?
.Installing
bbin
by means ofbrew
or as a standalone executbale makes no difference.P.S. Appreciate all of your work.