Skip to content

Conversation

@alindeman
Copy link
Contributor

  • This is important because it allows new keys to be added via `cat ...

    ~/.ssh/authorized_keysorecho ... >> ~/.ssh/authorized_keysWithout a newline at the end of the file>>` will concat text to the
    end of the last key, mangling the file.

  • These modifications should handle files that currently do and do not
    have newlines at the very end, though it will always write files
    that do have newlines at the very end.

* This is important because it allows new keys to be added via `cat ...
  >> ~/.ssh/authorized_keys` or `echo ... >> ~/.ssh/authorized_keys`
  Without a newline at the end of the file `>>` will concat text to the
  end of the last key, mangling the file.
* These modifications should handle files that currently do *and* do not
  have newlines at the very end, though it will always write files
  that *do* have newlines at the very end.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we still want a newline if content.empty?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually - scratch that. We don't need a newline if the content is empty 😄

@chrishunt
Copy link
Owner

Just a couple quick notes, but looks awesome ❤️

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might need to update this test to satisfy keys_file.rb#L60

content = keys_file.read
expect(content).to end_with("\n") unless content.empty?

@chrishunt chrishunt merged commit d07c8e2 into chrishunt:master Aug 21, 2013
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

Successfully merging this pull request may close these issues.

2 participants