Skip to content

Fix line number for known_hosts error messages. - #401

Closed
dylanahsmith wants to merge 1 commit into
paramiko:masterfrom
dylanahsmith:fix-host-key-lineno
Closed

dylanahsmith wants to merge 1 commit into
paramiko:masterfrom
dylanahsmith:fix-host-key-lineno

Conversation

@dylanahsmith

Copy link
Copy Markdown
Contributor

Line number for files conventionally start with 1, but using for lineno, line in enumerate(f): would consider the first line to be line 0.

Passing an initial value of 1 to enumerate will fix this line number.

@bitprophet

Copy link
Copy Markdown
Member

Took me a while to realize that this only impacts log lines and not actual exceptions. 😩 One can reproduce the incorrect-line-number messages by enabling logging, mangling a known_hosts file so it includes lines like e.g. foo (vs foo ssh-rsa <key text>) and then calling e.g. SSHClient.load_system_host_keys.

@bitprophet

Copy link
Copy Markdown
Member

Also, no idea why I punted this to 1.16.

@bitprophet bitprophet removed this from the 1.16 milestone Nov 3, 2015
@bitprophet bitprophet closed this in 3a5227c Nov 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants