Project

General

Profile

Bug #13858

getoptlong cannot process multiple line argument with equal sign (=) version

Added by iefoaix (Michael Wang) almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
[ruby-core:82627]

Description

Here is the test case:

more getopt.rb

require 'getoptlong'

a=GetoptLong.new(
[ '--user', '-u', GetoptLong::REQUIRED_ARGUMENT ],
[ '--statement', '-s', GetoptLong::REQUIRED_ARGUMENT ],
)

a.each { |x, y|
p x
p y
}

Here is the problem:

ruby getopt.rb --user me --statement="

select now() from dual
"

"--user"
"me"
"--statement"
""

Please note the statement is empty while it is not. On contrary, without "=" sign it works fine:

ruby getopt.rb --user me --statement "

select now() from dual
"

"--user"
"me"
"--statement"
"\nselect now() from dual\n"

It is believed this bug is due to the regex that GetoptLong uses to parse the argument for long opts. Please investigate and fix, thanks!

Associated revisions

Revision 0f6e7edf
Added by nobu (Nobuyoshi Nakada) almost 2 years ago

getoptlong.rb: multiline regexps

  • lib/getoptlong.rb: make regexps multiline safe. [ruby-core:82627] [Bug #13858]

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

Revision 59722
Added by nobu (Nobuyoshi Nakada) almost 2 years ago

getoptlong.rb: multiline regexps

  • lib/getoptlong.rb: make regexps multiline safe. [ruby-core:82627] [Bug #13858]

Revision 59722
Added by nobu (Nobuyoshi Nakada) almost 2 years ago

getoptlong.rb: multiline regexps

  • lib/getoptlong.rb: make regexps multiline safe. [ruby-core:82627] [Bug #13858]

Revision 59722
Added by nobu (Nobuyoshi Nakada) almost 2 years ago

getoptlong.rb: multiline regexps

  • lib/getoptlong.rb: make regexps multiline safe. [ruby-core:82627] [Bug #13858]

History

#1

Updated by nobu (Nobuyoshi Nakada) almost 2 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r59722.


getoptlong.rb: multiline regexps

  • lib/getoptlong.rb: make regexps multiline safe. [ruby-core:82627] [Bug #13858]

Also available in: Atom PDF