🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #2112

Bug#1152056: rustc: Fix test_rwlock_max_readers hanging on non-linux 32b archs

#2112
From: Samuel Thibault
Date: Sun, 25 Oct 2026 20:10
110 lines
5744 bytes
--JmQjSSKDWhJ6FPFg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Package: rustc
Version: 1.97.1+dfsg1-1
Severity: important
Tags: patch upstream
Forwarded: https://github.com/rust-lang/rust/pull/164764

Hello,

test_rwlock_max_readers currently hangs on non-linux 32b archs, making
the build get stuck on hurd-i386, the attached patch was applied
upstream to fix this, could you apply it?

Thanks,
Samuel

-- System Information:
Debian Release: forky/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'stable-security'), (500, 'stable-debug'), (500, 'proposed-updates'), (500, 'oldstable-debug'), (500, 'oldoldstable'), (500, 'buildd-unstable'), (500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental-debug'), (1, 'buildd-experimental'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, arm64

Kernel: Linux 7.2.9+deb14-amd64 (SMP w/22 CPU threads; PREEMPT)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages rustc depends on:
ii  binutils              2.47-6
ii  gcc                   4:16.1.0-3
ii  libc6                 2.43-7
ii  libc6-dev [libc-dev]  2.43-7
ii  libgcc-s1             16.2.0-3
ii  libstd-rust-dev       1.97.1+dfsg1-1

Versions of packages rustc recommends:
ii  cargo      1.97.1+dfsg1-1
ii  rust-llvm  1.97.1+dfsg1-1

rustc suggests no packages.

-- no debconf information

-- 
Samuel
"I don't know why, but first C programs tend to look a lot worse than
first programs in any other language (maybe except for fortran, but then
I suspect all fortran programs look like `firsts')"
(By Olaf Kirch)

--JmQjSSKDWhJ6FPFg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch

commit dfa3e66f7344e39da3bd6c9c58acb14ebd286db1
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Sun Oct 25 04:50:40 2026 +0000

    Test(lib/sync): Fix `test_rwlock_max_readers` for 32bit architectures
    
    * Test(lib/sync): Fix `test_rwlock_max_readers` for 32bit architectures
    
    962e9e2aab0d ("Fix `test_rwlock_max_readers` for x86 Win7") detected the
    issue but fixed it only for windows.
    
    As mentioned in the comment above the test, with the queue implementation,
    the counter for the number of threads has 4 bits reserved for management. On
    64bit platforms, there are still ample room for u32::MAX readers, but on 32b
    platforms, only 2^28-1 readers can fit. We can still test u32::MAX readers
    on 64b platforms, thus keeping the min with usize::MAX >> 4.
    
    Fixes 83a7a4ad74ad ("Clarified docs in std::sync::RwLock and added a test
    that checks if we can reach max reader")
    
    Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Index: rustc-1.97.1+dfsg1/library/std/tests/sync/rwlock.rs
===================================================================
--- rustc-1.97.1+dfsg1.orig/library/std/tests/sync/rwlock.rs
+++ rustc-1.97.1+dfsg1/library/std/tests/sync/rwlock.rs
@@ -923,16 +923,16 @@ fn test_rwlock_max_readers() {
         },
         any(
             target_family = "unix",
-            all(target_os = "windows", target_vendor = "win7", target_pointer_width = "64"),
+            all(target_os = "windows", target_vendor = "win7"),
             all(target_vendor = "fortanix", target_env = "sgx"),
             target_os = "xous",
             target_os = "teeos",
         ) => {
-            u32::MAX
-        },
-        // Otherwise a form of deadlock is observed.
-        all(target_os = "windows", target_vendor = "win7", target_pointer_width = "32") => {
-            (1 << 28) - 1
+            if usize::BITS - 4 > u32::BITS {
+                u32::MAX
+            } else {
+                (usize::MAX >> 4) as u32
+            }
         },
         target_os = "solid_asp3" => {
             (1 << 30)

--JmQjSSKDWhJ6FPFg--
Technical Details
Message-ID: <NScHw-7QFe-15@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!bofh.it!news.nic.it!robomod
From: Samuel Thibault <sthibault@debian.org>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1152056: rustc: Fix test_rwlock_max_readers hanging on non-linux 32b archs
Date: Sun, 25 Oct 2026 21:10:02 +0100
Message-ID: <NScHw-7QFe-15@gated-at.bofh.it>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Sun Oct 25 20:03:08 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.7
Reply-To: Samuel Thibault <sthibault@debian.org>, 1152056@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: pkg-rust-maintainers@alioth-lists.debian.net
X-Debian-Pr-Message: report 1152056
X-Debian-Pr-Package: rustc
X-Debian-Pr-Keywords: patch upstream
X-Debian-Pr-Source: rustc
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="JmQjSSKDWhJ6FPFg"
Content-Disposition: inline
X-Reportbug-Version: 13.2.0+nmu1
Organization: I am not organized
X-Debian-User: sthibault
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/1998836
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 110
Sender: robomod@news.nic.it
X-Original-Date: Sun, 25 Oct 2026 21:01:35 +0100
X-Original-Message-ID: <at5gH8Gopu9oHx0K@end>