Package: kitty
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu lunar ubuntu-patch

Dear Maintainer,

When building the package for ppc64el on Ubuntu, the crypto test fails
with the following error:

 OSError: [Errno 12] Cannot allocate memory

This happens because the ppc64el builders have their RLIMIT_MEMLOCK
value set to the pagesize (64k) ; so only a single call to mlock(2) can
succeed.

Although the build does not fail in Debian (I believe the RLIMIT_MEMLOCK
is set to a more sensible value), I think the patch could still make
sense.

There is an upstream bug report:
https://github.com/kovidgoyal/kitty/issues/5466

In Ubuntu, the attached patch was applied to achieve the following:


  * disable crypto test if RLIMIT_MEMLOCK is too low (LP: #2004435)


Thanks for considering the patch.


-- System Information:
Debian Release: bookworm/sid
  APT prefers kinetic-updates
  APT policy: (500, 'kinetic-updates'), (500, 'kinetic-security'), (500, 
'kinetic'), (100, 'kinetic-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.19.0-29-generic (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru kitty-0.26.5/debian/control kitty-0.26.5/debian/control
--- kitty-0.26.5/debian/control 2023-01-30 20:32:11.000000000 +0100
+++ kitty-0.26.5/debian/control 2023-02-01 12:31:03.000000000 +0100
@@ -1,7 +1,6 @@
 Source: kitty
 Priority: optional
-Maintainer: Ubuntu Developers <ubuntu-devel-disc...@lists.ubuntu.com>
-XSBC-Original-Maintainer: James McCoy <james...@debian.org>
+Maintainer: James McCoy <james...@debian.org>
 Section: x11
 Standards-Version: 4.6.2
 Rules-Requires-Root: no
diff -Nru kitty-0.26.5/debian/patches/conditionally-skip-crypto-test.patch 
kitty-0.26.5/debian/patches/conditionally-skip-crypto-test.patch
--- kitty-0.26.5/debian/patches/conditionally-skip-crypto-test.patch    
1970-01-01 01:00:00.000000000 +0100
+++ kitty-0.26.5/debian/patches/conditionally-skip-crypto-test.patch    
2023-02-01 12:31:03.000000000 +0100
@@ -0,0 +1,36 @@
+Description: skip crypto test if RLIMIT_MEMLOCK is too low
+ When building on ppc64el in Ubuntu, RLIMIT_MEMLOCK is set to the same value as
+ the pagesize. This means only a single call to mlock() can succeed.
+ Since the crypto test makes multiple calls to mlock(), the test fails in the
+ described environment.
+ Make sure we skip the test if the RLIMIT_MEMLOCK is too low.
+Author: Olivier Gayot <olivier.ga...@canonical.com>
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/2004435
+Forwarded: 
https://github.com/kovidgoyal/kitty/issues/5466#issuecomment-1412004797
+Last-Update: 2023-02-01
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: kitty-0.26.5/kitty_tests/crypto.py
+===================================================================
+--- kitty-0.26.5.orig/kitty_tests/crypto.py    2023-02-01 13:17:33.662880021 
+0100
++++ kitty-0.26.5/kitty_tests/crypto.py 2023-02-01 13:25:53.667978172 +0100
+@@ -3,12 +3,19 @@
+ 
+ 
+ import os
++import resource
++import unittest
+ 
+ from . import BaseTest
+ 
+ 
++memlock_limit, _ = resource.getrlimit(resource.RLIMIT_MEMLOCK)
++pagesize = resource.getpagesize()
++
++
+ class TestCrypto(BaseTest):
+ 
++    @unittest.skipIf(memlock_limit <= pagesize, "RLIMIT_MEMLOCK is too low")
+     def test_elliptic_curve_data_exchange(self):
+         from kitty.fast_data_types import (
+             AES256GCMDecrypt, AES256GCMEncrypt, CryptoError, EllipticCurveKey
diff -Nru kitty-0.26.5/debian/patches/series kitty-0.26.5/debian/patches/series
--- kitty-0.26.5/debian/patches/series  2023-01-04 12:14:15.000000000 +0100
+++ kitty-0.26.5/debian/patches/series  2023-02-01 12:31:03.000000000 +0100
@@ -1,3 +1,4 @@
 bash-integration-fix-clone-in-kitty-not-.patch
 define-singlekey-bitfields-according-to-.patch
 try-to-fix-tests-failing-on-python-3.11.patch
+conditionally-skip-crypto-test.patch

Reply via email to