Skip to content

Presence of directories in ~/.ssh/config.d/ breaks parser #784

@jacopo-exact

Description

@jacopo-exact

We use Include config.d/* in our ~/.ssh/config and use git to sync config.d content across our servers. Git creates its .git directory inside ~/.ssh/config.d/, which breaks the config parser with the following traceback.

Albeit one could argue that a more specific glob pattern should be used in the Include statement, ssh ignores directories in its own parsing, and so probably asyncssh should conform.

IsADirectoryError: [Errno 21] Is a directory: '/home/alberto/.ssh/config.d/.git'
File "[REDACTED]/.venv/lib/python3.12/site-packages/asyncssh/misc.py", line 386 in __aenter__
File "[REDACTED]/.venv/lib/python3.12/site-packages/asyncssh/connection.py", line 9184 in connect
File "[REDACTED]/.venv/lib/python3.12/site-packages/asyncssh/connection.py", line 7317 in construct
File "[REDACTED]/.venv/lib/python3.12/site-packages/greenback/_impl.py", line 210 in _greenback_shim
File "[REDACTED]/.local/share/uv/python/cpython-3.12.11-linux-x86_64-gnu/lib/python3.12/concurrent/futures/thread.py", line 59 in run
File "[REDACTED]/.venv/lib/python3.12/site-packages/asyncssh/connection.py", line 7308 in __init__
File "[REDACTED]/.venv/lib/python3.12/site-packages/asyncssh/misc.py", line 478 in __init__
File "[REDACTED]/.venv/lib/python3.12/site-packages/asyncssh/connection.py", line 8146 in prepare
File "[REDACTED]/.venv/lib/python3.12/site-packages/asyncssh/config.py", line 464 in load
File "[REDACTED]/.venv/lib/python3.12/site-packages/asyncssh/config.py", line 424 in parse
File "[REDACTED]/.venv/lib/python3.12/site-packages/asyncssh/config.py", line 155 in _include
File "[REDACTED]/.venv/lib/python3.12/site-packages/asyncssh/config.py", line 373 in parse

Will open a PR shortly. Thanks for the project.
cc @apasto

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions