Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Ensure #dump doesn't add a new line in config #2823

Merged
merged 2 commits into from Feb 17, 2014

Conversation

kgrz
Copy link
Contributor

@kgrz kgrz commented Jan 15, 2014

Fixes #2821

  • YAML#dump without any option parameters hard-wraps a string at 80
    characters and this causes errors while reading the config file
    and parsing it.

  • There is another way to fix this: Modify the Regex that is used for
    parsing the config file. The current regex supports only a single line
    of "key: value" type statements. Presumably, YAML#load is not used for
    security reasons and so, this is the only other option.

    modified: lib/bundler/settings.rb
    modified: spec/commands/config_spec.rb

@kgrz
Copy link
Contributor Author

kgrz commented Jan 15, 2014

Not sure whether Syck#dump supports the line_width argument. Went through the source code of Syck and there is a setting for the line-width (search for best_width) and there are methods that return various styles of output which take this width into consideration but I was not able to figure out what the option keys were. :/

Fixes rubygems#2821

* YAML#dump without any option parameters hard-wraps a string at 80
  characters and this causes errors while reading the config file
  and parsing it.

* There is another way to fix this: Modify the Regex that is used for
  parsing the config file. The current regex supports only a single line
  of "key: value" type statements. Presumably, YAML#load is not used for
  security reasons and so, this is the only other option.

	modified:   lib/bundler/settings.rb
	modified:   spec/commands/config_spec.rb
@indirect
Copy link
Member

I guess worst case, limit this change to 1.9 and greater? We still need to have the dumping and parsing work on 1.8.7, even if we can't fix the wrapping bug. (I would also be open to a regex change that handles the line breaks).

@kgrz
Copy link
Contributor Author

kgrz commented Jan 31, 2014

Yeah, I think a regex change would be the best solution until bundler is `> 1.9.x' only. Will try that out.

* The option :line_width is available only in the YAML library and not
 in the older Syck and since we need to cater to installations that run
 Ruby versions below 1.9, this solution is not useful.

* The new regex will take into account newlines and will parse the
 configuration options accordingly. This makes it work even in Ruby
 1.8.7
@kgrz
Copy link
Contributor Author

kgrz commented Feb 1, 2014

The failure in Travis is not related to the changed code.

indirect added a commit that referenced this pull request Feb 17, 2014
Ensure #dump doesn't add a new line in config
@indirect indirect merged commit 0dfbee1 into rubygems:master Feb 17, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bundle config truncates longer values
2 participants