cyjake / ssh-config

📟 SSH config parser and stringifier
MIT License
80 stars 20 forks source link

Can't parse config with wildcards in Match statement #74

Closed lpsinger closed 8 months ago

lpsinger commented 8 months ago

I isolated the following failure from VS Code not being able to parse my .ssh/config file. The following script:

// test.js
const SSHConfig = require('ssh-config')

SSHConfig.parse(`
Match host=*.ligo-*.caltech.edu
User albert.einstein
`)

fails with the following error message under ssh-config@4.4.1:

$ node test.js 
/private/tmp/foo/node_modules/ssh-config/src/ssh-config.js:453
                            throw new Error(`Missing value for match criteria ${keyword}`);
                            ^

Error: Missing value for match criteria host=*.ligo-*.caltech.edu
    at directive (/private/tmp/foo/node_modules/ssh-config/src/ssh-config.js:453:35)
    at line (/private/tmp/foo/node_modules/ssh-config/src/ssh-config.js:466:48)
    at Object.parse (/private/tmp/foo/node_modules/ssh-config/src/ssh-config.js:473:20)
    at Object.<anonymous> (/private/tmp/foo/test.js:4:11)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.11.0

The last version that did not crash was ssh-config@4.2.1.