Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Optparse passes incorrect options when casting to a Regexp #82

Closed
wants to merge 2 commits into
from

Conversation

2 participants

In the optparse library, the wrong string is used to remove the i, m, and x options from the encoding options when casting an argument to a Regexp. It removes all characters that are NOT i, m, or x. This results in the wrong options being passed as the third argument of Regexp.new.

optparse.rb:1714: warning: encoding option is ignored - %s is thrown when valid options are passed as an argument, even though the options i, m, and x are correctly interpreted. Also, the encoding of a Regexp argument cannot be set.

Owner

msgerbush commented on ae6ebd2 Jan 11, 2012

Should not have used regex syntax here, delete takes a string. This was deleting all characters in the intersection of o and the characters [,^,i,m,x, and ].

Owner

shyouhei commented Jan 16, 2012

Seems nobu merged this. Thank you.

@shyouhei shyouhei closed this Jan 16, 2012

@bdwalton bdwalton pushed a commit to bdwalton/ruby that referenced this pull request Feb 11, 2012

@drbrain drbrain * lib/rubygems: Import RubyGems 1.8.7:
	  Added missing require for `gem uninstall --format-executable`.

	  The correct name of the executable being uninstalled is now displayed
	  with --format-executable.

	  Fixed `gem unpack uninstalled_gem` default version picker.

	  RubyGems no longer claims a nonexistent gem can be uninstalled.

	  `gem which` no longer claims directories are requirable files.

	  `gem cleanup` continues cleaning up gems if one can't be uninstalled
	  due to permissions.  Issue #82.

	  Gem repository directories are no longer created world-writable.
	  Patch by Sakuro OZAWA.  [Ruby 1.9 - Bug #4930]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
3434676

@voxik voxik pushed a commit to voxik/ruby that referenced this pull request May 11, 2012

@drbrain drbrain * lib/rubygems: Import RubyGems 1.8.7:
	  Added missing require for `gem uninstall --format-executable`.

	  The correct name of the executable being uninstalled is now displayed
	  with --format-executable.

	  Fixed `gem unpack uninstalled_gem` default version picker.

	  RubyGems no longer claims a nonexistent gem can be uninstalled.

	  `gem which` no longer claims directories are requirable files.

	  `gem cleanup` continues cleaning up gems if one can't be uninstalled
	  due to permissions.  Issue #82.

	  Gem repository directories are no longer created world-writable.
	  Patch by Sakuro OZAWA.  [Ruby 1.9 - Bug #4930]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
06d8902

@szuecs szuecs pushed a commit to szuecs/ruby that referenced this pull request Dec 11, 2013

@nobu nobu * lib/optparse.rb (Regexp): fix incorrect options when casting to
  a Regexp, and suppress encoding option warnings.
  ruby#82


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
de1e488

@tenderlove tenderlove pushed a commit to tenderlove/ruby that referenced this pull request Jan 24, 2014

@nobu nobu * lib/optparse.rb (Regexp): fix incorrect options when casting to
  a Regexp, and suppress encoding option warnings.
  ruby#82


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
8d0b236
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment