Project

General

Profile

Actions

Bug #21045

closed

[patch & workaround] "make test-all" failed with FreeBSD 13.4

Added by hs (Hideki Sakamoto) 1 day ago. Updated about 15 hours ago.

Status:
Feedback
Assignee:
-
Target version:
-
[ruby-core:120715]

Description

"make test-all" fails when building Ruby 3.4.1 on FreeBSD 13.4.

Build and test steps:

% freebsd-version 
13.4-RELEASE-p2
% tar xf ruby-3.4.1.tar.xz
% cd ruby-3.4.1/
% ./configure
% make
% make test-all

 (snip)

  1) Error:
TestNetHTTPForceEncoding#test_response_body_encoding_encoding_without_content_type:
Errno::ECONNREFUSED: Failed to open TCP connection to localhost:34716 (Connection refused - connect(2) for "localhost" port 34716)
    /tmp/ruby-3.4.1/lib/net/http.rb:1659:in 'TCPSocket#initialize'
    /tmp/ruby-3.4.1/lib/net/http.rb:1659:in 'IO.open'
    /tmp/ruby-3.4.1/lib/net/http.rb:1659:in 'block in Net::HTTP#connect'
    /tmp/ruby-3.4.1/lib/timeout.rb:185:in 'block in Timeout.timeout'
    /tmp/ruby-3.4.1/lib/timeout.rb:192:in 'Timeout.timeout'
    /tmp/ruby-3.4.1/lib/net/http.rb:1657:in 'Net::HTTP#connect'
    /tmp/ruby-3.4.1/lib/net/http.rb:1636:in 'Net::HTTP#do_start'
    /tmp/ruby-3.4.1/lib/net/http.rb:1625:in 'Net::HTTP#start'
    /tmp/ruby-3.4.1/lib/net/http.rb:2369:in 'Net::HTTP#request'
    /tmp/ruby-3.4.1/lib/net/http.rb:1984:in 'Net::HTTP#get'
    /tmp/ruby-3.4.1/test/net/http/test_http.rb:1344:in 'TestNetHTTPForceEncoding#fe_request'
    /tmp/ruby-3.4.1/test/net/http/test_http.rb:1372:in 'TestNetHTTPForceEncoding#test_response_body_encoding_encoding_without_content_type'

 (snip)

Finished tests in 672.429322s, 47.6734 tests/s, 9743.0849 assertions/s.                                                            
32057 tests, 6551536 assertions, 0 failures, 7 errors, 192 skips

ruby -v: ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [x86_64-freebsd13.4]
*** Error code 7

1. Seven tests in test/net/http/test_http.rb error with "(Connection refused - connect(2) for "localhost" port #####)"

These errors appear to be caused by the client in function "fe_request"( test/net/http/test_http.rb ) trying to connect to IPv4 ('127.0.0.1') address:

  1324    CONFIG = {
* 1325      'host' => 'localhost',
  1326      'proxy_host' => nil,
  1327      'proxy_port' => nil,
  1328    }
  1329  
  1330    include TestNetHTTPUtils
  1331  
  1332    def fe_request(force_enc, content_type=nil)
  1333      @server.mount_proc('/fe') do |req, res|
  1334        res['Content-Type'] = content_type if content_type
  1335        res.body = "hello\u1234"
  1336      end
  1337  
* 1338      http = Net::HTTP.new(config('host'), config('port'))
  1339      http.local_host = Addrinfo.tcp(config('host'), config('port')).ip_address
  1340      assert_not_nil(http.local_host)
  1341      assert_nil(http.local_port)
  1342  
  1343      http.response_body_encoding = force_enc
  1344      http.get('/fe')
  1345    end

while the @server on line 12 of test/net/http/utils.rb listens on a socket with an IPv6 address (':: 1') when tested with ' localhost '.

     9    class HTTPServer
    10      def initialize(config, &block)
    11        @config = config
*   12        @server = TCPServer.new(@config['host'], 0)
    13        @port = @server.addr[1]
    14        @procs = {}

I wasn't sure if this was a bug to fix.

As a workaround, remove the following line from /etc/hosts file to eliminate this error:

::1			localhost ...

2. make test-all stops with "*** Error code 7" after all tests are finished.

This is probably a bug in FreeBSD's make command, but it seems to be caused by two spaces at the end of the last command executed when running make test-all:

exec ./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems -r./tool/lib/_tmpdir "./test/runner.rb" --ruby="./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems" --excludes-dir=./test/.excludes --name=!/memory_leak/  ←(*here!!)

To fix this error, modify common.mk line 317 or 965 using attachments(one or the other is sufficient) :

% patch < patch-common.mk-TEST_EXCLUDE.txt 

(or)

% patch < patch-common.mk-yes-test-all.txt

Then re-create the Makefile so that "make test-all" completes successfully.

% ./configure
% make test-all
	BASERUBY = /usr/local/bin/ruby --disable=gems
	CC = clang
	LD = ld
	LDSHARED = clang -shared
	CFLAGS = -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fdeclspec  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef 
	XCFLAGS = -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -fPIE -I. -I.ext/include/x86_64-freebsd13.4 -I./include -I. -I./prism -I./enc/unicode/15.0.0   -Dmodular_gc_dir=
	CPPFLAGS =   
	DLDFLAGS = -Wl,--compress-debug-sections=zlib -Wl,-soname,showflags -fstack-protector-strong -pie  
	SOLIBS = -lexecinfo -lprocstat -lz -lrt -lrt -ldl -lcrypt -lm -lthr
	LANG = ja_JP.UTF-8
	LC_ALL = 
	LC_CTYPE = 
	MFLAGS =  
	RUSTC = no
	YJIT_RUSTC_ARGS = --crate-name=yjit  --crate-type=staticlib  --edition=2021  -g  -C lto=thin  -C opt-level=3  -C overflow-checks=on  '--out-dir=/mnt/home/sakamoto/ruby-3.4.1/yjit/target/release/'  ./yjit/src/lib.rs
FreeBSD clang version 18.1.6 (https://github.com/llvm/llvm-project.git llvmorg-18.1.6-0-g1118c2e05e67)
Target: x86_64-unknown-freebsd13.4
Thread model: posix
InstalledDir: /usr/bin
generating enc.mk
generating encdb.h
encdb.h unchanged
making enc
making srcs under enc
generating transdb.h
transdb.h unchanged
making trans
making encs
generating makefiles ext/configure-ext.mk
ext/configure-ext.mk unchanged
installing default coverage libraries
installing default date_core libraries
installing digest libraries
installing default digest libraries
installing default sha2 libraries
installing default fiddle libraries
installing default console libraries
installing default libraries
installing default monitor libraries
installing default objspace libraries
installing default openssl libraries
installing default pathname libraries
installing default psych libraries
installing default pty libraries
installing default ripper libraries
installing default libraries
installing default socket libraries
installing default strscan libraries
`ruby' is up to date.
Run options: 
  --seed=37281
  "--ruby=./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems"
  --excludes-dir=./test/.excludes
  --name=!/memory_leak/
  --

# Running tests:

Finished tests in 669.890724s, 47.8541 tests/s, 9779.2801 assertions/s.                                                                       
32057 tests, 6551049 assertions, 0 failures, 0 errors, 191 skips

ruby -v: ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [x86_64-freebsd13.4]
%

Now "make check" will pass all tests and return "check succeeded" and exit normally (ruby34-make-check.txt).


Files

patch-common.mk-TEST_EXCLUDE.txt (433 Bytes) patch-common.mk-TEST_EXCLUDE.txt hs (Hideki Sakamoto), 01/16/2025 02:38 PM
patch-common.mk-yes-test-all.txt (373 Bytes) patch-common.mk-yes-test-all.txt hs (Hideki Sakamoto), 01/16/2025 02:38 PM
ruby34-make-check.txt (14.7 KB) ruby34-make-check.txt hs (Hideki Sakamoto), 01/16/2025 03:01 PM

Updated by nobu (Nobuyoshi Nakada) about 23 hours ago · Edited

I tried master on FreeBSD 13.4-RELEASE-p1, and make test-all worked fine.
Is it a regression of make at p1?

Updated by nobu (Nobuyoshi Nakada) about 23 hours ago

  • Status changed from Open to Feedback

14.1-RELEASE too.

Updated by hs (Hideki Sakamoto) about 15 hours ago · Edited

I'm sorry, but I have already upgraded all my local environments to 13.4-RELEASE-p2, so I cannot revert to p1 to check.

The situation is that the timestamp of /usr/bin/make is Nov 12, which is the date when I updated my OS from p1 to p2(released 2024-10-29) using freebsd-update command, so I can't deny the possibility that the upgrade to p2 may have had an effect.

% which make
/usr/bin/make
% ls -l `which make`
-r-xr-xr-x  2 root  wheel  208640 Nov 12 16:52 /usr/bin/make
% sha1 /usr/bin/make
SHA1 (/usr/bin/make) = bce0d038e2fe1ec2d18740ddedd1477fcfe819ca
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0