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

Host matching in fsconfig is too permissive #3

Open
r2evans opened this issue Aug 29, 2024 · 3 comments
Open

Host matching in fsconfig is too permissive #3

r2evans opened this issue Aug 29, 2024 · 3 comments

Comments

@r2evans
Copy link

r2evans commented Aug 29, 2024

If I have two hosts defined, something like

Host host
  blahblah
---
Host otherhost
  blahblah

and then call sshmount -w host, then it will bring in arguments from both host blocks.

Adding one more trailing --- to close out "otherhost" now results in no unique match!, which makes a little more sense, but two things then:

  • Not having a --- on the last host should not cause different behavior, I think; and
  • those two hosts are different, they should be treated differently

I suspect the issue is in fetchHostAttribute, looking.

@r2evans
Copy link
Author

r2evans commented Aug 29, 2024

I think part of the reason you're having to jump through hoops in the functions is that you allow Host hostname to occur in the middle of its definition block. I suggest that if you tighten that so that the block must have that line as its first, then it will make parsing the file much easier and intuitive, mimicking the behavior more of SSH's config file (I believe).

@Fuseteam
Copy link
Owner

Fuseteam commented Oct 7, 2024

hmmm that's an odd one, i would expect host to pull from Host host to ---

@Fuseteam
Copy link
Owner

Fuseteam commented Oct 7, 2024

I think part of the reason you're having to jump through hoops in the functions is that you allow Host hostname to occur in the middle of its definition block. I suggest that if you tighten that so that the block must have that line as its first, then it will make parsing the file much easier and intuitive, mimicking the behavior more of SSH's config file (I believe).

oh i think this was to be able to mount by directory, in those cases i had no way to also get the hostname. the intention there was that would be last however, didn't consider in the middle iirc

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