Project

General

Profile

Actions

Bug #14786

closed

PTY duplicated "\r" problem on Solaris

Bug #14786: PTY duplicated "\r" problem on Solaris

Added by ngoto (Naohisa Goto) over 7 years ago. Updated over 7 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-dev:50552]

Description

Solaris 10 にて、コンパイル時のオプション、実行時の環境やそれらの組み合わせにより、
make test-all にて以下の Failure や Error が出る場合があります。
(r63444 にて確認)

TestPTYTestIO_ConsoleのFailureを見るとわかりやすいですが、
PTYが返す文字列に余計な "\r" が付加されています。
TestRubyOptions のエラーは、余計な "\r" が無いことを仮定して子プロセスをPTY内で走らせているために発生したようです。

PerlモジュールIPC-Runにて、Solaris上のPTYにおける同様の現象の発生が報告されていました。
https://rt.cpan.org/Public/Bug/Display.html?id=20105#txn-1306129
このPerlモジュールでは、"\r" を複数許すようなパターンを使うことで回避したようです。

Solaris以外でも "\r\r" になる現象の発生があるようです。
Pythonの Lib/test/test_pty.py には、OSF/1 (Tru64) にて発生しているようなコメントが書かれています。
https://github.com/python/cpython/blob/825aab95fde959541859383f8ea7e7854ebfd49f/Lib/test/test_pty.py#L48

 # OSF/1 (Tru64) apparently turns \n into \r\r\n. if data.endswith(b'\r\r\n'): return data.replace(b'\r\r\n', b'\n') 

以下が make test-all 時のFailureやErrorの抜粋です。

 2) Failure: TestIO_Console#test_cooked [/XXXXXXXX-63444/test/io/console/test_io_console.rb:93]: <"def\r\n"> expected but was <"def\r\r\n">. 3) Failure: TestIO_Console#test_noecho2 [/XXXXXXXX-63444/test/io/console/test_io_console.rb:130]: <"a\r\n" + "b\r\n"> expected but was <"a\r\n" + "a\r\r\n" + "b\r\r">. 4) Failure: TestIO_Console#test_raw [/XXXXXXXX-63444/test/io/console/test_io_console.rb:18]: <"abc\r\n"> expected but was <"abc\r\r\n">. 5) Failure: TestIO_Console#test_setecho2 [/XXXXXXXX-63444/test/io/console/test_io_console.rb:168]: <"a\r\n" + "b\r\n"> expected but was <"a\r\n" + "a\r\r\n" + "b\r\r">. 6) Failure: TestPTY#test_argv0 [/XXXXXXXX-63444/test/test_pty.rb:58]: <"bar\r\n"> expected but was <"bar\r\r\n">. 7) Failure: TestPTY#test_commandline [/XXXXXXXX-63444/test/test_pty.rb:44]: <"foo\r\n"> expected but was <"foo\r\r\n">. 8) Failure: TestPTY#test_open [/XXXXXXXX-63444/test/test_pty.rb:131]: <"foo"> expected but was <"foo\r">. 9) Failure: TestPTY#test_spawn_with_block [/XXXXXXXX-63444/test/test_pty.rb:29]: <"b\r\n"> expected but was <"b\r\r\n">. 10) Failure: TestPTY#test_spawn_without_block [/XXXXXXXX-63444/test/test_pty.rb:19]: <"a\r\n"> expected but was <"a\r\r\n">. 11) Failure: TestRubyOptions#test_script_from_stdin [/XXXXXXXX-63444/test/ruby/test_rubyoptions.rb:775]: [ruby-dev:37798]. Exception raised: <#<Timeout::Error: execution expired>>. 12) Failure: TestRubyOptions#test_script_from_stdin [/XXXXXXXX-63444/test/lib/zombie_hunter.rb:9]: Expected [[11281, #<Process::Status: pid 11281 exit 0>]] to be empty. 
Actions

Also available in: PDF Atom