GNU bug report logs - #73393
[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 #73391, #73392, #73406; dated Fri, 20 Sep 2024 19:05:04 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

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


Received: (at 73393) by debbugs.gnu.org; 24 Sep 2024 18:53:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 24 14:53:27 2024
Received: from localhost ([127.0.0.1]:36128 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1stAf9-0007tI-BQ
	for submit <at> debbugs.gnu.org; Tue, 24 Sep 2024 14:53:27 -0400
Received: from mail-wm1-f65.google.com ([209.85.128.65]:58766)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <liliana.prikler@HIDDEN>) id 1stAf7-0007ss-Gr
 for 73393 <at> debbugs.gnu.org; Tue, 24 Sep 2024 14:53:26 -0400
Received: by mail-wm1-f65.google.com with SMTP id
 5b1f17b1804b1-42cb2191107so48803855e9.1
 for <73393 <at> debbugs.gnu.org>; Tue, 24 Sep 2024 11:53:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1727203915; x=1727808715; darn=debbugs.gnu.org;
 h=mime-version:user-agent:content-transfer-encoding:references
 :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date
 :message-id:reply-to;
 bh=frAj0pHEWRZq5rnxHigpSdryWtq5W+vgnwBu2p7mZvo=;
 b=kMK4Ba5nPE857l0Gj+5a5GP3Yn6fY96e4yM9ZkpvtvLjzeed5WIRC4RSpihXJPH9JX
 aVYaLP0+EcAz9nKyRaPLC3RGcMVon2dvn7ZBPPqGcmlNBJnDbsMpFofbvmspDrWypY4a
 bKEUtNJ2YRO2WwVU4dm6hNooruR2FzMjpb+JlbtLxIUKEPEly32URtU7vihnLtsN31uI
 t029rGMvPG6muBBqZnn1UP2KIojqmyFcDTXotr7wb4NRfVN0DKU9YEtPHMw8xdE8QB+h
 tMpVEgJ0N7MtexGbYp7ATn9SfPh8sTLWdVOem7t4AMo9JBYTialX7VmDjCNFekhVyD86
 8bPQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1727203915; x=1727808715;
 h=mime-version:user-agent:content-transfer-encoding:references
 :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=frAj0pHEWRZq5rnxHigpSdryWtq5W+vgnwBu2p7mZvo=;
 b=ZKgo33+UOUICpvsLFwrwua1DPB84ZMJ/CjzDww+sG4fbyBHGbcIrbCEDnTgI7Mnu6c
 o8d2dto1cBl7JFti3u48hRtOJVzY3Bcf4SezRkpbx1TdpuYUQy+10cDEQ1gmsUMdt1BN
 RZYeoLhaeV41jshvvHMk7jKbQs6DlUkRAYP+Sn6gObyOCM4JjV2eZPOCGwaSZ3w1vN+c
 jP9FmQkdC4VSL4U66lT9BJPmuhH+FZvS3YPkyKkxIw1AJkplLvgy0gPwJmAxlICAz8yr
 ESD5JDjV81D9/Yopj/yvwto5pQF+ASyne5/meg1GVqXwp9hspXK1L5GtVXyZVr9A+/ve
 +pVw==
X-Forwarded-Encrypted: i=1;
 AJvYcCVJ/iHqZlA2LsCuhKzA7ttYPaLUAPhip885N5JkR27fFvcDzZtnO5bO+1a/EukH2IqrWc0adQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0Yz1JF5ukLz/JYaDNsP7gCTJOUZXUnJ1PNwgguIE3/meZbtJTgi1
 BFrdL+5KN7DaouTwenpser4fHgSWu/6BMNW5UZyb00aCuSRu18H6
X-Google-Smtp-Source: AGHT+IGwlMP1u4AaLlXdUf5VEqb2PVHo7nnmNk/vHnZrhpAOiHFs1YalNxQn3aSKw8Ji55i7646iKw==
X-Received: by 2002:a05:600c:1d2a:b0:42b:afe3:e9f4 with SMTP id
 5b1f17b1804b1-42e96103a3dmr596915e9.3.1727203914571; 
 Tue, 24 Sep 2024 11:51:54 -0700 (PDT)
Received: from lumine.fritz.box (85-127-114-32.dsl.dynamic.surfer.at.
 [85.127.114.32]) by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-42e90298b45sm30311595e9.20.2024.09.24.11.51.52
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 24 Sep 2024 11:51:53 -0700 (PDT)
Message-ID: <8bd98b75d2f3116233710d127faaed61be017fae.camel@HIDDEN>
Subject: Re: [PATCH v2 0/2] SANE: fix a locking bug for plustek backend
From: Liliana Marie Prikler <liliana.prikler@HIDDEN>
To: Adrien 'neox' Bourmault <neox@HIDDEN>, 73393 <at> debbugs.gnu.org
Date: Tue, 24 Sep 2024 20:51:51 +0200
In-Reply-To: <cover.1726864525.git.neox@HIDDEN>
References: <cover.1726864525.git.neox@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
User-Agent: Evolution 3.48.4 
MIME-Version: 1.0
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 73393
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: -1.0 (-)

Hi Adrien,

Mumi appears to have this thing again where clicking on some button to
retrieve a message retrieves the wrong message.  Thus, I will answer to
this one while referencing the stuff in the patches.

Am Sonntag, dem 22.09.2024 um 11:07 +0200 schrieb Adrien 'neox'
Bourmault:
> =C2=A0 gnu: sane-backends-minimal: fix lock path for plustek backend
It would be nice if we had an actual patch here rather than a crude
substitute*.  I know it's a sed script on Nix, but that feels kinda
weird to say the least.

> =C2=A0 services: sane-service-type: create lock path for plustek backend
You should look into making this atomic.  It's currently three syscalls
in a row, which would make this vulnerable to race conditions.=20
Consider passing a mode to mkdir.

Cheers




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

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


Received: (at 73393) by debbugs.gnu.org; 22 Sep 2024 09:08:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 22 05:08:53 2024
Received: from localhost ([127.0.0.1]:40877 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ssIaL-0005Hd-3Z
	for submit <at> debbugs.gnu.org; Sun, 22 Sep 2024 05:08:53 -0400
Received: from eggs.gnu.org ([209.51.188.92]:36968)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <neox@HIDDEN>) id 1ssIaH-0005H1-If
 for 73393 <at> debbugs.gnu.org; Sun, 22 Sep 2024 05:08:50 -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 1ssIZq-0002CS-T0; Sun, 22 Sep 2024 05:08:22 -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=/5ublfufOcudc9IjBbBZJgcwCwVNsKfI9gGUTgLELzc=; b=o4jM4+IIOkfVvspJseoP
 wRhUFQlfRoTxj6jekHLpH4GGbVTYokMjhOIS06vtVksmmYmDSekVYH9LPqgoWyyWgjjj2toe6AeW1
 AFsvRtCEp0/AWJEmuvOd1816G/pVvVvpvq5n6UOttrYiy198ogNEUhOlPPGELkWOZjSCMzo3LImfK
 M3f7krKynp5vgEgrCD+cuTM9JRjjQ0EdmvY0lfUqmg6EKVC9k9Lt5k9YNwMP3NpPFC7tXCQYd4WT0
 L3rBPkTZHE0tsyOMgS70fAEW74XQZTXb/BAaAId5NQ5rc25UpxYRv30cMs2on6H1zz+A2rBcbonEF
 JmpvZgOIaFdv6Q==;
From: Adrien 'neox' Bourmault <neox@HIDDEN>
To: 73393 <at> debbugs.gnu.org
Subject: [PATCH v2 2/2] services: sane-service-type: create lock path for
 plustek backend
Date: Sun, 22 Sep 2024 11:07:58 +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: 73393
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 (---)

* 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#73393; Package guix-patches. Full text available.

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


Received: (at 73393) by debbugs.gnu.org; 22 Sep 2024 09:08:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 22 05:08:50 2024
Received: from localhost ([127.0.0.1]:40873 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ssIaH-0005HN-Dx
	for submit <at> debbugs.gnu.org; Sun, 22 Sep 2024 05:08:50 -0400
Received: from eggs.gnu.org ([209.51.188.92]:36964)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <neox@HIDDEN>) id 1ssIaF-0005Gt-15
 for 73393 <at> debbugs.gnu.org; Sun, 22 Sep 2024 05:08:48 -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 1ssIZo-0002C9-9O; Sun, 22 Sep 2024 05:08:20 -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=SGIX3lKzdvIsn4XzV4xaeCZ/n0iY37uv9n0DhTSWRQw=; b=qIvRZmj5Do6q3x3jqP4N
 p+WexGvXV02K9wZCsJUMcUFBlNXuXkktKy1r43NY9YmSY8BzXqCpOqO0jEKFPXpDo8tHcxvGma8CB
 02Wofiptb6w9hqL/hLNan6nF+d5eqd+fHP8F9+clYvgxgsUpAcYL29DX6sERJDmGxS3tMZ1/Sy4qf
 QCdvHbMwa720eJmObVj2Tce7m6wZdDblmr1mdu77pfI5F2rLbTciKFNWF6D+3D/Z5dkNwPoXmi9E/
 d0Kan5yCriw9PjuoqWnDkPyceNP9FjAbkwyA0Ly681/sFc9JCGS0sUq/XHSsi7SwzAlG83mlNxIeU
 JdmsRIydwg82Ag==;
From: Adrien 'neox' Bourmault <neox@HIDDEN>
To: 73393 <at> debbugs.gnu.org
Subject: [PATCH v2 1/2] gnu: sane-backends-minimal: fix lock path for plustek
 backend
Date: Sun, 22 Sep 2024 11:07:57 +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: 73393
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 (---)

* 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#73393; Package guix-patches. Full text available.

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


Received: (at 73393) by debbugs.gnu.org; 22 Sep 2024 09:08:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 22 05:08:45 2024
Received: from localhost ([127.0.0.1]:40869 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ssIaD-0005H5-0W
	for submit <at> debbugs.gnu.org; Sun, 22 Sep 2024 05:08:45 -0400
Received: from eggs.gnu.org ([209.51.188.92]:43838)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <neox@HIDDEN>) id 1ssIaA-0005Gn-V1
 for 73393 <at> debbugs.gnu.org; Sun, 22 Sep 2024 05:08:43 -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 1ssIZj-0002Bq-WF; Sun, 22 Sep 2024 05:08:16 -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=TDkffOLoFLNL8/m3nfO/sXsGH9iP37fRGnT18WrYRHc=; b=pEa6ziopKP4TXj
 OEKhekXLyDuF/2xcQcG50lObDy7b2mCUsymfdZm0Y7X8MGnvxn2HDYf9zOUMQngW4CEPZx/DJ3+QE
 VhcprKSNL9w5yrlA2sbuV6+h75dBaNCgqz0GphliXawuFSu/1uTvKyZUjQmAfTruGHuwM/yqSTvqP
 nhSq/rJRQg3PtOtp1TJtVjIUTv6cSb9FjJZgYswj75P3gka8It7gA6lQTKj1OsZwTW+ORTXlxiuTv
 sj/aovBZuXxU1hwJ+ByR7UFRU9RV4Y57Vxgt8yzVCg0OGu146RQWMGUlAycv4tNFksriDymAMvwb+
 C/fe/pNQ5LfTXd1o1Z4A==;
From: Adrien 'neox' Bourmault <neox@HIDDEN>
To: 73393 <at> debbugs.gnu.org
Subject: [PATCH v2 0/2] SANE: fix a locking bug for plustek backend
Date: Sun, 22 Sep 2024 11:07:56 +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: 73393
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 (---)

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-backend>
  [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.

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

[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 | 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#73393; Package guix-patches. Full text available.

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


Received: (at 73393) by debbugs.gnu.org; 22 Sep 2024 08:56:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 22 04:56:31 2024
Received: from localhost ([127.0.0.1]:40864 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ssION-0004fH-Nz
	for submit <at> debbugs.gnu.org; Sun, 22 Sep 2024 04:56:31 -0400
Received: from eggs.gnu.org ([209.51.188.92]:59012)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <neox@HIDDEN>) id 1ssIOM-0004f1-9f
 for 73393 <at> debbugs.gnu.org; Sun, 22 Sep 2024 04:56:31 -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 1ssINv-00018T-AB
 for 73393 <at> debbugs.gnu.org; Sun, 22 Sep 2024 04:56:03 -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:To:From:Subject:in-reply-to:
 references; bh=Vz+vjE63ggMR+6ehvudownR8B0HXZ7p39xmgIMh3L6U=; b=bXTrc/aBb8YflZ
 v4xLgFJPL+ZbBCPMuT2aHj3pQYsIO+TtU/b+OmQNC746ff0qomK4U31L+Vigg13rirOvqsZV6JSAM
 JDPPRBb78gDrEUrnpNb+EQYUv444AB4mNrJ0FFRk4grcZgcGdP+Vt8zchRagsznyBDe74ppKejy8r
 0kd02d7gQ1MpA8ClUffnJKPkWQ8V6LaqXpN3wzC+oZ1sAThN+amzY5JdcWoblGgjEzw3XxQqJamWG
 Pb7nwH597l/lxg4WFE6gTBKx2kSKe7Sy1L8gY9XNgzE1QVGFomfmW4VeAop5leuYG73994EM9A30P
 P8Bw8Iak0OFSCsw2p37A==;
Message-ID: <069c91c965bfd1550ab927b63601e70e1b98d98e.camel@HIDDEN>
Subject: [PATCH 2/2] services: sane-service-type: create lock path for
 plustek backend
From: Adrien 'neox' Bourmault <neox@HIDDEN>
To: 73393 <at> debbugs.gnu.org
Date: Sun, 22 Sep 2024 10:55:55 +0200
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
User-Agent: Evolution 3.48.4 
MIME-Version: 1.0
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 73393
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 (---)

Sorry for all that noise, that's my first time using Debbugs and I got
a little lost here, trying to obtain a clear merge...




Information forwarded to guix-patches@HIDDEN:
bug#73393; Package guix-patches. Full text available.
Changed bug title to '[PATCH v2 0/2] SANE: fix a locking bug for plustek backend' from '[PATCH 2/2] services: sane-service-type: create lock path 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.
Merged 73391 73392 73393. Request was from Adrien 'neox' Bourmault <neox@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at 73393) by debbugs.gnu.org; 20 Sep 2024 19:22:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 20 15:22:11 2024
Received: from localhost ([127.0.0.1]:36386 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1srjCl-0006vk-8d
	for submit <at> debbugs.gnu.org; Fri, 20 Sep 2024 15:22:11 -0400
Received: from eggs.gnu.org ([209.51.188.92]:53478)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <neox@HIDDEN>)
 id 1srjCj-0006vN-3d; Fri, 20 Sep 2024 15:22: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 1srjCK-00045H-Kl; Fri, 20 Sep 2024 15:21:44 -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:To:From:
 Subject; bh=9x/L8V8qoY6KDwKr2BBOpwINL2gwHoL9ZM1PP6Dc/o4=; b=Ns1IvJ3tVjy8bvoHD
 qPOfOAxoZtvU5MYSizklcHNVkZtNupAiAiQRx/TOGPowFaRhmeRKG37nW6Sjibh9d9cMUndWqQdf8
 5DhrEn+b51Lj0uI8Ez0SwRQ/Yfj0W34ARNV1vNIE6gA84CYcxIJ7xRabETvPmnlneYU0LFFhkLsP0
 MwtuzS09QrbsStV1e/2QilxDwoG9uTGeiHsOTpFmIaFqSsejOQrQPKh8qvLee0pXAfxvGllPiqjf7
 M/nTC7BG6M1QzKkJPY75ibmF1qBYe4aneEnN9bszDT+7sSc42myshZcHeZM5Sm+9G6ZQJe4T0FxyI
 yuGR8LgImq9Dtur0g==;
Message-ID: <b6a589d6a295e755f40b9d6f9cff1e2815248626.camel@HIDDEN>
Subject: Re: bug#73392: Acknowledgement ([PATCH 1/2] gnu:
 sane-backends-minimal: fix lock path for plustek backend)
From: Adrien 'neox' Bourmault <neox@HIDDEN>
To: 73392 <at> debbugs.gnu.org, 73393 <at> debbugs.gnu.org
Date: Fri, 20 Sep 2024 21:21:43 +0200
In-Reply-To: <handler.73392.B.172685906722683.ack <at> debbugs.gnu.org>
References: <5c51a9beba46c7f611fe90cc824f0fcbf2505600.1726827449.git.neox@HIDDEN>
 <handler.73392.B.172685906722683.ack <at> debbugs.gnu.org>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
User-Agent: Evolution 3.48.4 
MIME-Version: 1.0
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 73393
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 (---)

Hi, please close as this is a duplicate of #73391 due to a
misconfiguration on my part. Thanks a lot and sorry about this.




Information forwarded to guix-patches@HIDDEN:
bug#73393; 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:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 20 15:04:46 2024
Received: from localhost ([127.0.0.1]:36364 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1srivu-0005uS-J3
	for submit <at> debbugs.gnu.org; Fri, 20 Sep 2024 15:04:46 -0400
Received: from lists.gnu.org ([209.51.188.17]:54886)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <neox@HIDDEN>) id 1srivt-0005uK-6g
 for submit <at> debbugs.gnu.org; Fri, 20 Sep 2024 15:04:45 -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 1srivZ-0003gq-45
 for guix-patches@HIDDEN; Fri, 20 Sep 2024 15:04:25 -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 1srivY-0001lF-1W; Fri, 20 Sep 2024 15:04:24 -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=juLkFoYxoCo4XaSikYQH
 SfGQ9deJm2R29hPLnMw6xWK+9Ibh+wFCw+FvV+Fd9BWutHtZ9JSqHDs4dNeGsNL3pDELQ+PmxW1p2
 vaKbYWqtDlaS1SxLfK+GOOOkrutEOCvtzjo+dgnQtrs7bvfXK3lrwcjzHacCdWU+XH0lDr29janOA
 NVvEirwkeNAIibmAT2qT4nYreUTxItkgb5MQ+DCfLhKBOwdRM/yFTduWBexlqRdqUgMvX+PW+IcwL
 m2I2k63JZIlnR+0+snT+Ix+eDt+ycYpOL9QHLhHX8Awn2kadFH3xATr2hmXHweb/FtYAVGDZkOiWf
 i8O9MzO1ax5NCw==;
From: neox <neox@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH 2/2] services: sane-service-type: create lock path for plustek
 backend
Date: Fri, 20 Sep 2024 21:03:33 +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: 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>

* 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





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#73393; 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.