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 constructing executable path from argv[0] #1068

Merged
merged 2 commits into from
Apr 26, 2018

Conversation

lanurmi
Copy link
Contributor

@lanurmi lanurmi commented Apr 25, 2018

The fallback code for constructing executable path from argv[0] does not work at all currently. (And possibly never worked?)

How to test:
Comment out e.g. the #if PLATFORM_LINUX block in premake_locate_executable in premake.c and witness the fallback code failing with the error:
PANIC: unprotected error in call to Lua API (attemt to call a string value)

…path.

Do not call path_isabsolute() in condition -- it always returns 1 and modifies the stack.
If argv[0] is already absolute, push it in the stack alone.
Do not leave unwanted stuff in the stack in premake_locate_executable(), as the caller only expects exactly one string to be pushed.
Copy link
Member

@samsinsane samsinsane left a comment

Choose a reason for hiding this comment

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

I'm no expert on what the state of the Lua stack is here, so I'm going to trust that your changes make it symmetrical. I'll leave this for someone with a better understanding of the Lua stack to merge.

Good catch! Thanks!

@tvandijck tvandijck merged commit b9beed1 into premake:master Apr 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants