Skip to content

std.zig.system: remove assert that inspected path is absolute #22568

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

Closed
wants to merge 1 commit into from

Conversation

BratishkaErik
Copy link
Contributor

Followup to #21540

It can also have relative path if PATH has relative path, so just run it with cwd. Also it can be a relative shebang path (which is not handled yet) and it's better to skip it rather than crash compiler.

Resolves #22566

It can also have relative path if PATH has relative path, so just run
it with `cwd`. Also it can be a relative shebang path (which is not
handled yet) and it's better to skip it rather than crash compiler.

Resolves ziglang#22566

Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
Comment on lines +1023 to +1024
// for simplicity we are assuming it is an absolute path.
// It can also be a relative path from PATH environment variable.
Copy link
Member

Choose a reason for hiding this comment

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

"we are assuming it is an absolute path"
"it can be a relative path"

these are contradictory statements. Can you either make the comment accurate or delete it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to mean here "assume interpreter path is absolute, and handle both absolute and relative for PATH", if it's not clear I can rewrite it

Copy link
Member

@andrewrk andrewrk Jan 21, 2025

Choose a reason for hiding this comment

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

It's pretty confusing, but, it's OK. Better to fix the regression now.

edit: I changed my mind, I will revert the other commit for now. Let us scrutinize the change more carefully because I do not think relative path is valid here. It is relative to the cwd on the next line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

edit: I changed my mind, I will revert the other commit for now.
OK

Let us scrutinize the change more carefully because I do not think relative path is valid here. It is relative to the cwd on the next line.

It is valid for PATH cases because they are also evaluted from the point of cwd, and for interpreters I'll try to write version which handles relative path too since work is redone anyway.

@andrewrk andrewrk closed this in 0bacb79 Jan 21, 2025
Fri3dNstuff pushed a commit to Fri3dNstuff/zig that referenced this pull request Jan 27, 2025
…v-in-path"

It caused an assertion failure when building Zig from source.

This reverts commit 0595feb, reversing
changes made to 744771d.

closes ziglang#22566
closes ziglang#22568
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.

Unable to build
2 participants