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

Consideration of aligning cases to lower case when compute to match OpenSSH behavior #88

Open
xhiroga opened this issue Dec 28, 2024 · 1 comment

Comments

@xhiroga
Copy link

xhiroga commented Dec 28, 2024

Summary

OpenSSH treats configuration directives case-insensitively, but ssh-config does not. For example:

Host example
    hOsTnaME 1.2.3.4
% ssh -G example
host example
hostname 1.2.3.4

However, SSHConfig.compute() keeps case and developer should be consider it.

Proposal

Add a mechanism to handle directives in a case-insensitive manner to match OpenSSH. Possible approaches include:

  1. Always normalize directive names to lowercase internally.
  2. Add an option such as ignoreCase: true for compute() to unify case.
  3. Maintain both the original and lowercase versions of the directive.

It would be great if ssh-config could support case-insensitive directives to better align with OpenSSH behavior. I'd be happy to contribute a PR if there's a preferred approach.

@cyjake
Copy link
Owner

cyjake commented Dec 31, 2024

I'd prefer the second approach, such as compute(host, { lowerCase: true }), to ignore case sensitivity and to convert the parameter names in the result to lower case. Future major release may opt in this flag by default.

Please feel free to send PR :-D

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

No branches or pull requests

2 participants