GNU bug report logs - #73391
[PATCH v2 0/2] SANE: fix a locking bug for plustek backend

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: neox <neox@HIDDEN>; Keywords: patch; merged with #73392, #73393, #73406; dated Fri, 20 Sep 2024 19:05:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.
Changed bug title to '[PATCH v2 0/2] SANE: fix a locking bug for plustek backend' from '[PATCH 0/2] SANE: fix a locking bug for plustek backend' Request was from Adrien 'neox' Bourmault <neox@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Merged 73391 73392 73393 73406. Request was from Adrien 'neox' Bourmault <neox@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Disconnected #73393 from all other report(s). Request was from Adrien 'neox' Bourmault <neox@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Disconnected #73406 from all other report(s). Request was from Adrien 'neox' Bourmault <neox@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Merged 73391 73392 73393 73406. Request was from Adrien 'neox' Bourmault <neox@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Disconnected #73393 from all other report(s). Request was from Adrien 'neox' Bourmault <neox@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Disconnected #73406 from all other report(s). Request was from Adrien 'neox' Bourmault <neox@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Merged 73391 73392 73393 73406. Request was from Adrien 'neox' Bourmault <neox@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 73391 <at> debbugs.gnu.org:


Received: (at 73391) by debbugs.gnu.org; 20 Sep 2024 20:40:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 20 16:40:53 2024
Received: from localhost ([127.0.0.1]:36435 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1srkQv-0002sV-3R
	for submit <at> debbugs.gnu.org; Fri, 20 Sep 2024 16:40:53 -0400
Received: from eggs.gnu.org ([209.51.188.92]:44850)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <neox@HIDDEN>) id 1srkQs-0002sA-Ua
 for 73391 <at> debbugs.gnu.org; Fri, 20 Sep 2024 16:40:52 -0400
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 <neox@HIDDEN>)
 id 1srkQU-0005xY-Ce; Fri, 20 Sep 2024 16:40:26 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To:
 From; bh=hc7VHbjagNnoGkqriDSZL+cvz5v/9LXxF2gvnBV503g=; b=d7qVQ7R9F2/1rjyyUGix
 U6025bPg2Ry8T9ESW73xhdR5hWITtq+ejjX3cyyzr8YNzjxc2vJ2/K1EwIqs137G2uldKDUsmivsF
 U7F/Gtl3TfGTaXSp151zVYrERDoQCx3DvAS4LT0NH7wdkyV/Rh/fw8FSMP4qUonVePFRIvvkJYgR/
 pfxX9oA0XFCJhCaunPDl2jkh37ViwT/2l1JaieSX0etLYd9sO39tYyO7I3XZu+4l4nRuf8GfSLuhr
 lJC/8KtCGeI4UjPp9plO8XpJXTipTF1lVbPBgIsOoxx7h/GwiQ51gN76AfXaFarugsGCG9hbCDieA
 pyXnlM9AuKDkqg==;
From: neox <neox@HIDDEN>
To: 73391 <at> debbugs.gnu.org
Subject: [PATCH v2 2/2] services: sane-service-type: create lock path for
 plustek backend
Date: Fri, 20 Sep 2024 22:39:30 +0200
Message-ID: <8604617ae2896e2d73d24958aab7ee534c656dfa.1726864525.git.neox@HIDDEN>
X-Mailer: git-send-email 2.46.0
In-Reply-To: <cover.1726864525.git.neox@HIDDEN>
References: <cover.1726864525.git.neox@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 73391
Cc: Adrien 'neox' Bourmault <neox@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

From: Adrien 'neox' Bourmault <neox@HIDDEN>

* gnu/services/desktop.scm (sane-service-type): extend with an activation
 service to create the lockpath and give the right permissions

Change-Id: I187886d12b5f0b4fe21b03de178ea2187205387a
Signed-off-by: Adrien 'neox' Bourmault <neox@HIDDEN>
---
 gnu/services/desktop.scm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 274aeeef9b..500527cb50 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2021, 2022 muradm <mail@HIDDEN>
 ;;; Copyright © 2023 Bruno Victal <mirai@HIDDEN>
 ;;; Copyright © 2023 Zheng Junjie <873216071@HIDDEN>
+;;; Copyright © 2024 Adrien Bourmault <neox@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1408,6 +1409,17 @@ (define %sane-accounts
   ;; The '60-libsane.rules' udev rules refers to the "scanner" group.
   (list (user-group (name "scanner") (system? #t))))
 
+(define %sane-activation
+  #~(begin
+      (use-modules (guix build utils))
+      (let ((lockpath "/var/lock/sane")
+            (gid (vector-ref (getgrnam "scanner") 2)))
+        ;; Create the lock directory at runtime and give right perms
+        (mkdir-p lockpath)
+        (chown lockpath -1 gid)
+        (chmod lockpath #o770))
+      #t))
+
 (define sane-service-type
   (service-type
    (name 'sane)
@@ -1418,6 +1430,8 @@ (define sane-service-type
    (default-value sane-backends-minimal)
    (extensions
     (list (service-extension udev-service-type list)
+          (service-extension activation-service-type
+                             (const %sane-activation))
           (service-extension account-service-type
                              (const %sane-accounts))))))
 
-- 
2.46.0





Information forwarded to guix-patches@HIDDEN:
bug#73391; Package guix-patches. Full text available.

Message received at 73391 <at> debbugs.gnu.org:


Received: (at 73391) by debbugs.gnu.org; 20 Sep 2024 20:40:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 20 16:40:49 2024
Received: from localhost ([127.0.0.1]:36431 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1srkQq-0002sF-LC
	for submit <at> debbugs.gnu.org; Fri, 20 Sep 2024 16:40:49 -0400
Received: from eggs.gnu.org ([209.51.188.92]:44844)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <neox@HIDDEN>) id 1srkQm-0002rl-CW
 for 73391 <at> debbugs.gnu.org; Fri, 20 Sep 2024 16:40:45 -0400
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 <neox@HIDDEN>)
 id 1srkQN-0005xI-Nx; Fri, 20 Sep 2024 16:40:19 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To:
 From; bh=AL4lIL4YEuqT5HpMxok6qOTbSt9uTVytxTv46UzbVZg=; b=WBGrRnIqvhYH8MizDnjA
 GJHoevw4eombvydnmFTDjTpdnqHXsX8nGuqdxQpF0ZoLmwcKWHDORw7YL55lw3xSFlkhpJj3w1NqP
 19GkHWNMOZ5KnWKJgXpa/66wr4w6vJUsiSmYjNJFiNgAooJlQRayFFMKdV9drjFOV1flIGDQqkDJ5
 6blwE478dwhw/vAzMSxXzGHFYbOrpQzYeka/3NEf71y6i6ec5ir2aFom5HF5e3lvn2vf03MjhZH63
 mCnP7RELrwWV5RujhugAhSIHVuvlzKJQjClvRz3RleugOBm7w92uzTlkHTaiLz7BRCDP5QVDIVIl3
 86XFiaU6BVjQIQ==;
From: neox <neox@HIDDEN>
To: 73391 <at> debbugs.gnu.org
Subject: [PATCH v2 1/2] gnu: sane-backends-minimal: fix lock path for plustek
 backend
Date: Fri, 20 Sep 2024 22:39:29 +0200
Message-ID: <bc2d915931bfd53462d5eeac7504b04b94ea2d02.1726864525.git.neox@HIDDEN>
X-Mailer: git-send-email 2.46.0
In-Reply-To: <cover.1726864525.git.neox@HIDDEN>
References: <cover.1726864525.git.neox@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 73391
Cc: Adrien 'neox' Bourmault <neox@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

From: Adrien 'neox' Bourmault <neox@HIDDEN>

* gnu/packages/scanner.scm (sane-backends-minimal)
[arguments]<#:configure-flags>: add "--with-lockdir=/var/lock/sane"
[arguments]<#:phases>: add disable-lockdir-creation to prevent creating the
 lockpath during install

Change-Id: I338c16cd4c0bfa0d165c9906b0f1f87ab79a4f75
Signed-off-by: Adrien 'neox' Bourmault <neox@HIDDEN>
---
 gnu/packages/scanner.scm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/scanner.scm b/gnu/packages/scanner.scm
index a2faaa2728..a346f004ae 100644
--- a/gnu/packages/scanner.scm
+++ b/gnu/packages/scanner.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2017, 2019, 2020, 2022 Tobias Geerinckx-Rice <me@HIDDEN>
 ;;; Copyright © 2018 Efraim Flashner <efraim@HIDDEN>
 ;;; Copyright © 2022 João Gabriel <joaog.bastos@HIDDEN>
+;;; Copyright © 2024 Adrien Bourmault <neox@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -136,7 +137,8 @@ (define-public sane-backends-minimal
     (inputs
      (list libusb))
     (arguments
-     `(#:phases
+     `(#:configure-flags '("--with-lockdir=/var/lock/sane") ;; Avoid errors with plustek
+       #:phases
        (modify-phases %standard-phases
          (add-before 'bootstrap 'zap-unnecessary-git-dependency
            (lambda _
@@ -145,6 +147,12 @@ (define-public sane-backends-minimal
                (("/bin/sh") (which "sh")))
              (with-output-to-file ".tarball-version"
                (lambda _ (format #t ,version)))))
+         (add-before 'configure 'disable-lockdir-creation
+           (lambda _
+             ;; Modify the Makefile.am to prevent the creation of the lock dir
+             (substitute* "backend/Makefile.am"
+               (("^install-lockpath:.*$")
+                "install-lockpath: # pass"))))
          (add-before 'configure 'disable-backends
            (lambda _
              (setenv "BACKENDS" " ")
-- 
2.46.0





Information forwarded to guix-patches@HIDDEN:
bug#73391; Package guix-patches. Full text available.

Message received at 73391 <at> debbugs.gnu.org:


Received: (at 73391) by debbugs.gnu.org; 20 Sep 2024 20:40:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 20 16:40:43 2024
Received: from localhost ([127.0.0.1]:36427 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1srkQl-0002ru-C9
	for submit <at> debbugs.gnu.org; Fri, 20 Sep 2024 16:40:43 -0400
Received: from eggs.gnu.org ([209.51.188.92]:49076)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <neox@HIDDEN>) id 1srkQj-0002rf-Kr
 for 73391 <at> debbugs.gnu.org; Fri, 20 Sep 2024 16:40:42 -0400
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 <neox@HIDDEN>)
 id 1srkQJ-0005x6-9o; Fri, 20 Sep 2024 16:40:15 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to:
 references; bh=4LWgZx1Noafn8UqfcXi1qKGOKUJF7oCOFV5ziWLLVHk=; b=MfjUL6M5ULXr/G
 hDJaQFG9OpLNVCCNoI2E7KVHmFLxPBLoE0w2iyQe2qML7BKkTubF4k8jtpll4AWPKBVMZOTGbxf0a
 WaFLfJx+d63YFLD4z+DGs+lekMKO7HnVtvYP8aAdf1v9i98myoGaWr6NKzdTBEnjscqYbyPJ8qZC9
 dAfsku+o+EmCNOuIzROvNLWNWgkqZ6bLAPLM2+en3KAxew4yKFCO4uFPrmQH5Vn+oJxyJi240TLZQ
 oNt9RPcoXjT7MLQ7JEJGHkXuQAfk0UJGvFu+6ToIxFwImFkTSNyprYt2mqnZ88vgpwDquxx65NyMt
 Jrls49/HuiAn7CYvIl1Q==;
From: neox <neox@HIDDEN>
To: 73391 <at> debbugs.gnu.org
Subject: [PATCH v2 0/2] SANE: fix a locking bug for plustek backend
Date: Fri, 20 Sep 2024 22:39:28 +0200
Message-ID: <cover.1726864525.git.neox@HIDDEN>
X-Mailer: git-send-email 2.46.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 73391
Cc: Adrien 'neox' Bourmault <neox@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

From: Adrien 'neox' Bourmault <neox@HIDDEN>

Hi, I just realized I forgot to add my copyright notice in the files I
modified. This v2 fixes this.

Adrien 'neox' Bourmault (2):
  gnu: sane-backends-minimal: fix lock path for plustek backend
  services: sane-service-type: create lock path for plustek backend

 gnu/packages/scanner.scm | 10 +++++++++-
 gnu/services/desktop.scm | 14 ++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)


base-commit: 1b6ce1796abdf497f61f426d61339318f4f4f23d
-- 
2.46.0





Information forwarded to guix-patches@HIDDEN:
bug#73391; Package guix-patches. Full text available.
Merged 73391 73392 73393. Request was from Adrien 'neox' Bourmault <neox@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 73391 <at> debbugs.gnu.org:


Received: (at 73391) by debbugs.gnu.org; 20 Sep 2024 19:20:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 20 15:20:10 2024
Received: from localhost ([127.0.0.1]:36379 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1srjAo-0006jt-Fp
	for submit <at> debbugs.gnu.org; Fri, 20 Sep 2024 15:20:10 -0400
Received: from eggs.gnu.org ([209.51.188.92]:42994)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <neox@HIDDEN>) id 1srjAm-0006ja-Md
 for 73391 <at> debbugs.gnu.org; Fri, 20 Sep 2024 15:20:09 -0400
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 <neox@HIDDEN>)
 id 1srj8I-0003eF-EP; Fri, 20 Sep 2024 15:17:34 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To:
 From; bh=0bWR2krmzD221EFq5rP/IpgjBZZyPz9xyoT9/ogyu0k=; b=NbHI1grSjy/HMVB/rtKJ
 Xwo/UVJc9Ci6sjwPUmBthMSZM2gNI7hJRGoIKQQmnwnAU/CkTVfvhCgpSc7JgqqiBslitsZBMDET/
 lupbsDI4/MRweF21o1jJpGvjYvkhlrMyaONbtNxMSJ0sazXCml64urbmcDXnJi0CIYCA5knC3ydJx
 DAxfKdHi+PRUIqchDlme2V4g5kCFCh7OTmJz1hnGVf7qH7Crh5ENkKQ7sTzE3rP3RlWOa3uiVu50o
 MNHpt3TZSdWSGFcA8WuhueAD6NJEB/K59DF6EDFngPlcqTxmLxX2rPL1KbpKgBU9TxryjV4bbiMSD
 hBq8iGA9jhZn3g==;
From: neox <neox@HIDDEN>
To: 73391 <at> debbugs.gnu.org
Subject: [PATCH 2/2] services: sane-service-type: create lock path for plustek
 backend
Date: Fri, 20 Sep 2024 21:17:31 +0200
Message-ID: <3ad4ed8a692d86a9bef0b2ea56921ae2bf882957.1726827449.git.neox@HIDDEN>
X-Mailer: git-send-email 2.46.0
In-Reply-To: <cover.1726827449.git.neox@HIDDEN>
References: <cover.1726827449.git.neox@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 73391
Cc: Adrien 'neox' Bourmault <neox@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

From: Adrien 'neox' Bourmault <neox@HIDDEN>

* gnu/services/desktop.scm (sane-service-type): extend with an activation
 service to create the lockpath and give the right permissions


Change-Id: I187886d12b5f0b4fe21b03de178ea2187205387a
Signed-off-by: Adrien 'neox' Bourmault <neox@HIDDEN>
---
 gnu/services/desktop.scm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 274aeeef9b..9eae4178fb 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -1408,6 +1408,17 @@ (define %sane-accounts
   ;; The '60-libsane.rules' udev rules refers to the "scanner" group.
   (list (user-group (name "scanner") (system? #t))))
 
+(define %sane-activation
+  #~(begin
+      (use-modules (guix build utils))
+      (let ((lockpath "/var/lock/sane")
+            (gid (vector-ref (getgrnam "scanner") 2)))
+        ;; Create the lock directory at runtime and give right perms
+        (mkdir-p lockpath)
+        (chown lockpath -1 gid)
+        (chmod lockpath #o770))
+      #t))
+
 (define sane-service-type
   (service-type
    (name 'sane)
@@ -1418,6 +1429,8 @@ (define sane-service-type
    (default-value sane-backends-minimal)
    (extensions
     (list (service-extension udev-service-type list)
+          (service-extension activation-service-type
+                             (const %sane-activation))
           (service-extension account-service-type
                              (const %sane-accounts))))))
 
-- 
2.46.0





Information forwarded to guix-patches@HIDDEN:
bug#73391; Package guix-patches. Full text available.

Message received at 73391 <at> debbugs.gnu.org:


Received: (at 73391) by debbugs.gnu.org; 20 Sep 2024 19:18:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 20 15:18:57 2024
Received: from localhost ([127.0.0.1]:36374 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1srj9d-0006h7-2t
	for submit <at> debbugs.gnu.org; Fri, 20 Sep 2024 15:18:57 -0400
Received: from eggs.gnu.org ([209.51.188.92]:39004)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <neox@HIDDEN>) id 1srj9b-0006gu-AA
 for 73391 <at> debbugs.gnu.org; Fri, 20 Sep 2024 15:18:56 -0400
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 <neox@HIDDEN>)
 id 1srj77-0003cP-1e; Fri, 20 Sep 2024 15:16:21 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To:
 From; bh=SITGMNM4yvBpT3NOZxg/2/N8fzJeArlYlkpvQs89/js=; b=r5OcGQ2bCUCR67pCu3Sh
 e5JJwWxcK/qGa91Wr9UTW8dEwF/Fw/0ZZOT2dNnCqlQjJyZCDf+JeigGppHvCxABW3MSnvlEKVFjO
 EeKepozkwJzACOdANfVBC8ZFwEQ2uRxdq7wOeTnjGwj4fAPGy9lBlPTmBjdQZKWtM8OMK5prdJjBL
 6huHDssAlb7KFJ0+bL37ShvWl5Yhp4YTD+jp5XkqNC8vbDLSFiPfJmtjfq0Tyh9icN2UdBc9vmiFh
 1UCbqo+ubh8xf4UrNQwrTHWzYEKquVy1Yyzef13TmgejMAHLiQYIW+7+6HddNrVIwPUSjgWg9TyZD
 5qmOE4x3rt30yg==;
From: neox <neox@HIDDEN>
To: 73391 <at> debbugs.gnu.org
Subject: [PATCH 1/2] gnu: sane-backends-minimal: fix lock path for plustek
 backend
Date: Fri, 20 Sep 2024 21:16:01 +0200
Message-ID: <5c51a9beba46c7f611fe90cc824f0fcbf2505600.1726827449.git.neox@HIDDEN>
X-Mailer: git-send-email 2.46.0
In-Reply-To: <cover.1726827449.git.neox@HIDDEN>
References: <cover.1726827449.git.neox@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 73391
Cc: Adrien 'neox' Bourmault <neox@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

From: Adrien 'neox' Bourmault <neox@HIDDEN>

* gnu/packages/scanner.scm (sane-backends-minimal)
[arguments]<#:configure-flags>: add "--with-lockdir=/var/lock/sane"
[arguments]<#:phases>: add disable-lockdir-creation to prevent creating the
 lockpath during install

Change-Id: I338c16cd4c0bfa0d165c9906b0f1f87ab79a4f75
Signed-off-by: Adrien 'neox' Bourmault <neox@HIDDEN>
---
 gnu/packages/scanner.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/scanner.scm b/gnu/packages/scanner.scm
index a2faaa2728..a20d27ad2a 100644
--- a/gnu/packages/scanner.scm
+++ b/gnu/packages/scanner.scm
@@ -136,7 +136,8 @@ (define-public sane-backends-minimal
     (inputs
      (list libusb))
     (arguments
-     `(#:phases
+     `(#:configure-flags '("--with-lockdir=/var/lock/sane") ;; Avoid errors with plustek
+       #:phases
        (modify-phases %standard-phases
          (add-before 'bootstrap 'zap-unnecessary-git-dependency
            (lambda _
@@ -145,6 +146,12 @@ (define-public sane-backends-minimal
                (("/bin/sh") (which "sh")))
              (with-output-to-file ".tarball-version"
                (lambda _ (format #t ,version)))))
+         (add-before 'configure 'disable-lockdir-creation
+           (lambda _
+             ;; Modify the Makefile.am to prevent the creation of the lock dir
+             (substitute* "backend/Makefile.am"
+               (("^install-lockpath:.*$")
+                "install-lockpath: # pass"))))
          (add-before 'configure 'disable-backends
            (lambda _
              (setenv "BACKENDS" " ")
-- 
2.46.0





Information forwarded to guix-patches@HIDDEN:
bug#73391; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 20 Sep 2024 19:04:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 20 15:04:23 2024
Received: from localhost ([127.0.0.1]:36356 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1srivW-0005tS-Op
	for submit <at> debbugs.gnu.org; Fri, 20 Sep 2024 15:04:23 -0400
Received: from lists.gnu.org ([209.51.188.17]:45228)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <neox@HIDDEN>) id 1srivU-0005tK-Vz
 for submit <at> debbugs.gnu.org; Fri, 20 Sep 2024 15:04:21 -0400
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 <neox@HIDDEN>) id 1srivB-0003f9-GX
 for guix-patches@HIDDEN; Fri, 20 Sep 2024 15:04:01 -0400
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 <neox@HIDDEN>)
 id 1sriv9-0001jp-1H; Fri, 20 Sep 2024 15:03:59 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to:
 references; bh=yXif4oJN4C9gmdO7NVR4+1e321i6416lEyimYyLmlpM=; b=qth+QP+UZblQ5S
 lfCXuEarFl0tRBXjrkKqpQkhMgOQTPgnvvZA0GBNvo0Q1XtUs5sRkBIMpUhH3ClidbNzO9icle6lf
 XjZlCJxtpSd18IB6fDCFIJK4LyBvNQ2wOc/s3RMAFns/OyYLv9xkXuEQ5JdRxLdBkuntNvbTrCMKx
 ybh2ro4IM1eFcU2ieE3e96WLz3U2F0p3HqS8H9NMmUeV3eg2DOM+BTDvZb0cyPaPEY2h1ISIsLuph
 VNqUvjjF23Lg0pVv6mgxLJhSG2K9g8sM1tySUr581n+XikWuX7oIoHMcgfFaJRbLRCOEWdreaKm8Y
 G7Bfek1tHK2wFacGP+4g==;
From: neox <neox@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH 0/2] SANE: fix a locking bug for plustek backend
Date: Fri, 20 Sep 2024 21:03:31 +0200
Message-ID: <cover.1726827449.git.neox@HIDDEN>
X-Mailer: git-send-email 2.46.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
Cc: Adrien 'neox' Bourmault <neox@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

From: Adrien 'neox' Bourmault <neox@HIDDEN>

Hi.
While attempting to use a Canon LiDE 30 scanner, which is supported by SANE in
its current version, I noticed a malfunction with the plustek backend. No
application seemed capable of detecting the scanner, even though the 
`sane-find-scanner` command indicated its presence, and the device IDs matched
those in the plustek backend configuration.

I investigated further using the following command:

  SANE_DEBUG_SANEI_USB=128 SANE_DEBUG_PLUSTEK=255 strace -fye open,openat scanimage -L

Here is a summary of the output:

  [23:00:21.688008] [plustek] usbDev_open(auto,) - 0x1c1e5630
  [pid 1209-20241] openat(AT_FDCWD</home/neox>, "/gnu/store/gzc1m4n79d1fgby8l58dsaq7nrzyhc14-sane-backends-1.3.1/var/lock/LCK..libusb:001:009", O_WRONLY|O_CREAT|O_EXCL, 0644) = -1 EROFS (Read-only file system)
  [23:00:21.688089] [plustek] sanei_access_lock failed: 11
  [23:00:21.688131] [plustek] open failed: -1

It seems that the issue is the attempt to open a lock file in the store, which
is not possible due to the read-only nature of the file system.

To address this, there were two possible approaches: either move the lock file
to another location or disable the locking mechanism altogether.

After some research, I found that this bug has been resolved in both Debian [1]
and nixOS [2], and it has also been reported to the upstream project [3]. Debian
opted to disable the locking mechanism, while nixOS moved the lock file to a
runtime-generated location using systemd (by patching the install phase to
prevent the creation of the lock directory). However, since the locking
mechanism allows the use of multiple devices simultaneously[4], which can be
useful, nixOS's solution appears to be the better approach. I followed this
method, proposing to create the lock directory during the activation of the
sane service.

I tested these patch with my Canon LiDE 30 and have been able to (finally)
scan with it.

[1] Debian bug report: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=973490
[2] nixOS bug report: https://github.com/NixOS/nixpkgs/issues/273280
[3] Upstream issue: https://gitlab.com/sane-project/backends/-/issues/363
[4] https://gitlab.com/sane-project/backends/-/issues/363#note_443142177

Adrien 'neox' Bourmault (2):
  gnu: sane-backends-minimal: fix lock path for plustek backend
  services: sane-service-type: create lock path for plustek backend

 gnu/packages/scanner.scm |  9 ++++++++-
 gnu/services/desktop.scm | 13 +++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

base-commit: 1b6ce1796abdf497f61f426d61339318f4f4f23d
-- 
2.46.0





Acknowledgement sent to neox <neox@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#73391; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.