[Git][java-team/ipcsocket][master] 2 commits: Use the FIONREAD value of each Linux architecture

Juan Manuel Méndez Rey (@mendezr) gitlab at salsa.debian.org
Tue Nov 24 02:32:54 GMT 2026



Juan Manuel Méndez Rey pushed to branch master at Debian Java Maintainers / ipcsocket


Commits:
08a00d04 by Juan Manuel Méndez Rey at 2026-11-24T03:30:42+01:00
Use the FIONREAD value of each Linux architecture

available() always passed 0x541B to ioctl() on Linux. On ppc64el that
fails, poll() takes over, and AvailableTest gets 1 pending byte instead
of 3, so the autopkgtest fails and blocks migration.

- - - - -
902db94f by Juan Manuel Méndez Rey at 2026-11-24T03:30:51+01:00
Upload to unstable

- - - - -


3 changed files:

- debian/changelog
- + debian/patches/fionread-per-linux-architecture.patch
- + debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+ipcsocket (1.8.1+dfsg-2) unstable; urgency=medium
+
+  * Use the FIONREAD value of each Linux architecture in available(). It
+    was always 0x541B, which is wrong on PowerPC, SPARC, Alpha and MIPS,
+    and the autopkgtest failed on ppc64el.
+
+ -- Juan Manuel Méndez Rey <juan.mendezr at proton.me>  Tue, 24 Nov 2026 03:30:51 +0100
+
 ipcsocket (1.8.1+dfsg-1) unstable; urgency=medium
 
   * New upstream version 1.8.1: no double close of the socket fd after EOF,


=====================================
debian/patches/fionread-per-linux-architecture.patch
=====================================
@@ -0,0 +1,48 @@
+Description: Use the FIONREAD value of each Linux architecture
+ available() always passed 0x541B to ioctl() on Linux. PowerPC, SPARC and
+ Alpha use 0x4004667F, and MIPS uses 0x467F. There, ioctl() fails with
+ ENOTTY, the code falls back to poll(), and available() returns 1 instead
+ of the number of pending bytes. AvailableTest.availableCountsPendingBytes
+ fails on ppc64el: "expected:<3> but was:<1>".
+Author: Juan Manuel Méndez Rey <juan.mendezr at proton.me>
+Forwarded: https://github.com/sbt/ipcsocket/pull/104
+Last-Update: 2026-11-24
+---
+diff --git a/src/main/java/org/scalasbt/ipcsocket/UnixDomainSocketLibrary.java b/src/main/java/org/scalasbt/ipcsocket/UnixDomainSocketLibrary.java
+index 7b49533..f4291f8 100644
+--- a/src/main/java/org/scalasbt/ipcsocket/UnixDomainSocketLibrary.java
++++ b/src/main/java/org/scalasbt/ipcsocket/UnixDomainSocketLibrary.java
+@@ -52,6 +52,18 @@ public class UnixDomainSocketLibrary {
+ 
+   public static final NativeLong FIONREAD = new NativeLong(0x4004667FL);
+   public static final NativeLong FIONREAD_LINUX = new NativeLong(0x541BL);
++  // Linux uses 0x541B on most architectures, but not on all of them:
++  // PowerPC, SPARC and Alpha use 0x4004667F, and MIPS uses 0x467F.
++  public static final NativeLong FIONREAD_LINUX_MIPS = new NativeLong(0x467FL);
++
++  static NativeLong fionread() {
++    if (!Platform.isLinux()) return FIONREAD;
++    if (Platform.isPPC() || Platform.isSPARC() || Platform.ARCH.startsWith("alpha")) {
++      return FIONREAD;
++    }
++    if (Platform.isMIPS()) return FIONREAD_LINUX_MIPS;
++    return FIONREAD_LINUX;
++  }
+ 
+   // Utility class, do not instantiate.
+   private UnixDomainSocketLibrary() {}
+@@ -262,13 +274,7 @@ class JNAUnixDomainSocketLibraryProvider implements UnixDomainSocketLibraryProvi
+   public int available(int fd) throws NativeErrorException {
+     try {
+       final IntByReference len = new IntByReference();
+-      NativeLong op;
+-      if (Platform.isLinux()) {
+-        op = UnixDomainSocketLibrary.FIONREAD_LINUX;
+-      } else {
+-        op = UnixDomainSocketLibrary.FIONREAD;
+-      }
+-      UnixDomainSocketLibrary.ioctl(fd, op, len);
++      UnixDomainSocketLibrary.ioctl(fd, UnixDomainSocketLibrary.fionread(), len);
+       return len.getValue();
+     } catch (final LastErrorException e) {
+       try {


=====================================
debian/patches/series
=====================================
@@ -0,0 +1 @@
+fionread-per-linux-architecture.patch



View it on GitLab: https://salsa.debian.org/java-team/ipcsocket/-/compare/b00e3ad5b6c5d75e894d8c68d70917b8dd843ff6...902db94fc53bcd95cb415bdaf5abb989de359fc2

-- 
View it on GitLab: https://salsa.debian.org/java-team/ipcsocket/-/compare/b00e3ad5b6c5d75e894d8c68d70917b8dd843ff6...902db94fc53bcd95cb415bdaf5abb989de359fc2
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20261124/8e4dffa4/attachment.htm>


More information about the pkg-java-commits mailing list