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

Allow response files to be special files #1197

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

stephank
Copy link

In NixOS, we wrap toolchain executables to inject search paths (among other things). These wrappers are bash scripts that build an often large array of arguments, then provide them as a response file via redirect like so:

swift-driver @<(printf "%q\n" --driver-mode=swiftc -print-target-info)

The above is a simple test case that currently fails. Bash turns this into:

swift-driver @/dev/fd/63

But the device node used there doesn't pass the isFile check. This PR broadens that check by using isReadable instead.

@artemcm
Copy link
Contributor

artemcm commented Sep 26, 2022

Thank you @stephank.

Could you please add a test for this (with a command like in the PR description) to the test suite?

@stephank
Copy link
Author

I added a test case and checked the before and after. I'm not sure if this sort of thing works on Windows, I don't have a machine to test.

@artemcm
Copy link
Contributor

artemcm commented Sep 27, 2022

@swift-ci test

@artemcm
Copy link
Contributor

artemcm commented Sep 27, 2022

@swift-ci test Windows platform

@stephank
Copy link
Author

That CI error is a little weird:

...\sourcekit-lsp\Sources\LanguageServerProtocol\SupportTypes\DocumentURI.swift:15:13: error: no such module 'TSCBasic'
import func TSCBasic.resolveSymlinks
            ^

But that line doesn't have that import; it appears to be in swift-driver/Sources/SwiftDriver/Utilities/VirtualPath.swift instead. Seems unrelated?

Regardless, when I wrote the comment about Windows, I was thinking file descriptors, but I suppose the whole /dev/fd namespace is just not a thing. I can wrap it in a #if !os(Windows) if you want?

@artemcm
Copy link
Contributor

artemcm commented Sep 27, 2022

Regardless, when I wrote the comment about Windows, I was thinking file descriptors, but I suppose the whole /dev/fd namespace is just not a thing. I can wrap it in a #if !os(Windows) if you want?

Makes sense for this particular test, I think.
cc @compnerd

@compnerd
Copy link
Collaborator

apple/sourcekit-lsp#640 should help with the LSP issue.

@compnerd
Copy link
Collaborator

Please test with following PRs:
apple/sourcekit-lsp#640

@swift-ci please test Windows platform

@artemcm
Copy link
Contributor

artemcm commented Sep 27, 2022

Please test with following PRs: apple/sourcekit-lsp#640

@swift-ci please test Windows platform

I think this repository does not support cross-repo testing. :(

@compnerd
Copy link
Collaborator

Unfortunately, the CI currently is build only; please do not merge this without testing on Windows, I am worried that this might regress the test suite.

@stephank
Copy link
Author

Oh hey, Windows is green. But I'm looking at the logs, and can't really find a test run for swift-driver in there, is that correct?

@compnerd
Copy link
Collaborator

Yeah, that is the problem - the CI doesn't actually run the test suite yet. That is something that would be nice to have, but needs work. In the mean time, tests need to be run locally.

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.

None yet

3 participants