Sdkman-cli: /root/.sdkman/src/sdkman-path-helpers.sh: line 89: syntax error near unexpected token `<'

Created on 6 Sep 2016  路  17Comments  路  Source: sdkman/sdkman-cli

Hello,

Over the weekend it appears that something has broken in the sdkman-path-helpers.sh script for us. Not entirely sure what changed, but here some details. Any thoughts?

Version:
SDKMAN 5.1.2+66

Error:
10:20:36 ++++ source /root/.sdkman/src/sdkman-path-helpers.sh
10:20:36 /root/.sdkman/src/sdkman-path-helpers.sh: line 89: syntax error near unexpected token `<'

Code:
88 function cygwin_ln(){
89 mapfile -t ph < <(cygpath -aw "$@")
90 [ -d "$2" ] && d=/d || d=
91 cmd /c mklink $d "${ph[@]}"
92 }

Most helpful comment

This has now been released as 5.1.4+78. Please confirm that this fixes your issues.

All 17 comments

Bump, seeing this also. seems something like
mapfile -t ph < $(cygpath -aw "$@") instead of mapfile -t ph < <(cygpath -aw "$@") should fix it.

I suspect the change suggested by @Joshua-Brent-Collins won't properly address this issue. bash gives an error saying there's an ambiguous expansion of the output from cygpath (given that it's two space separated strings). Quoting the output/reference by using `mapfile -t ph < "$(cygpath -aw "$@")" moves the error to an invalid argument for mapfile as mapfile expects the input on stdin to be separated by newlines.

@Ephphatha are you using bash or dash ? Shouldn't be a huge difference but just for my own interest while I test this out.

@Joshua-Brent-Collins I am unfortunately not able to check using the same computer at the moment but I'm pretty sure it's using a recent version of bash. I haven't changed the default shell and the last install/upgrade of the cygwin x64 distribution I did about a month ago.

Hi,

I use sdkman in a docker environment (=linux) and I encounter the same issue.

The strange thing is it goes into the "cygwin" condition

if [[ "$OSTYPE" == "cygwin" ]]; then
....
    else
....
    fi

Or "$OSTYPE" == "linux-gnu"

FYI - I'm running this on a "linux-gnu" server also.

I am getting a different but related to this method: command not found: mapfile when installing over babun in Windows7.
I've seen that previous versions don't include the cygwin_ln method but they worked. I've been using sdkman on babun for more than a year without issues...untill now.

Do you want gradle 3.0 to be set as default? (Y/n): Y

Setting gradle 3.0 as default.
cygwin_ln:1: command not found: mapfile

As a workaround, I removed the new code added to sdkman-path-helpers.sh and now I'm able to run just fine. This solution may work for you too until this is resolved.

You can see it here: https://github.com/sdkman/sdkman-cli/commit/e3a4d4691845ecbc658fb420d7e3fc60a2491396#diff-e9fcd54eab24e389f181acbc1af5993aL87

Just make sure you add the symlink back that was moved.

As a workaround, I removed the new code added to sdkman-path-helpers.sh and now I'm able to run just fine. This solution may work for you too until this is resolved.

Worked like a charm, thanks. I could install gradle and maven without issues and they work :smiley:

Now, the hard part is making sure we find the right and final solution. Seems clear that the < should be a $, that settled.
The mapfile usage is another thing, doing some googling seems it's a grey command in that it's not included in all bash distributions, for instance I found that it is not available on my MacOS.
But I guess this commit was added for a reason here: https://github.com/sdkman/sdkman-cli/commit/e3a4d4691845ecbc658fb420d7e3fc60a2491396
The intent is to make syslinks work on Windows, which would be great, but the reference to stackoverflow does not match the code. Maybe @busches can add some more context?

The SO answer has since been edited: http://stackoverflow.com/posts/11166347/revisions. I added the PR back when it was still gvm and I don't use gvm routinely now. I can take a look to see if the updated SO answer also works on Cygwin, which if solves the problem will allow for the removal of most of the commit.

Update: as the new SO answer suggests, setting: export CYGWIN=winsymlinks:native in my .bashrc file does allow the native linking code to work and with that, the commit can be reverted. May potentially want to add a note about it to the FAQ.

Seems OK to me.

I use sdkman into docker. When i build images and call source "$HOME/.sdkman/bin/sdkman-init.sh" I see this error. Base image is Ubuntu trusty. I previously had no problem.

PS: After test I found workaround. You can save command in script and run then all work

This has now been released as 5.1.4+78. Please confirm that this fixes your issues.

This has now been released as 5.1.4+78. Please confirm that this fixes your issues.

Excellent! It works! My problem gone

This has resolved my issue as well. Thank you.

Was this page helpful?
0 / 5 - 0 ratings