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

Handle hash characters (#) in netrc fields #8109

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

Conversation

plemarquand
Copy link
Contributor

Hash symbols were always treated as the beginning of a comment even if they were in the middle of a username or password. To address this require some whitespace before a hash character before a comment is parsed.

That patch also implements support for quoted fields so that passwords can contain the sequence "foo #bar" without dropping "bar" as a comment.

Issue: #8090

Hash symbols were always treated as the beginning of a comment even if
they were in the middle of a username or password. To address this
require some whitespace before a hash character before a comment is
parsed.

That patch also implements support for quoted fields so that passwords
can contain the sequence "foo #bar" without dropping "bar" as a comment.

Issue: swiftlang#8090
Issue
Tests/BasicsTests/NetrcTests.swift Outdated Show resolved Hide resolved
@MaxDesiatov
Copy link
Contributor

@swift-ci test windows

@jakepetroules
Copy link
Contributor

Is there a reference implementation or standard detailing the specific format so we can ensure we're compliant with that?

@plemarquand
Copy link
Contributor Author

@jakepetroules frustratingly, no. I went looking before picking this up and there doesn't seem to be a defined spec.

It seems like the reference implementation is generally accepted to be the Linux ftp client, however none of their documentation mentions comments.

The Python netrc library does seem to support comments, but only if they're on their own line.

Because our implementation already supports comments both on their own line and trailing declarations I think modifying our implementation to match Python's or Linux's would break the parsing of user's existing .netrc files that we successfully parse today.

@plemarquand
Copy link
Contributor Author

@swift-ci please test macOS self hosted

@plemarquand
Copy link
Contributor Author

@swift-ci please test Windows

@swiftlang swiftlang deleted a comment from dschaefer2 Nov 12, 2024
@swiftlang swiftlang deleted a comment from MaxDesiatov Nov 12, 2024
@swiftlang swiftlang deleted a comment from MaxDesiatov Nov 12, 2024
@plemarquand
Copy link
Contributor Author

I deleted some "please test" comments; didn't realize that'd appear as "plemarquand deleted a comment". Not trying to rewrite history here 😅

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.

4 participants