Bug 2412227 - ruby: FTBFS in Fedora Rawhide
Summary: ruby: FTBFS in Fedora Rawhide
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: ruby
Version: rawhide
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Vít Ondruch
QA Contact: Fedora Extras Quality Assurance
URL: https://koschei.fedoraproject.org/pac...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-11-04 10:15 UTC by Vít Ondruch
Modified: 2025-12-18 10:08 UTC (History)
19 users (show)

Fixed In Version: ruby-3.4.8-29.fc44
Clone Of:
Environment:
Last Closed: 2025-12-18 10:08:24 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Vít Ondruch 2025-11-04 10:15:53 UTC
The Ruby test suite started to fail with following error:

~~~
1)
Math.lgamma returns [Infinity, 1] when passed -1 FAILED
Expected [Infinity, -1] == [Infinity, 1]
to be truthy but was false
~~~

From the list of modified dependencies, the glibc-2.42.9000-8.fc44 is my best bet. The changelog mentions: "math: Use lgamma from CORE-MATH" which might be related.

Reproducible: Always

Comment 1 Florian Weimer 2025-11-04 12:50:31 UTC
The gamma function has a pole at -1, so the sign is mathematically undefined. I don't see POSIX requirement for any specific result here, either.

https://en.wikipedia.org/wiki/Gamma_function

Comment 2 Mamoru TASAKA 2025-11-04 13:45:57 UTC
The following is failing:

======================================================================
#include <math.h>
#include <stdlib.h>
#include <stdio.h>

#define MY_ASSERT(expr) \
do { \
	if (!(expr)) { \
		fprintf(stderr, "At line [%d] expr \"" #expr "\" failed\n", __LINE__); \
		abort(); \
	} \
} while(0)

int main(void) {
	int sign = 0;
	double ret = lgamma_r(-1, &sign);
	MY_ASSERT(ret == HUGE_VAL);
	MY_ASSERT(sign == 1);

}
======================================================================
With glibc glibc-2.42.9000-8.fc44.x86_64:

======================================================================
At line [17] expr "sign == 1" failed
Aborted
======================================================================


POSIX.1-2024 explicitly says
(e.g. https://pubs.opengroup.org/onlinepubs/9799919799/functions/lgamma.html)

If \(x\) is a non-positive integer, a pole error shall occur and 
lgamma(), lgammaf(), and lgammal() shall return +HUGE_VAL, +HUGE_VALF, and +HUGE_VALL, respectively.

So lgamma(-1) shall return +HUGE_VAL , so the sign of the return value shall be positive.

Comment 3 Florian Weimer 2025-11-04 13:47:57 UTC
The return value is HUGE_VAL according to the test, so it is positive. POSIX does not say anything about the sign.

Comment 4 Mamoru TASAKA 2025-11-04 13:53:55 UTC
Ah... actually

If \(x\) is NaN, -Inf, or a negative integer, the value of signgam is unspecified.

So looks like this should be fixed in ruby side.

Comment 6 Mamoru TASAKA 2025-11-04 14:22:46 UTC
Filed: https://bugs.ruby-lang.org/issues/21666

Comment 7 Florian Weimer 2025-11-04 15:21:19 UTC
Thanks!

Comment 8 Mamoru TASAKA 2025-11-14 13:58:45 UTC
This should be fixed by https://github.com/ruby/ruby/pull/15076 .

Comment 9 Fedora Update System 2025-12-18 10:03:43 UTC
FEDORA-2025-5a2525c8c1 (ruby-3.4.8-29.fc44) has been submitted as an update to Fedora 44.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-5a2525c8c1

Comment 10 Fedora Update System 2025-12-18 10:08:24 UTC
FEDORA-2025-5a2525c8c1 (ruby-3.4.8-29.fc44) has been pushed to the Fedora 44 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.