-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't build from source with crystal installed from snap #13592
Comments
Can you give some insights into why the realpath of PARENT_CRYSTAL ends up being |
I'm not familiar with how snap binaries work internally, but it's a sandboxed execution environment and somehow goes through the snap binary.
|
Okay this looks reasonable and not a specific issue with |
@koffeinfrei Could you check if this patch works for you? --- a/bin/crystal
+++ b/bin/crystal
@@ -153,11 +153,12 @@ if [ -z "${PARENT_CRYSTAL##*/*}" -a "$(realpath "$PARENT_CRYSTAL")" = "$SCRIPT_P
PARENT_CRYSTAL="crystal"
fi
-PARENT_CRYSTAL_COMMAND=$(realpath "$(command -v "$PARENT_CRYSTAL" 2> /dev/null)" 2> /dev/null)
+PARENT_CRYSTAL_COMMAND=$(command -v "$PARENT_CRYSTAL" 2> /dev/null)
+PARENT_CRYSTAL_COMMAND_REALPATH=$(realpath "$PARNET_CRYSTAL_COMMAND" 2> /dev/null)
PARENT_CRYSTAL_EXISTS=$(test !$?)
# check if the parent crystal command refers to this script
-if [ "$PARENT_CRYSTAL_COMMAND" = "$SCRIPT_PATH" ]; then
+if [ "$PARENT_CRYSTAL_COMMAND_REALPATH" = "$SCRIPT_PATH" ]; then
# remove the path to this script from PATH
NEW_PATH="$(remove_path_item "$(remove_path_item "$PATH" "$SCRIPT_ROOT")" "bin")"
# if the PATH did not change it will lead to an infinite recursion => display error |
@straight-shoota The patch works for me 👍. |
I followed Install from sources with Crystal installed from snap.
The issue is that the
realpath
command for the following linePARENT_CRYSTAL_COMMAND=$(realpath "$(command -v "$PARENT_CRYSTAL" 2> /dev/null)" 2> /dev/null)
resolves to
/usr/bin/snap
.The following rough patch for the binstub resolves the issue:
There's probably a more proper way to handle the snap case. If that's good enough I'm happy to submit a PR. Otherwise I'm open to suggestions on how to improve the patch.
The text was updated successfully, but these errors were encountered: