From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#36402: installation error Date: Thu, 05 Sep 2019 10:32:18 +0200 Message-ID: <87pnkfi1nx.fsf@gnu.org> References: <87lfxmu47j.fsf@gnu.org> <878sr989br.fsf@gmail.com> <87a7bnaj0b.fsf@gnu.org> <87imqbgh71.fsf@gmail.com> <87woepyc7d.fsf@gnu.org> <87imq8tf88.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:33613) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5nCR-0000rF-DJ for bug-guix@gnu.org; Thu, 05 Sep 2019 04:33:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5nCQ-0006zO-A6 for bug-guix@gnu.org; Thu, 05 Sep 2019 04:33:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:54087) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5nCQ-0006zJ-75 for bug-guix@gnu.org; Thu, 05 Sep 2019 04:33:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i5nCQ-00011q-0E for bug-guix@gnu.org; Thu, 05 Sep 2019 04:33:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87imq8tf88.fsf@gmail.com> (Mathieu Othacehe's message of "Wed, 04 Sep 2019 14:31:35 +0200") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Mathieu Othacehe Cc: 36402@debbugs.gnu.org, Juan Hello! Mathieu Othacehe skribis: > And here is what was going wrong: > > ped_device_get and ped_device_get_next can return pointers to already > existing device object. So set-pointer-finalizer! was possibly called > multiple times on the same device pointer, resulting in calling > ped_device_destroy multiple times on the same device pointer. > > To prevent that, I created a weak value hash table to make sure that one > object maps to exactly one device pointer, and that the pointer > finalizer is set only once. See commit b35839b. Good catch! I confirm that: guix build guile-parted --with-branch=3Dguile-parted=3Dmaster --check passed several times in a row. :-) b35839b LGTM! (=E2=80=98define-wrapped-pointer-type=E2=80=99 takes care of this, but we c= an=E2=80=99t use it while we use bytestructures (info "(guile) Void Pointers and Byte Access").) It seems to me that the fix should be not just for =E2=80=98pointer->device= !=E2=80=99 but for all the =E2=80=98pointer->RECORD!=E2=80=99 procedures, where we pot= entially have similar scenarios, and where we=E2=80=99d rather have: (eq? (pointer->X ptr) (pointer->X ptr)) So perhaps you should define your own =E2=80=98define-wrapped-type=E2=80=99= macro that does =E2=80=98define-record-type=E2=80=99 + the weak hash table thing, and = replace all =E2=80=98define-record-type=E2=80=99 instances in structs.scm with =E2=80=98define-wrapped-type=E2=80=99. How does that sound? Thank you! Ludo=E2=80=99.