The uutils/coreutils implementation of readlink emits error messages to
stderr when invoked on non-symlinks (regular files or directories):
readlink: <file>: Invalid argument
By contrast, BSD and GNU readlink fail silently. This caused unwanted
error output when using jenv with uutils/coreutils.
The resolve_link() function is used in abs_dirname() to traverse paths,
and may be called on non-symlinks during normal operation. This fix adds
a symlink check using [ -L "$1" ] before invoking readlink, which:
- Prevents spurious error messages from uutils readlink
- Maintains compatibility with BSD, GNU, and uutils implementations
- Preserves real error visibility by only calling readlink on symlinks
- Avoids the need to suppress stderr which would hide genuine errors