From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id aFidAcYXSGWGNQAA9RJhRA:P1 (envelope-from ) for ; Sun, 05 Nov 2023 23:31:34 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id aFidAcYXSGWGNQAA9RJhRA (envelope-from ) for ; Sun, 05 Nov 2023 23:31:34 +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 30C3A358BE for ; Sun, 5 Nov 2023 23:31:33 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=fI7xb8Fz; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1699223493; a=rsa-sha256; cv=none; b=rtgVdUugIzRArhPQGWNjfRUQTNyLLTCZlcFCiwUk635UV5eR8R+IGzhcePxmwz91BhaHsh qFmowwHpJ9l3ot6y/LytIkDnzDy+Ir1egXJDrtA3hV+rRe0oR68JNBCDyqgs6oNCk8F1LU mVzLiTOzRRvvf+nTSGNmGbr7N59sd7gec1zZzqACta4z1bZIZXbmXQnf968wYRDjJNLafQ Dc3r9TfAxTPZeSMRs0j2Akca2Fp45kyeocggIPNZQPieui4RvNSrlVLwmvEct5S89rvX/X OQf7AdmTGMfsSHABFRA1MsSMrv3zWD6xv/P8mK0h+a/KioDeF9v0ikpOFIxyiQ== 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=fI7xb8Fz; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1699223493; 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: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=j8FxZkeeXD/0/5pp3FmjZC1k0IQ6m+ALpWDhzAwDZs4=; b=Ly+wlyOyZL2+7GBz+kvTXv3p97bveaXLi9rfjiueYb8mqRwrzPsxGOdxH5DoyaahVOwZvM mq7FLvBhWn+oOPN9UV/gR6lMM14PX5fhN0wNb8BWKGB3ne/16E3drezKtxnbC4NkaXuMdN wcpuWZUSg6f1UoVt5rbdRQvhM9B/kEstW+NkweWg6knZaZX3nmPPWifWsgT4YNFHadrT4v 5VeDFUWPsSULpqPsbCb+fs5dO7BhaJ84fo14xaljG6wHT9vg1N75DjsJss/b8Q4Df2JBq6 APZmnkoDM4//1/xnIzGi9OjcoSVYUVukdy0aLVWH68sdAqOZgK4/AfhAqmgaLg== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qzleR-0002Uj-7q; Sun, 05 Nov 2023 17:31:27 -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 1qzleP-0002UP-Oq for guix-patches@gnu.org; Sun, 05 Nov 2023 17:31:26 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qzleP-0000y2-Gb for guix-patches@gnu.org; Sun, 05 Nov 2023 17:31:25 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qzlf0-0003VS-F8 for guix-patches@gnu.org; Sun, 05 Nov 2023 17:32:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#65343] [PATCH v2] home: services: Add 'x11-display' service. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 05 Nov 2023 22:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Oleg Pykhalov Cc: 65343@debbugs.gnu.org, Brian Cully Received: via spool by 65343-submit@debbugs.gnu.org id=B65343.169922348713424 (code B ref 65343); Sun, 05 Nov 2023 22:32:02 +0000 Received: (at 65343) by debbugs.gnu.org; 5 Nov 2023 22:31:27 +0000 Received: from localhost ([127.0.0.1]:38315 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qzleR-0003US-Cn for submit@debbugs.gnu.org; Sun, 05 Nov 2023 17:31:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59662) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qzleQ-0003UE-El for 65343@debbugs.gnu.org; Sun, 05 Nov 2023 17:31:26 -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 1qzldY-0000kf-Fp; Sun, 05 Nov 2023 17:30:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=j8FxZkeeXD/0/5pp3FmjZC1k0IQ6m+ALpWDhzAwDZs4=; b=fI7xb8Fzsw/Vj9jB5a5z uUYvQnw5tD/3YsraYEggtV2eQaA4IPWfra2TIWj1g64PEpK6vy+3RC0oJ8IKf3zzIL93W0nQStsph I7x9ME7jgNotvwyHqo30w4ZFKdrDcTyGdxvch7NI3Ft00CBMu+OCBCf0fZa7iCbrIs1RiX0iaHP1I KxNQDQE8Si7u4Xnt9eN0nZ07/TQGB6Z1mpaMV0O3r8abvr3tw7B4ne3BVeCXkaij0Oe1kA3EEG0DD 8Bk7duy4Xf4Qqbh6f8/iYOstkoZlmEbOkoSZq4n3F/5FweESxshhvdqth6A5E9dhuQ3hZoS3l8svT OrWFZ5+dQG78ag==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: <87lebekc3u.fsf@gmail.com> (Oleg Pykhalov's message of "Fri, 03 Nov 2023 19:58:29 +0300") References: <87il8c2xdd.fsf@gmail.com> <87lebekc3u.fsf@gmail.com> Date: Sun, 05 Nov 2023 23:30:30 +0100 Message-ID: <87wmuvygs9.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 30C3A358BE X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -4.31 X-Spam-Score: -4.31 X-TUID: 4fje3jYeolJQ --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Oleg Pykhalov skribis: > During testing in a virtual machine I found an issue, which could be > reproduced with the steps bellow. It's not an emergency issue which > blocks the patch from merging, because we still have a workaround in our > pocket (stop and start =E2=80=98shepherd=E2=80=99 manually on a specific = =E2=80=98DISPLAY=E2=80=99). > > - start =E2=80=98shepherd=E2=80=99 manually on =E2=80=98127.0.0.1:5=E2=80= =99 by typing =E2=80=98shepherd=E2=80=99 in a > GUI terminal; > - stop =E2=80=98x11-display=E2=80=99 with =E2=80=98herd stop x11-display= =E2=80=99; > - start =E2=80=98x11-display=E2=80=99 with =E2=80=98herd start x11-displa= y :1=E2=80=99; > - start =E2=80=98redshift=E2=80=99 with =E2=80=98herd start redshift=E2= =80=99. > > The =E2=80=98redshift=E2=80=99 service starts a =E2=80=98redshift=E2=80= =99 process. The > /proc/REDSHIFT_PID/environ file has a =E2=80=98DISPLAY=E2=80=99 variable = setted to > =E2=80=98127.0.0.1:5=E2=80=99. Indeed, good catch! There was a bug: it=E2=80=99s not enough to call =E2= =80=98setenv=E2=80=99 because =E2=80=98make-forkexec-constructor=E2=80=99 & co. have an explicit #:environment-variables parameter, which defaults to the environment of =E2=80=98shepherd=E2=80=99 when it was started. (On top of that, setting t= he =E2=80=98default-environment-variables=E2=80=99 SRFI-39 parameter from the = =E2=80=98start=E2=80=99 method of =E2=80=98x11-display=E2=80=99 wouldn=E2=80=99t work because each = fiber has its own dynamic environment=E2=80=A6) I had to make the change below. Result pushed as commit 08d94fe20eca47b69678b3eced8749dd02c700a4. Thank you for reviewing and testing! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm index 45a319c0f8..91465bf168 100644 --- a/gnu/home/services/desktop.scm +++ b/gnu/home/services/desktop.scm @@ -92,6 +92,11 @@ (define (x11-shepherd-service delay) (let ((display (or display (find-display #$delay)))) (when display + ;; Note: 'make-forkexec-constructor' calls take their + ;; default #:environment-variables value before this service + ;; is started and are thus unaffected by the 'setenv' call + ;; below. Users of this service have to explicitly query + ;; its value. (setenv "DISPLAY" display)) display))) (stop #~(lambda (_) @@ -244,9 +249,20 @@ (define (redshift-shepherd-service config) ;; available, and fails to start otherwise. (requirement '(x11-display)) - (start #~(make-forkexec-constructor - (list #$(file-append (home-redshift-configuration-redshift config) "/bin/redshift") - "-c" #$config-file))) + (modules '((srfi srfi-1) + (srfi srfi-26))) + (start #~(lambda _ + (fork+exec-command + (list #$(file-append + (home-redshift-configuration-redshift config) + "/bin/redshift") + "-c" #$config-file) + + ;; Inherit the 'DISPLAY' variable set by 'x11-display'. + #:environment-variables + (cons (string-append "DISPLAY=" (getenv "DISPLAY")) + (remove (cut string-prefix? "DISPLAY=" <>) + (default-environment-variables)))))) (stop #~(make-kill-destructor)) (actions (list (shepherd-configuration-action config-file)))))) --=-=-=--