Bug #15853
closedFix readline test regression when using Readline 4.3
Description
c754e979d3eeca51f1b13778f19f347df3da656e removed the check for Readline 4.3 in a test. Previously, the whole test was skipped on Readline 4.3. However, it turns out that Readline 4.3 runs the test correctly if you skip the same assertion that is skipped when Reline is used. The attached patch skips that assertion when Readline::VERSION
is 4.3.
We may want to consider dropping this assertion completely, it seems to be readline implementation and version dependent behavior.
Files
Updated by mame (Yusuke Endoh) about 5 years ago
- if !defined?(Reline) or Readline != Reline # Reline's rendering logic is tricky
+ unless defined?(Reline) or Readline == Reline or /\A4\.3\z/n.match(Readline::VERSION) # Reline's rendering logic is tricky
The new condition looks not to work when Reline
is not defined.
(Personally I want to avoid unless
for complex condition :-)
Updated by jeremyevans0 (Jeremy Evans) about 5 years ago
mame (Yusuke Endoh) wrote:
- if !defined?(Reline) or Readline != Reline # Reline's rendering logic is tricky + unless defined?(Reline) or Readline == Reline or /\A4\.3\z/n.match(Readline::VERSION) # Reline's rendering logic is tricky
The new condition looks not to work when
Reline
is not defined.(Personally I want to avoid
unless
for complex condition :-)
Correct, sorry about that. How about just eliminating the assertion, since it is readline implementation and version dependent, and of questionable use (who calls Readline.output.read
after Readline.readline
and wants the readline prompt and input to appear)? Attached is a patch for that.
Updated by aycabta (aycabta .) about 5 years ago
The condition was for GNU Readline 4.3's bug but the deletion is my mistake. I agreed with your first proposal. But the first patch is not correct. The defined?(Reline)
doesn't mean that Reline is as Readline so I added a condition that checks Readline
constant is the same as Reline
. It's !defined?(Reline) or Readline != Reline
. So please fix your patch.
The details of the GNU Readline 4.3's bug are as follows.
@naruse (Yui NARUSE) mentioned it at a comment in #5785
https://bugs.ruby-lang.org/issues/5785#note-8
and added a commit 2418f9cc5559ff9d9d62f2139ee7d7a971e7be20
https://bugs.ruby-lang.org/projects/ruby-trunk/repository/git/revisions/2418f9cc5559ff9d9d62f2139ee7d7a971e7be20
and showed log.
http://www.rubyist.net/%7Eakr/chkbuild/debian/ruby-trunk/log/20120501T132800Z.diff.html.gz
+ <n>) Failure: +test_modify_text_in_pre_input_hook(TestReadline) [/extdisk/chkbuild/chkbuild/tmp/build/<buildtime>/ruby/test/readline/test_readline.rb:386]: +<"> hello world\n"> expected but was +<"> ">.
It's a strange behavior and I think it's a GNU Readline's bug. For your information, rlwrap refer to that:
https://github.com/hanslub42/rlwrap/blob/2aea6fc26c5448c16d482f7ec6b1e16adfee0d17/BUGS#L29-L37
Christoffer Dam Bruun reported:
"I have just installed rlwrap along with readline on Solaris 8 and
found that rlwrap did not work properly with readline 4.3. After
linking rlwrap with readline 4.2 it works correctly.What happended using readline 4.3 was that an extra prompt would be
written after the first letter on a line, e.g. with a sqlplus prompt:
SQL>
(now writing select )
SQL> sSQL> select"
GNU Readline 4.3 has many output bugs.
http://git.savannah.gnu.org/cgit/readline.git/tree/CHANGES?id=bcd7f75a2bc2f7c67c9cd6899ff546afa45cbba4
Updated by jeremyevans0 (Jeremy Evans) about 5 years ago
aycabta (aycabta .) wrote:
The condition was for GNU Readline 4.3's bug but the deletion is my mistake. I agreed with your first proposal. But the first patch is not correct. The
defined?(Reline)
doesn't mean that Reline is as Readline so I added a condition that checksReadline
constant is the same asReline
. It's!defined?(Reline) or Readline != Reline
. So please fix your patch.
If you think the assertion is useful, we can definitely keep it and just fix the condition. I think the attached patch should be correct.
Updated by mame (Yusuke Endoh) about 5 years ago
@jeremyevans0 (Jeremy Evans) I think you should have a commit bit. If you don't mind, I'll commend you to a committer and ask matz at the next developers' meeting. What do you think?
Updated by jeremyevans0 (Jeremy Evans) about 5 years ago
mame (Yusuke Endoh) wrote:
@jeremyevans0 (Jeremy Evans) I think you should have a commit bit. If you don't mind, I'll commend you to a committer and ask matz at the next developers' meeting. What do you think?
I would be very honored to be a ruby committer. If matz approves, I will definitely accept a commit bit. Thank you.
Updated by matz (Yukihiro Matsumoto) about 5 years ago
@jeremyevans0 (Jeremy Evans) Welcome to the committers.
Matz.
Updated by mame (Yusuke Endoh) about 5 years ago
@jeremyevans0 (Jeremy Evans) Congrats! Please wait for @hsbt's guidance. (He will ask you to send your ssh key.)
Updated by aycabta (aycabta .) about 5 years ago
Thanks a lot! I think that your v3 patch is correct...so please commit it yourself. Welcome.
Updated by jeremyevans (Jeremy Evans) about 5 years ago
- Status changed from Open to Closed
Applied in changeset git|f91b1ab33d397fdcdf452d563d7f59469a078d88.
Skip assertion in readline test if Readline version is 4.3
Previously, the entire method was not run for Readline 4.3, probably
because it was known to fail. Commit
c754e979d3eeca51f1b13778f19f347df3da656e removed the check for
Readline 4.3. Other than this one assertion, which also doesn't
work when using Reline, the method runs correctly when using
Readline 4.3.
Fixes [Bug #15853].