From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id kFYcG9XjbGPT7wAAbAwnHQ (envelope-from ) for ; Thu, 10 Nov 2022 12:43:17 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id EP80G9XjbGP+fQAAauVa8A (envelope-from ) for ; Thu, 10 Nov 2022 12:43:17 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4A20934126 for ; Thu, 10 Nov 2022 12:43:13 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot5xZ-0002o3-8N; Thu, 10 Nov 2022 06:43:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot5xX-0002jt-5B for bug-guix@gnu.org; Thu, 10 Nov 2022 06:43:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ot5xW-0006Nw-Sf for bug-guix@gnu.org; Thu, 10 Nov 2022 06:43:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ot5xW-0003h5-F9 for bug-guix@gnu.org; Thu, 10 Nov 2022 06:43:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#58732: installer: finalizers & device destroy segfault Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 10 Nov 2022 11:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58732 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Mathieu Othacehe Cc: 58732@debbugs.gnu.org Received: via spool by 58732-submit@debbugs.gnu.org id=B58732.166808056814178 (code B ref 58732); Thu, 10 Nov 2022 11:43:02 +0000 Received: (at 58732) by debbugs.gnu.org; 10 Nov 2022 11:42:48 +0000 Received: from localhost ([127.0.0.1]:42147 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ot5xI-0003gb-Co for submit@debbugs.gnu.org; Thu, 10 Nov 2022 06:42:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38788) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ot5xF-0003gN-J7 for 58732@debbugs.gnu.org; Thu, 10 Nov 2022 06:42:45 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot5x8-0006Im-IR for 58732@debbugs.gnu.org; Thu, 10 Nov 2022 06:42:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=cG5Ex/0uqCtzTiKqHy1OcDgLTCrIbNP9Xl+34ISjLAM=; b=ZLu49M+RdAnfhQXtDgFp YytpXhG0vCPqyOs4ErHgngR7Yh/u913fhlp47znvq89Jf37xMh6eOK83e3tX0CL4MB/s/wDp6qjwA syDB7c4Do+/pyjj/dLkSsCyAxSdAqHZGmv+69PrR/U7AQ4q+kAOzSneYfO7buBooM33wcVFfm0oU7 FmBKcMCNKfcKAxRWWqzhE+Ob3+ARMet/Pwrdrjo0HDOpSjeQ3nS03RV3Cz06MPzr3fgtBH0DwOZlv HOJxFlQO/4dxmJFEZwWL3zd/7Ne6BmOe/nktnoVKe7llmAS76QBQX2sytvoqnEr4EIMQkpoEHX1ui xAVrtTIH9XnDsw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot5wt-0000hw-F1; Thu, 10 Nov 2022 06:42:34 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87v8oa29ik.fsf@gnu.org> <871qqlwrpy.fsf@gnu.org> <87iljwuwf7.fsf@gnu.org> <871qqkth3g.fsf@gnu.org> <87sfiwm297.fsf@gnu.org> <87iljquc3a.fsf@gnu.org> <8735auwwjf.fsf@gnu.org> <87tu38m9oc.fsf@gnu.org> Date: Thu, 10 Nov 2022 12:42:20 +0100 In-Reply-To: <87tu38m9oc.fsf@gnu.org> (Mathieu Othacehe's message of "Wed, 09 Nov 2022 16:25:55 +0100") Message-ID: <87edubjasj.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1668080593; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=cG5Ex/0uqCtzTiKqHy1OcDgLTCrIbNP9Xl+34ISjLAM=; b=CIQML8Cs7JxfYzla3pTB5zW/Aid9pkW0nu1ZbXsXIWG2YB35o0uTz3YmLtYZ/W7lWNY6Us Dj/ttMJK1ExAkdbye8BtrrC3eTJVvqAWvq/HZmWO5hhROy8cGmCfkJjUkNHtrc7vntaUhp PzOlWJ0kY0IOxd0Bm7+h+MbxwLVKklqwJPJ1qDWxTChrYEDDoaBxW7KahUWBn3wCuLwHZk DlQfE0Qo+2xeqtJyVADmL46e4TCdhnaB0jeQcc7etGBEdGme0dFBao1t/CCrGoGMkZQWfK G6xo5zJtrYfg4FTi8IK5KDfubZgVWEpV9QTuAdvLD0qKlzRxowh1IodZHFf0ZQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1668080593; a=rsa-sha256; cv=none; b=e+iQh+7dmbuCWkUcz97wuBrsEWsf0pAadXb13IOB+vFViKzLsXiHCiIUixu631ucSU0ZaO M9wMz/r1vhRpZEbKWaJEArA7Rkwl4kGUTrQx5dh8o8Zbaouo+cCVZhL0Jo0gziLIpdttJT o6t2iq8moMTG8Uw35iZexM2KzYQaYDL4K7j3UT9uX2i/PKq9kuVg23pQUU94RWI5VSfLNF 2ZxKJh+flrNvoZhK6HPpeDS9T6OBPJp+ajPKyTBYLPTlkJ0I3DWIjI4lpN8SYGFUkpc32O Ju6IBlNNwVt5t+0cwKBczyXCJpf4Su0B0H2Im0Z052tMKd0cs5AX2liVTaxt+w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=ZLu49M+R; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.72 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=ZLu49M+R; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 4A20934126 X-Spam-Score: -2.72 X-Migadu-Scanner: scn0.migadu.com X-TUID: 19o17NzXl9X9 Hi, Mathieu Othacehe skribis: > I tested it out and I had several SCM pointers encapsulating the same > libparted C pointer, thus multiple finalizers on the same underlying C > pointer. Yes, that=E2=80=99s the idea I tried to convey. > Anyway, here is a patch that solves the issue by removing the device > finalizer. It also means that all devices are persisted until the end of > the program which doesn't feel right, but I cannot think of a better > solution. Looking at device.c in Parted, that=E2=80=99s probably the right thing beca= use PedDevice objects are kept in a linked list whose head is stored in the =E2=80=98devices=E2=80=99 global variable of device.c. So you cannot just = free them asynchronously from a finalizer thread because they might still be accessed from other parts of the library. This is the explanation that should go in the comment, and it=E2=80=99s clearly a good reason not to free those PedDevice objects. Now, we could provide bindings for =E2=80=98ped_device_destroy=E2=80=99 tha= t users could explicitly call if they want to (this would be similar to explicit calls to =E2=80=98close-port=E2=80=99). We=E2=80=99d arrange to make it idempote= nt. Thanks, Ludo=E2=80=99.