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

front: skip non-existent paths in gcc depfiles #803

Closed
wants to merge 1 commit into from

Conversation

CyberTailor
Copy link
Contributor

@CyberTailor CyberTailor commented Jul 17, 2023

Summary

There could be non-existent files in conf.m.fileInfos that prevented GCC-style depfiles from behaving correctly. This commit filters them out.

Details

Also create a helper function to quote paths for Unix Makefiles.

Copy link
Collaborator

@saem saem left a comment

Choose a reason for hiding this comment

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

Thanks for opening a PR.

As per the other PR the template needs to be updated. Some of the key questions as part of the template would surface some deeper insights and help produce a deeper fix.

@@ -25,13 +25,14 @@ proc writeDepsFile*(g: ModuleGraph) =
f.writeLine(toFullPath(g.config, k))
f.close()

func makefileQuoted(path: string): string =
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't there already a pre-existing procedure for this like quote shell?

Suggested change
func makefileQuoted(path: string): string =
func quoteFilepath(path: string): string =

Also, this seems like a better name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't there already a pre-existing procedure for this like quote shell?

Yes, but only subset of that is needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, this seems like a better name

Committed.

if path.len == 0:
depfile.write(target.makefileQuoted & ": \\" & '\n')
for path in paths:
if path.len == 0 or not fileExists(path):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't recall when this is called, but if this is meant to produce a reusable description then this shouldn't be filtered here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated PR message

@CyberTailor CyberTailor changed the title front: skip non-existant paths in gcc depfiles front: skip non-existent paths in gcc depfiles Jul 17, 2023
@CyberTailor
Copy link
Contributor Author

Closing until I remember what package caused this behavior

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.

2 participants