halcyon / asdf-java

A Java plugin for asdf-vm.
MIT License
468 stars 87 forks source link

Error messages on macOS 10.15.1 with Bash 5.0.11(1)-release #28

Closed joschi closed 5 years ago

joschi commented 5 years ago

When running asdf list-all java on macOS 10.15.1 with Bash 5.0.11(1)-release, I receive some error messages, although the actual listing of available Java versions seems to work.

# asdf --version
v0.7.5

# asdf plugin-list --urls
gradle          https://github.com/rfrancis/asdf-gradle.git
java            https://github.com/halcyon/asdf-java.git
maven           https://github.com/halcyon/asdf-maven.git

# echo $BASH_VERSION
5.0.11(1)-release

# LC_ALL=C asdf list-all java
mktemp: too few X's in template 'asdf-java'
stat: cannot read file system information for '%c': No such file or directory
/Users/joschi/.asdf/plugins/java/bin/list-all: line 55: [[: File:: syntax error in expression (error token is ":")
adopt-openjdk-10.0.2+13
[...]
joschi commented 5 years ago

The problem might be caused by the fact that I installed GNU coreutils and GNU stat doesn't support the %c format sequence.

# which stat
/usr/local/opt/coreutils/libexec/gnubin/stat

# /usr/local/opt/coreutils/libexec/gnubin/stat --version
stat (GNU coreutils) 8.31
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Michael Meskes.
# BSD stat
# /usr/bin/stat -f '%c'
1574278351

# GNU stat
# /usr/local/opt/coreutils/libexec/gnubin/stat -f '%c'
stat: cannot read file system information for '%c': No such file or directory
halcyon commented 5 years ago

The problem is also being caused by the GNU coreutils version of mktemp. If you can ensure in your PATH that you use the MacOS versions of mktemp and stat binaries it should help.

halcyon commented 5 years ago

I guess I could also specify the full path to the MacOS versions of both of these to ensure future conflicts with coreutils no longer happen...

halcyon commented 5 years ago

Please update the plugin, I'm now referencing both mktemp and stat via their full path

joschi commented 5 years ago

@halcyon Amazing, thanks for the rapid fix!

It's now working without any warning or error messages. 👍