Skip to content
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

Fix: Avoid calling realpath of parent crystal in wrapper script #13596

Merged

Conversation

straight-shoota
Copy link
Member

Resolves #13592

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:infrastructure labels Jun 22, 2023
@straight-shoota straight-shoota self-assigned this Jun 22, 2023
@straight-shoota straight-shoota changed the title Fix avoid calling realpath of parent crystal Fix: Avoid calling realpath of parent crystal in wrapper script Jun 22, 2023
bin/crystal Outdated
@@ -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)
Copy link
Contributor

@HertzDevil HertzDevil Jun 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PARNET_CRYSTAL_COMMAND seems to be a typo. If it is fixed I don't see how the new wrapper script is different from before

@straight-shoota
Copy link
Member Author

Fixed.

The difference is that the parent crystal command resolved with realpath is now only used to determine wether it points to the wrapper script itself.
When calling parent crystal, the original path is used, without realpath:

exec "$PARENT_CRYSTAL_COMMAND" "$@"

@beta-ziliani beta-ziliani requested a review from HertzDevil June 26, 2023 15:23
@straight-shoota straight-shoota added this to the 1.9.0 milestone Jun 26, 2023
@straight-shoota straight-shoota merged commit 9b3b1a5 into crystal-lang:master Jun 27, 2023
@straight-shoota straight-shoota deleted the fix/wrapper-realpath branch June 27, 2023 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:infrastructure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't build from source with crystal installed from snap
2 participants