Project

General

Profile

Actions

Bug #18263

closed

"make install" crashed when Ruby3.0.2 clean install. (in japanese)

Added by tksotn (TAKASHI OOTANI) about 3 years ago. Updated about 3 years ago.

Status:
Third Party's Issue
Assignee:
-
Target version:
-
ruby -v:
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]
[ruby-dev:51102]

Description

本日 gem update を行った後、gem コマンドが異常終了するようになってしまいました。

/usr/local/lib/ruby/gems/3.0.0/gems/psych-4.0.2/lib/psych.rb:455: [BUG] Segmentation fault at 0xffffffff9ade4120
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]

OSは、CentOS Linux release 8.4.2105 です。

gem update自体は正常に終了しました。その直後の gem clean でこけています。
gem だけでもこけます。OS再起動後にも同様。

昨日までは異常なく、昨日今日に dnf install や update でインストール・更新した
OSパッケージはログを見る限りないです。

念のため、PATHからインストール先の/usr/local/binを外した状態で、
tar.gzから新規ディレクトリを--prefix指定してconfigureして
まっさらな環境にインストールしてみようとしましたが、
make install の時点で同じエラーになります。
ということは、gem updateは原因では無いという事になるかと思います。

上記の、configure、make、make test、make check (これは以前からこける)、
make installと、dnf list のリストを添付します。

よろしくお願いします。

本日のgem update対象:
fileutils-1.6.0/
io-wait-0.2.0/
net-http-0.2.0/
net-protocol-0.1.2/
optparse-0.2.0/
ostruct-0.5.0/
pp-0.2.1/
prettyprint-0.1.1/
readline-ext-0.1.3/
rinda-0.1.1/
securerandom-0.1.1/
stringio-3.0.1/
uri-0.11.0/
net-ftp-0.1.2/
minitest-5.14.2/
power_assert-1.2.0/
rake-13.0.3/


Files

LOG.tar.gz (243 KB) LOG.tar.gz log of configure and make tksotn (TAKASHI OOTANI), 10/22/2021 12:18 PM

Updated by xtkoba (Tee KOBAYASHI) about 3 years ago

From LOG.make:

compiling ../.././ext/psych/yaml/api.c
../.././ext/psych/yaml/api.c: 関数 ‘yaml_strdup’ 内:
../.././ext/psych/yaml/api.c:66:27: 警告: implicit declaration of function ‘strdup’; did you mean ‘cmp’? [-Wimplicit-function-declaration]
     return (yaml_char_t *)strdup((char *)str);
                           ^~~~~~
                           strcmp
../.././ext/psych/yaml/api.c:66:12: 警告: 異なるサイズの整数からポインタへのキャストです [-Wint-to-pointer-cast]
     return (yaml_char_t *)strdup((char *)str);
            ^

The compiler assumes that strdup(3) is implicitly declared as int strdup();, which is of course not correct and should be instead as follows:

char *strdup(const char *s);

I have no idea as to why strdup(3) is not declared here. For instance, on my GNU/Linux environment it is declared in <string.h> which is included (indirectly) in ext/psych/yaml/api.c.

A workaround would be to add the correct declaration in ext/psych/yaml/api.c.

Updated by xtkoba (Tee KOBAYASHI) about 3 years ago

Gotcha.

	CFLAGS = -std=c99 -pedantic -Wall

strdup(3) is not declared because of -std=c99. Try instead with -std=gnu99. You can alternatively append -D_DEFAULT_SOURCE to make it declared.

You may also have an option to install libyaml-devel distributed by CentOS to avoid building libyaml which is bundled in a Ruby source tarball.

Updated by tksotn (TAKASHI OOTANI) about 3 years ago

Thank you xtkoba san.

After "dnf install libyaml-devel", "make install" and "make check" now completed without crash.
and "gem list" etc. also completed normally.

"make check" still has some errors,

Finished tests in 2156.244216s, 9.7883 tests/s, 1238.1214 assertions/s.
21106 tests, 2669692 assertions, 188 failures, 14 errors, 52 skips

but for the time being, the troubles have been resolved.

thank you very much.

Updated by jeremyevans0 (Jeremy Evans) about 3 years ago

  • Status changed from Open to Third Party's Issue

It looks like this may be an issue with the embedded version of libyaml that Ruby ships. If so, it should be fixed upstream in libyaml (https://github.com/yaml/libyaml), and then a pull request or issue should be filed to https://github.com/ruby/psych to update the embedded copy.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0