Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] brltty: fix segfault when built with Cython 3
@ 2023-10-09 12:15 paper42
  2023-10-09 12:16 ` [PR PATCH] [Updated] " paper42
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: paper42 @ 2023-10-09 12:15 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1770 bytes --]

There is a new pull request by paper42 against master on the void-packages repository

https://github.com/paper42/void-packages brltty-cython3
https://github.com/void-linux/void-packages/pull/46528

brltty: fix segfault when built with Cython 3
https://discourse.gnome.org/t/psa-for-distros-brltty-should-be-built-using-cython-0-29-x-not-cython-3/16715/3i

this isn't an issue with brltty currently in repositories because it was not rebuilt with cython3, but a simple rebuild reveals the segfault when doing `python3 -c "import brlapi; brlapi.Connection()"`, it will be an issue when the python 3.12 rebuilds finish because they include a revbump to this package

@ahesford do you want to merge this now or after the 3.12 builds are done?

<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/46528.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-brltty-cython3-46528.patch --]
[-- Type: text/x-diff, Size: 2432 bytes --]

From ca3c2a8843df2d2da9f800251b6e09dbd18c6be8 Mon Sep 17 00:00:00 2001
From: Emi Vasilek <emi.vasilek@gmail.com>
Date: Mon, 9 Oct 2023 14:09:16 +0200
Subject: [PATCH] brltty: fix segfault when built with Cython 3

https://discourse.gnome.org/t/psa-for-distros-brltty-should-be-built-using-cython-0-29-x-not-cython-3/16715/3i
---
 srcpkgs/brltty/patches/cython3.patch | 44 ++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 srcpkgs/brltty/patches/cython3.patch

diff --git a/srcpkgs/brltty/patches/cython3.patch b/srcpkgs/brltty/patches/cython3.patch
new file mode 100644
index 0000000000000..2f9bfaf388270
--- /dev/null
+++ b/srcpkgs/brltty/patches/cython3.patch
@@ -0,0 +1,44 @@
+From e6707d5e094dc36db4319ce4d052a6ad568a5d26 Mon Sep 17 00:00:00 2001
+From: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Date: Tue, 15 Aug 2023 16:29:13 +0200
+Subject: [PATCH] brlapi: Fix python crash on connection error
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From Lukáš Tyrychtr:
+“
+Cython 3.0 started using the new Python object finalization APIs from PEP 442
+”
+
+This means that __del__ gets called even when raising an exception from
+__init__, while it was not before. To cope with both behaviors, we can
+set self.h to NULL to determine whether it still exists or not.
+
+Thanks Lukáš Tyrychtr for the investigation and patch draft!
+---
+ Bindings/Python/brlapi.pyx | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/Bindings/Python/brlapi.pyx b/Bindings/Python/brlapi.pyx
+index 0136895eaf..af62cc9be0 100644
+--- a/Bindings/Python/brlapi.pyx
++++ b/Bindings/Python/brlapi.pyx
+@@ -453,6 +453,7 @@ cdef class Connection:
+ 		c_brlapi.brlapi_protocolExceptionInit(self.h)
+ 		if self.fd == -1:
+ 			c_brlapi.free(self.h)
++			self.h = NULL
+ 			raise ConnectionError(self.settings.host, self.settings.auth)
+ 
+ 	def closeConnection(self):
+@@ -465,7 +466,8 @@ cdef class Connection:
+ 		"""Release resources used by the connection"""
+ 		if self.fd != -1:
+ 			c_brlapi.brlapi__closeConnection(self.h)
+-		c_brlapi.free(self.h)
++		if self.h != NULL:
++			c_brlapi.free(self.h)
+ 
+ 	property host:
+ 		"""To get authorized to connect, libbrlapi has to tell the BrlAPI server a secret key, for security reasons. This is the path to the file which holds it; it will hence have to be readable by the application."""

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PR PATCH] [Updated] brltty: fix segfault when built with Cython 3
  2023-10-09 12:15 [PR PATCH] brltty: fix segfault when built with Cython 3 paper42
@ 2023-10-09 12:16 ` paper42
  2023-10-09 12:28 ` [PR PATCH] [Merged]: " ahesford
  2023-10-09 12:28 ` ahesford
  2 siblings, 0 replies; 4+ messages in thread
From: paper42 @ 2023-10-09 12:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1775 bytes --]

There is an updated pull request by paper42 against master on the void-packages repository

https://github.com/paper42/void-packages brltty-cython3
https://github.com/void-linux/void-packages/pull/46528

brltty: fix segfault when built with Cython 3
https://discourse.gnome.org/t/psa-for-distros-brltty-should-be-built-using-cython-0-29-x-not-cython-3/16715/3i

this isn't an issue with brltty currently in repositories because it was not rebuilt with cython3, but a simple rebuild reveals the segfault when doing `python3 -c "import brlapi; brlapi.Connection()"`, it will be an issue when the python 3.12 rebuilds finish because they include a revbump to this package

@ahesford do you want to merge this now or after the 3.12 builds are done?

<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/46528.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-brltty-cython3-46528.patch --]
[-- Type: text/x-diff, Size: 2866 bytes --]

From 126aa13d4cb6b841b834aec7d15fbff20a323d6c Mon Sep 17 00:00:00 2001
From: Emi Vasilek <emi.vasilek@gmail.com>
Date: Mon, 9 Oct 2023 14:09:16 +0200
Subject: [PATCH] brltty: fix segfault when built with Cython 3

https://discourse.gnome.org/t/psa-for-distros-brltty-should-be-built-using-cython-0-29-x-not-cython-3/16715/3i
---
 srcpkgs/brltty/patches/cython3.patch | 44 ++++++++++++++++++++++++++++
 srcpkgs/brltty/template              |  2 +-
 2 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/brltty/patches/cython3.patch

diff --git a/srcpkgs/brltty/patches/cython3.patch b/srcpkgs/brltty/patches/cython3.patch
new file mode 100644
index 0000000000000..2f9bfaf388270
--- /dev/null
+++ b/srcpkgs/brltty/patches/cython3.patch
@@ -0,0 +1,44 @@
+From e6707d5e094dc36db4319ce4d052a6ad568a5d26 Mon Sep 17 00:00:00 2001
+From: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Date: Tue, 15 Aug 2023 16:29:13 +0200
+Subject: [PATCH] brlapi: Fix python crash on connection error
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From Lukáš Tyrychtr:
+“
+Cython 3.0 started using the new Python object finalization APIs from PEP 442
+”
+
+This means that __del__ gets called even when raising an exception from
+__init__, while it was not before. To cope with both behaviors, we can
+set self.h to NULL to determine whether it still exists or not.
+
+Thanks Lukáš Tyrychtr for the investigation and patch draft!
+---
+ Bindings/Python/brlapi.pyx | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/Bindings/Python/brlapi.pyx b/Bindings/Python/brlapi.pyx
+index 0136895eaf..af62cc9be0 100644
+--- a/Bindings/Python/brlapi.pyx
++++ b/Bindings/Python/brlapi.pyx
+@@ -453,6 +453,7 @@ cdef class Connection:
+ 		c_brlapi.brlapi_protocolExceptionInit(self.h)
+ 		if self.fd == -1:
+ 			c_brlapi.free(self.h)
++			self.h = NULL
+ 			raise ConnectionError(self.settings.host, self.settings.auth)
+ 
+ 	def closeConnection(self):
+@@ -465,7 +466,8 @@ cdef class Connection:
+ 		"""Release resources used by the connection"""
+ 		if self.fd != -1:
+ 			c_brlapi.brlapi__closeConnection(self.h)
+-		c_brlapi.free(self.h)
++		if self.h != NULL:
++			c_brlapi.free(self.h)
+ 
+ 	property host:
+ 		"""To get authorized to connect, libbrlapi has to tell the BrlAPI server a secret key, for security reasons. This is the path to the file which holds it; it will hence have to be readable by the application."""
diff --git a/srcpkgs/brltty/template b/srcpkgs/brltty/template
index eaca3d9a9f31f..c92b681ea5706 100644
--- a/srcpkgs/brltty/template
+++ b/srcpkgs/brltty/template
@@ -1,7 +1,7 @@
 # Template file for 'brltty'
 pkgname=brltty
 version=6.4
-revision=10
+revision=11
 build_style=gnu-configure
 build_helper=python3
 configure_args="--enable-gpm --with-screen-driver=lx,sc

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PR PATCH] [Merged]: brltty: fix segfault when built with Cython 3
  2023-10-09 12:15 [PR PATCH] brltty: fix segfault when built with Cython 3 paper42
  2023-10-09 12:16 ` [PR PATCH] [Updated] " paper42
@ 2023-10-09 12:28 ` ahesford
  2023-10-09 12:28 ` ahesford
  2 siblings, 0 replies; 4+ messages in thread
From: ahesford @ 2023-10-09 12:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1612 bytes --]

There's a merged pull request on the void-packages repository

brltty: fix segfault when built with Cython 3
https://github.com/void-linux/void-packages/pull/46528

Description:
https://discourse.gnome.org/t/psa-for-distros-brltty-should-be-built-using-cython-0-29-x-not-cython-3/16715/3i

this isn't an issue with brltty currently in repositories because it was not rebuilt with cython3, but a simple rebuild reveals the segfault when doing `python3 -c "import brlapi; brlapi.Connection()"`, it will be an issue when the python 3.12 rebuilds finish because they include a revbump to this package

@ahesford do you want to merge this now or after the 3.12 builds are done?

<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: brltty: fix segfault when built with Cython 3
  2023-10-09 12:15 [PR PATCH] brltty: fix segfault when built with Cython 3 paper42
  2023-10-09 12:16 ` [PR PATCH] [Updated] " paper42
  2023-10-09 12:28 ` [PR PATCH] [Merged]: " ahesford
@ 2023-10-09 12:28 ` ahesford
  2 siblings, 0 replies; 4+ messages in thread
From: ahesford @ 2023-10-09 12:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 168 bytes --]

New comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/46528#issuecomment-1752918785

Comment:
Thanks for catching this!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-10-09 12:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-09 12:15 [PR PATCH] brltty: fix segfault when built with Cython 3 paper42
2023-10-09 12:16 ` [PR PATCH] [Updated] " paper42
2023-10-09 12:28 ` [PR PATCH] [Merged]: " ahesford
2023-10-09 12:28 ` ahesford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).