Merge ~vpa1977/ubuntu/+source/jruby:jruby-ftbfs into ubuntu/+source/jruby:ubuntu/devel

Proposed by Vladimir Petko
Status: Merged
Merged at revision: 61b066239685719a1281b8b94cf27ceda4b44853
Proposed branch: ~vpa1977/ubuntu/+source/jruby:jruby-ftbfs
Merge into: ubuntu/+source/jruby:ubuntu/devel
Diff against target: 121 lines (+50/-4)
6 files modified
debian/changelog (+12/-0)
debian/control (+2/-1)
debian/patches/0014-jruby-8081-invert-o-nonblock-flag.patch (+26/-0)
debian/patches/series (+1/-0)
debian/rules (+6/-0)
debian/tests/control (+3/-3)
Reviewer Review Type Date Requested Status
Pushkar Kulkarni (community) Approve
git-ubuntu import Pending
Review via email: mp+461172@code.launchpad.net

Description of the change

This MR addresses jruby build and autopkgtest issues.

ppa: ppa:vpa1977/plusone [1]

Changes:
 - copy POM files so that maven-install-plugin could update them
 - mark mri-extra, spec-ruby, mri-stdlib as flaky
 - d/p/jruby-8081-invert-o-nonblock-flag.patch: apply upstream patch
   to fix fcntl call O_NONBLOCK semantics (it was inverted)

Testing:
 - build in ppa with -proposed enabled[2]
 - rebuild jruby against itself[3]
 - autopkgtests
  - jruby/9.4.5.0+ds-1ubuntu1~ppa3
    + ✅ jruby on noble for amd64 @ 26.02.24 21:52:17 Log️ 🗒️ [4]
    + ✅ jruby on noble for armhf @ 26.02.24 20:17:06 Log️ 🗒️ [5]
    + ✅ jruby on noble for i386 @ 26.02.24 20:15:19 Log️ 🗒️ [6]
    + ✅ jruby on noble for ppc64el @ 26.02.24 20:18:34 Log️ 🗒️ [7]
    + ✅ jruby on noble for s390x @ 26.02.24 20:14:51 Log️ 🗒️ [8]

arm64 timed out, but not considered a regression.

 - test setting pipes to blocking (see comment)

[1] https://launchpad.net/~vpa1977/+archive/ubuntu/plusone/+packages
[2] https://launchpad.net/~vpa1977/+archive/ubuntu/plusone/+sourcepub/15818671/+listing-archive-extra
[3] https://launchpad.net/~vpa1977/+archive/ubuntu/plusone-rebuild/+build/27821466
[4] https://autopkgtest.ubuntu.com/results/autopkgtest-noble-vpa1977-plusone/noble/amd64/j/jruby/20240226_215217_e9afd@/log.gz
[5] https://autopkgtest.ubuntu.com/results/autopkgtest-noble-vpa1977-plusone/noble/armhf/j/jruby/20240226_201706_7dfaf@/log.gz
[6] https://autopkgtest.ubuntu.com/results/autopkgtest-noble-vpa1977-plusone/noble/i386/j/jruby/20240226_201519_b2258@/log.gz
[7] https://autopkgtest.ubuntu.com/results/autopkgtest-noble-vpa1977-plusone/noble/ppc64el/j/jruby/20240226_201834_c5095@/log.gz
[8] https://autopkgtest.ubuntu.com/results/autopkgtest-noble-vpa1977-plusone/noble/s390x/j/jruby/20240226_201451_1aacb@/log.gz

To post a comment you must log in.
Revision history for this message
Vladimir Petko (vpa1977) wrote :

captureRuby.rb
---
require 'open3'
require 'fcntl'

if defined? JRUBY_VERSION
  puts "JRuby #{JRUBY_VERSION}, Java #{java.lang.System.getProperty('java.version')}"
else
  puts "CRuby #{RUBY_VERSION}"
end

read, write = IO.pipe
flags = write.fcntl(Fcntl::F_GETFL)
# set nonblocking flag so that ruby knows about it
write.fcntl(Fcntl::F_SETFL, flags | (Fcntl::O_NONBLOCK)) # actually clears
# clear nonblocking flag
write.fcntl(Fcntl::F_SETFL, flags & (~Fcntl::O_NONBLOCK)) # set nonblock flag

pid = spawn("./printFlags.py", :out => write)

write.close
puts "Manual spawn: #{read.read}"
Process.wait pid
---

printFlags.py
------
#!/usr/bin/env python3

import fcntl
import os
import sys

def decode_flags(flags):
    flags_to_check = {
        "O_RDONLY": os.O_RDONLY,
        "O_WRONLY": os.O_WRONLY,
        "O_RDWR": os.O_RDWR,
        "O_APPEND": os.O_APPEND,
        "O_NONBLOCK": os.O_NONBLOCK,
    }

    result = []
    for name, flag in flags_to_check.items():
        if flags & flag:
            result.append(name)
            flags &= ~flag

    if flags:
        result.append(str(flags))

    return "+".join(result)

stdout_io_flags = fcntl.fcntl(sys.stdout.fileno(), fcntl.F_GETFL)
print(f"stdout io flags: {stdout_io_flags} == {decode_flags(stdout_io_flags)}")
----

$jruby capturePython.rb
JRuby 9.4.5.0, Java 21.0.2
Manual spawn: stdout io flags: 1 == O_WRONLY

The output shows that the flag was successfully cleared.

Revision history for this message
Pushkar Kulkarni (pushkarnk) :
review: Approve
Revision history for this message
Vladimir Petko (vpa1977) wrote :

Uploaded, thank you for review!!!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 7b51e87..e8434d8 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,15 @@
6+jruby (9.4.5.0+ds-1ubuntu1) noble; urgency=medium
7+
8+ * d/rules: copy jruby pom files so that they can by updated by
9+ maven-install-plugin. Fixes ftbfs (LP: #2054942).
10+ * d/t/control: mark mri-extra, spec-ruby, mri-stdlib as flaky. See
11+ launchpad bug 2054943.
12+ * d/p/jruby-8081-invert-o-nonblock-flag.patch: apply upstream patch
13+ to fix fcntl call. This allows workaround for launchpad
14+ bug 2054943.
15+
16+ -- Vladimir Petko <vladimir.petko@canonical.com> Mon, 26 Feb 2024 11:55:18 +1300
17+
18 jruby (9.4.5.0+ds-1) unstable; urgency=medium
19
20 * Rebuild for unstable.
21diff --git a/debian/control b/debian/control
22index 21e0097..2ba7e82 100644
23--- a/debian/control
24+++ b/debian/control
25@@ -1,7 +1,8 @@
26 Source: jruby
27 Section: ruby
28 Priority: optional
29-Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
30+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
31+XSBC-Original-Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
32 Uploaders:
33 Thomas Goirand <zigo@debian.org>,
34 Jérôme Charaoui <jerome@riseup.net>,
35diff --git a/debian/patches/0014-jruby-8081-invert-o-nonblock-flag.patch b/debian/patches/0014-jruby-8081-invert-o-nonblock-flag.patch
36new file mode 100644
37index 0000000..f6c99e8
38--- /dev/null
39+++ b/debian/patches/0014-jruby-8081-invert-o-nonblock-flag.patch
40@@ -0,0 +1,26 @@
41+Description: Invert this logic to match O_NONBLOCK flag
42+ The blocking behaviour was opposite of what O_NONBLOCK flag
43+ indicates.
44+Author: Charles Oliver Nutter <headius@headius.com>
45+Origin: upstream, https://github.com/jruby/jruby/commit/40a43760fddccdc9b5ca636680fc75a08d6a0d49
46+Bug: https://github.com/jruby/jruby/issues/8081
47+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/jruby/+bug/2054943
48+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1064786
49+Applied-Upstream: commit, 40a43760fddccdc9b5ca636680fc75a08d6a0d49
50+Last-Update: 2024-02-26
51+diff --git a/core/src/main/java/org/jruby/RubyIO.java b/core/src/main/java/org/jruby/RubyIO.java
52+index 115c259279..144660fe82 100644
53+--- a/core/src/main/java/org/jruby/RubyIO.java
54++++ b/core/src/main/java/org/jruby/RubyIO.java
55+@@ -2619,9 +2619,9 @@ public class RubyIO extends RubyObject implements IOEncodable, Closeable, Flusha
56+ return runtime.newFixnum(close_on_exec_p(context).isTrue() ? FD_CLOEXEC : 0);
57+ } else if (realCmd == Fcntl.F_SETFL.intValue()) {
58+ if ((nArg & OpenFlags.O_NONBLOCK.intValue()) != 0) {
59+- fptr.setBlocking(runtime, true);
60+- } else {
61+ fptr.setBlocking(runtime, false);
62++ } else {
63++ fptr.setBlocking(runtime, true);
64+ }
65+
66+ if ((nArg & OpenFlags.O_CLOEXEC.intValue()) != 0) {
67diff --git a/debian/patches/series b/debian/patches/series
68index dedc44d..ec9db73 100644
69--- a/debian/patches/series
70+++ b/debian/patches/series
71@@ -9,3 +9,4 @@
72 0012-Fix-test-failures-related-to-Module-PTY.patch
73 0013-Work-around-JarResourceTest-failure.patch
74 Update-to-use-non-expired-certificates.patch
75+0014-jruby-8081-invert-o-nonblock-flag.patch
76diff --git a/debian/rules b/debian/rules
77index 7f9bd55..112c7ad 100755
78--- a/debian/rules
79+++ b/debian/rules
80@@ -38,6 +38,12 @@ execute_after_dh_auto_configure:
81 mv rubygems debian/maven-repo
82 # backup upstream generated poms
83 $(foreach p,. lib core shaded,cp ${p}/pom.xml ${p}/pom.xml.bak;)
84+ # copy jruby poms rather than links, because the build will try to patch them
85+ for p in jruby jruby-parent jruby-base jruby-core jruby-artifacts ; do \
86+ rm debian/maven-repo/org/jruby/$$p/* ;\
87+ mkdir debian/maven-repo/org/jruby/$$p/debian ; \
88+ cp /usr/share/maven-repo/org/jruby/$$p/debian/* debian/maven-repo/org/jruby/$$p/debian/ ;\
89+ done
90
91 override_dh_auto_build:
92 dh_auto_build -- -Djruby.revision=$(DEB_VERSION) -Pmain,complete,dist
93diff --git a/debian/tests/control b/debian/tests/control
94index 5d26b4d..4fa7fdb 100644
95--- a/debian/tests/control
96+++ b/debian/tests/control
97@@ -112,7 +112,7 @@ Depends:
98 ruby-rspec,
99 ruby-test-unit,
100 @,
101-Restrictions: allow-stderr
102+Restrictions: allow-stderr, flaky
103 Architecture: amd64, arm64
104
105 Tests: mri-core
106@@ -140,7 +140,7 @@ Depends:
107 ruby-rspec,
108 ruby-test-unit,
109 @,
110-Restrictions: allow-stderr
111+Restrictions: allow-stderr, flaky
112 Architecture: amd64, arm64
113
114 Tests: mri-stdlib
115@@ -154,5 +154,5 @@ Depends:
116 ruby-rspec,
117 ruby-test-unit,
118 @,
119-Restrictions: allow-stderr
120+Restrictions: allow-stderr, flaky
121 Architecture: amd64, arm64

Subscribers

People subscribed via source and target branches