From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#32478: pcscd service activation causes boot failure Date: Mon, 20 Aug 2018 18:13:25 +0200 Message-ID: <87bm9xdniy.fsf@gnu.org> References: <87pnyd8pn5.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:4830:134:3::10]:57421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frmok-0001ox-0h for bug-guix@gnu.org; Mon, 20 Aug 2018 12:14:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frmog-00027b-5r for bug-guix@gnu.org; Mon, 20 Aug 2018 12:14:08 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:50782) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1frmoc-00023m-6g for bug-guix@gnu.org; Mon, 20 Aug 2018 12:14:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1frmob-0004j7-Vg for bug-guix@gnu.org; Mon, 20 Aug 2018 12:14:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87pnyd8pn5.fsf@gmail.com> (Chris Marusich's message of "Mon, 20 Aug 2018 00:26:38 -0700") 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: Chris Marusich Cc: 32478@debbugs.gnu.org Hello, Chris Marusich skribis: > The attached patch fixes the issue by using an idempotent procedure to > create the symlink. If there are no objections, I'll push the patch to > master about 24 hours from now. There is a fairly long comment in my > patch because although I wanted to re-use the switch-symlinks procedure > from (guix utils), I couldn't figure out how to do it. Ideas regarding > this are welcome! To be specific, I tried to use (guix utils), but then > I got the following error message at boot time (see my comment for more > information): > > loading '/gnu/store/f4ng1dlpm7q74vssbb049vpf2gvw3n3r-system/boot'... > [ 2.175072] random: fast init done > making '/gnu/store/f4ng1dlpm7q74vssbb049vpf2gvw3n3r-system' the current s= ystem.. > . > setting up setuid programs in '/run/setuid-programs'... > populating /etc from /gnu/store/n6cwz1hlmjylva2xrv61njl68g6c8k5l-etc... > usermod: no changes > usermod: no changes > usermod: no changes > ERROR: In procedure dynamic-func: > In procedure dynamic-pointer: Symbol not found: strverscmp This is because (guix utils) pulls in lots of things that are not really meant to be used on the =E2=80=9Cbuild side=E2=80=9D (a misnomer in this ca= se, but you see what I mean ;-)). Here, it assumes that dlopen support is available but it=E2=80=99s not because the activation snippet runs on the statically-linked Guile. > From 3fa1e930b827aebca2dbbfe84c36cf203f15afda Mon Sep 17 00:00:00 2001 > From: Chris Marusich > Date: Mon, 20 Aug 2018 00:16:06 -0700 > Subject: [PATCH] gnu: services: Fix pcscd activation bug. > > * gnu/services/security-token.scm (pcscd-activation): Idempotently create= the > /var/lib/pcsc symlink so that it does not fail when it already exists. LGTM! > + (with-imported-modules (source-module-closure > + '((guix build utils))) > + #~(begin > + (use-modules (guix build utils)) > + ;; This switch-symlinks procedure was copied from (guix utils= ). It > + ;; would be nice to re-use the procedure from that module, bu= t if > + ;; we add that module to this gexp's imported modules and try= to > + ;; use it, then this activation gexp can fail when it runs. = To be > + ;; specific, if you try to use (guix utils) and then build a = VM > + ;; with a pcscd-service-type using "guix system vm-image", th= en > + ;; when you boot the VM, it will fail. It fails because (guix > + ;; utils) dynamically links glibc's strverscmp function when > + ;; defining the version-compare procedure, and for some reason > + ;; strverscmp can't be found. Perhaps there's a way to fix or > + ;; avoid this, but since we don't need the version-compare > + ;; procedure here, anyway, it's simpler to just define our own > + ;; switch-symlinks procedure instead. > + (define (switch-symlinks link target) > + (let ((pivot (string-append link ".new"))) > + (symlink target pivot) > + (rename-file pivot link))) I think =E2=80=9CTODO: Deduplicate=E2=80=9D would be enough as a comment, o= r at least something more concise like =E2=80=9CXXX: We cannot use (guix utils) becaus= e it requires a dynamically-linked Guile, hence the duplicate =E2=80=98switch-symlinks=E2=80=99.=E2=80=9D I leave it up to you! Thanks, Ludo=E2=80=99.