GNU bug report logs - #55080
[PATCH shepherd] service: Gracefully handle non-existing log directories.

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: Liliana Marie Prikler <liliana.prikler@HIDDEN>; Keywords: patch; dated Sat, 23 Apr 2022 13:18:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

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


Received: (at 55080) by debbugs.gnu.org; 30 Apr 2022 14:26:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 30 10:26:48 2022
Received: from localhost ([127.0.0.1]:58786 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nko3c-0007ib-3Y
	for submit <at> debbugs.gnu.org; Sat, 30 Apr 2022 10:26:48 -0400
Received: from mail-ej1-f68.google.com ([209.85.218.68]:41574)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <liliana.prikler@HIDDEN>) id 1nko3Z-0007iN-HL
 for 55080 <at> debbugs.gnu.org; Sat, 30 Apr 2022 10:26:46 -0400
Received: by mail-ej1-f68.google.com with SMTP id dk23so20326735ejb.8
 for <55080 <at> debbugs.gnu.org>; Sat, 30 Apr 2022 07:26:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=message-id:subject:from:to:cc:date:in-reply-to:references
 :user-agent:mime-version:content-transfer-encoding;
 bh=WvNNoaDC0BJB+h22qXCIdCYszNSI2AsUj4op9xzVdwY=;
 b=YpOM6OaVkQV6Uqh9giAXdh/YBySygXy9tJMl3V6tVPqTepCnKIbdD1ut0JcAuGfrBG
 CY6411N7647lfiSEvGJqZDVrpf8XYM2FIwdPiYV8wK7ALby3/ZL93sRykKeRWHjQqb+r
 hGKjpasXVg/mG+0XmnCh9ezYayyCRA89Fht5vmqG+lr6yR6aUdnsxvqzO7JkI+o7RYOH
 NA3rhjRhOKBwkYEBw19vTysh/nalaYdm+TCy4dxFT5JiWbtBg+3gz72gAxAfHtA+fSV0
 9CndLLqrsAAgSOWHdMY9ah4RqFbTvyeFKtsCwL39H/AsiQHhtVwK4nsi7fu8BtxjiZTS
 15vQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to
 :references:user-agent:mime-version:content-transfer-encoding;
 bh=WvNNoaDC0BJB+h22qXCIdCYszNSI2AsUj4op9xzVdwY=;
 b=PC4+Y2z9rUZg/OtDj05+cJfDl91gXed0BQ8ci1/ry0El7kIIphAiDivjsZETJgMBYK
 pdmpIIukevhHCMzMFpuE+Nu6+5CA2BGSlQvKBPM7Rcyg3ZjiLFMOcrxicWLTnD0xYjq1
 fE6Z617zCONeAN+l7eATd7fbe2VihKrGxJMCAVN3PS4lGpoEiZ+/7uWvYdILl89l6595
 mle1+mC4Ov+6fRCujf3thEFQEyloS12L+FQx3V8pgyDvl1oBqg4fygYv5gSKQnXx7jbG
 3mH7PnY85WZyBedWGDI98OeMcIzTrRH3ah+qXCaRua8cINw/+mLExe2n9wmgWnyiEVZy
 e6uA==
X-Gm-Message-State: AOAM531UkqhNA5vf09SsaNxa7udc+ykcfeX7GyrF4fB1wzURsPsPhEXH
 aWEsdaDZW1B99bYtkdhAMDI=
X-Google-Smtp-Source: ABdhPJxS1Ku6D27KVuzJJUyx6L70bTwS+CdVHB8sy3z7EbFhHfdtmn0yjgTm9E3r3awk5/WIE1bM5g==
X-Received: by 2002:a17:907:c07:b0:6f3:a3b2:9582 with SMTP id
 ga7-20020a1709070c0700b006f3a3b29582mr4117086ejc.91.1651328799545; 
 Sat, 30 Apr 2022 07:26:39 -0700 (PDT)
Received: from nijino.fritz.box ([85.127.52.93])
 by smtp.gmail.com with ESMTPSA id
 jx22-20020a170907761600b006f3ef214df6sm1648566ejc.92.2022.04.30.07.26.37
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 30 Apr 2022 07:26:38 -0700 (PDT)
Message-ID: <f256ec6b0af573bcd118acd6ddeb81e0fba72116.camel@HIDDEN>
Subject: Re: bug#55080: [PATCH shepherd] service: Gracefully handle
 non-existing log directories.
From: Liliana Marie Prikler <liliana.prikler@HIDDEN>
To: Ludovic =?ISO-8859-1?Q?Court=E8s?= <ludo@HIDDEN>
Date: Sat, 30 Apr 2022 16:26:29 +0200
In-Reply-To: <8735hu64je.fsf@HIDDEN>
References: <2e5292c2d45e525aa1b8e4c495704104d4121291.camel@HIDDEN>
 <8735hu64je.fsf@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
User-Agent: Evolution 3.42.1 
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 1.3 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Am Samstag, dem 30.04.2022 um 16:15 +0200 schrieb Ludovic
   Courtès: > > > +(define (service-file-logger file input) > > +  "Return
   a thunk meant to run as a fiber that reads from INPUT > > and logs i [...]
    
 
 Content analysis details:   (1.3 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  1.3 RCVD_IN_VALIDITY_RPBL  RBL: Relay in Validity RPBL,
                             https://senderscore.org/blocklistlookup/
                             [209.85.218.68 listed in bl.score.senderscore.com]
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (liliana.prikler[at]gmail.com)
  0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
                             [209.85.218.68 listed in wl.mailspike.net]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [209.85.218.68 listed in list.dnswl.org]
  0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders
 -0.0 T_SCC_BODY_TEXT_LINE   No description available.
X-Debbugs-Envelope-To: 55080
Cc: 55080 <at> debbugs.gnu.org
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: 0.3 (/)

Am Samstag, dem 30.04.2022 um 16:15 +0200 schrieb Ludovic Courtès:
> 
> > +(define (service-file-logger file input)
> > +  "Return a thunk meant to run as a fiber that reads from INPUT
> > and logs it to
> > +FILE."
> > +  (catch 'system-error
> > +    (lambda ()
> > +      (%service-file-logger file input))
> > +    (lambda args
> > +      (if (= ENOENT (system-error-errno args))
> > +          (begin
> > +            (mkdir-p (dirname file))
> > +            (%service-file-logger file input))
> > +          (apply throw args)))))
> 
> I wonder to what extent automatically creating log directories is a
> good idea.  A potential drawback is if shepherd creates them with
> unexpected ownership or permissions.
As far as I know, those logs should be managed by shepherd, no?  It
just redirects stdout/stderr there, or is there something special going
on?

> Did you encounter this issue while working on services?
> 
> Am I right that the Shepherd 0.8 had the same problem?
It might be, I don't know.  I've encountered this for non-existing log
directory, so a reproducer would be setting #:log-file to $test-tmp-
directory/does-not-exist/log and check for each service.

Cheers 




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

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


Received: (at 55080) by debbugs.gnu.org; 30 Apr 2022 14:15:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 30 10:15:45 2022
Received: from localhost ([127.0.0.1]:58777 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nknsu-0007SS-Qo
	for submit <at> debbugs.gnu.org; Sat, 30 Apr 2022 10:15:45 -0400
Received: from eggs.gnu.org ([209.51.188.92]:41796)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1nknsu-0007SG-6x
 for 55080 <at> debbugs.gnu.org; Sat, 30 Apr 2022 10:15:44 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:45546)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1nknso-0004JQ-Oo; Sat, 30 Apr 2022 10:15:38 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=vHvVgdnR+6zn59L045OWabG+JFHnCQKgb4OhoFiBArU=; b=E3qZSON98TJUiTXuu8fH
 qS8a7t3hhjCQfVCUn3otBoDSGqCiIevR28G1je9qfci6+dVxaKk9wTRdvTygmZ77Jy7eisAFu9rYN
 ZksO2/ToJpgJ/q7jDBKvG5qMj03EDsl3eG+jt/63PPDYVeBUI+QhazzBNw6KIjXPgPjSc2vPdq8XN
 n+YkA138EXxgXjP1hE+AcjNF31QqqQ2IckxMdGHCT5NTXGtilJr5CqwHa2h6eXOgoPo0cEdTJaJpA
 McFopjQb9NvCpd9MlI1XspmubGvm1PxHgMaQ44eDWX0HgRAN6+NDlK2y+B7FS+jplwE5JsSgBeWXP
 54yvnVkuYhHGbQ==;
Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:59400
 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1nknsl-00055q-Ud; Sat, 30 Apr 2022 10:15:38 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Liliana Marie Prikler <liliana.prikler@HIDDEN>
Subject: Re: bug#55080: [PATCH shepherd] service: Gracefully handle
 non-existing log directories.
References: <2e5292c2d45e525aa1b8e4c495704104d4121291.camel@HIDDEN>
Date: Sat, 30 Apr 2022 16:15:33 +0200
In-Reply-To: <2e5292c2d45e525aa1b8e4c495704104d4121291.camel@HIDDEN>
 (Liliana Marie Prikler's message of "Sat, 23 Apr 2022 15:11:50 +0200")
Message-ID: <8735hu64je.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 55080
Cc: 55080 <at> debbugs.gnu.org
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,

Liliana Marie Prikler <liliana.prikler@HIDDEN> skribis:

> * gnu/packages/services.scm (%service-file-logger): New variable,
> implementing...
> (service-file-logger): ... the old behaviour of this variable.  Catch sys=
tem
> errors from %service-file-logger and handle them.

[...]

> +(define (service-file-logger file input)
> +  "Return a thunk meant to run as a fiber that reads from INPUT and logs=
 it to
> +FILE."
> +  (catch 'system-error
> +    (lambda ()
> +      (%service-file-logger file input))
> +    (lambda args
> +      (if (=3D ENOENT (system-error-errno args))
> +          (begin
> +            (mkdir-p (dirname file))
> +            (%service-file-logger file input))
> +          (apply throw args)))))

I wonder to what extent automatically creating log directories is a good
idea.  A potential drawback is if shepherd creates them with unexpected
ownership or permissions.

Did you encounter this issue while working on services?

Am I right that the Shepherd 0.8 had the same problem?

Thanks,
Ludo=E2=80=99.




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

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


Received: (at submit) by debbugs.gnu.org; 23 Apr 2022 13:17:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 23 09:17:33 2022
Received: from localhost ([127.0.0.1]:55462 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1niFdk-0006IO-KP
	for submit <at> debbugs.gnu.org; Sat, 23 Apr 2022 09:17:32 -0400
Received: from lists.gnu.org ([209.51.188.17]:53812)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <liliana.prikler@HIDDEN>) id 1niFdi-0006HN-Rx
 for submit <at> debbugs.gnu.org; Sat, 23 Apr 2022 09:17:31 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:46586)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <liliana.prikler@HIDDEN>)
 id 1niFdi-0004z1-7x
 for guix-patches@HIDDEN; Sat, 23 Apr 2022 09:17:30 -0400
Received: from mail-ed1-x542.google.com ([2a00:1450:4864:20::542]:33336)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <liliana.prikler@HIDDEN>)
 id 1niFdg-0000ea-Bz; Sat, 23 Apr 2022 09:17:29 -0400
Received: by mail-ed1-x542.google.com with SMTP id e30so9964941eda.0;
 Sat, 23 Apr 2022 06:17:26 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:date:subject:to:cc:content-transfer-encoding:message-id
 :mime-version; bh=LzLJ6HhTZdQMiXZb0LVHUWGq6v6jGE0mOLNURaveW/c=;
 b=lkcyrcoAZJzIL2LnHAPLzqjnA5jgon2YgEy520ma128SXTs5rMqLrhws30cTOKltv0
 EEueM0KcmFdtvQev+KZsGctRpepgetkcOqOHYK/kl8UxUIgdgnl5Ud7+lzkkU7FLL9GK
 G09HJrNSApWgy+amy1ltJ2AkZ5aM0r8vyazWDUoV/3knwVGB/Cb03jyXGs6EHuAtIRon
 cZzNtv1uspuDXXAbqBvp9I3hsVagTghaYmI4VGeCawUCetbaWcaU8y4K0P2vdhKGH8eA
 2+coEAJBTZmccLeL2Nozod9OU5rY0YsVXVCFUllq2jcnhtwXlbCvAtsBBzU2H3rMO4Gk
 QxxA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:date:subject:to:cc
 :content-transfer-encoding:message-id:mime-version;
 bh=LzLJ6HhTZdQMiXZb0LVHUWGq6v6jGE0mOLNURaveW/c=;
 b=J/xY9UVLX0DqZ9spplF31hEdegUqyB306Snr+Cq2h2CbAk3RcTmuF9UwK5Cgj/y8r6
 sv4iieuos95sHNdtXHVSZMo4pM1GOgRPkpBibuAi60JBivaDOZUYLFy3DV41oRCQW1Tc
 ee8nmbv/Fk9/m9jmJUQOC3jgnTXx0TqHctGRCZZ1dtbCNMy4/RvjtDou8FRSpGUwyZfF
 cVFXW9hm/fPX/ezJrv4gK1SrISLr7HpvJENOieGbkcrGUNm9aKFqKlSsdlDXXv4TifC8
 0iiZ5c0+BOwWGH0Ttc3cMhrK1cqQMcZppHXC3xClkibIwfmkm+Q3peeg7gTJrbHbxw3/
 B+aw==
X-Gm-Message-State: AOAM530S97TqeyibpBtiArv7Vw4OdWPnnS/MtnDp280UgClE86lIfEpI
 1/wGsU6p9I9eOdhi8PUHZc5yM4PmyEE=
X-Google-Smtp-Source: ABdhPJxcOEDoCWbau2L6N86ZiUSRcMdsQj19YI430iE10gDj59WANsnEl8MEJhKseh0dixheUY5ZKQ==
X-Received: by 2002:a05:6402:b57:b0:41d:6d9b:7e0d with SMTP id
 bx23-20020a0564020b5700b0041d6d9b7e0dmr10020860edb.78.1650719844739; 
 Sat, 23 Apr 2022 06:17:24 -0700 (PDT)
Received: from nijino.fritz.box (85-127-52-93.dsl.dynamic.surfer.at.
 [85.127.52.93]) by smtp.gmail.com with ESMTPSA id
 h22-20020a056402281600b004206bd9d0c6sm2287355ede.8.2022.04.23.06.17.23
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 23 Apr 2022 06:17:24 -0700 (PDT)
From: Liliana Marie Prikler <liliana.prikler@HIDDEN>
Date: Sat, 23 Apr 2022 15:11:50 +0200
Subject: [PATCH shepherd] service: Gracefully handle non-existing log
 directories.
to: guix-patches@HIDDEN
Content-Transfer-Encoding: 7bit
Message-ID: <2e5292c2d45e525aa1b8e4c495704104d4121291.camel@HIDDEN>
MIME-Version: 1.0
Received-SPF: pass client-ip=2a00:1450:4864:20::542;
 envelope-from=liliana.prikler@HIDDEN; helo=mail-ed1-x542.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: ludo@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: -2.3 (--)

* gnu/packages/services.scm (%service-file-logger): New variable,
implementing...
(service-file-logger): ... the old behaviour of this variable.  Catch system
errors from %service-file-logger and handle them.
---
 modules/shepherd/service.scm | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 013347b..567a08b 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -873,9 +873,9 @@ daemon writing FILE is running in a separate PID namespace."
               (try-again)
               (apply throw args)))))))
 
-(define (service-file-logger file input)
-  "Return a thunk meant to run as a fiber that reads from INPUT and logs it to
-FILE."
+(define (%service-file-logger file input)
+  "Like 'service-file-logger', but doesn't handle the case in which FILE does
+not exist."
   (let* ((fd     (open-fdes file (logior O_CREAT O_WRONLY O_APPEND) #o640))
          (output (fdopen fd "al")))
     (set-port-encoding! output "UTF-8")
@@ -894,6 +894,19 @@ FILE."
                  (format output "~a~a~%" prefix line)
                  (loop))))))))))
 
+(define (service-file-logger file input)
+  "Return a thunk meant to run as a fiber that reads from INPUT and logs it to
+FILE."
+  (catch 'system-error
+    (lambda ()
+      (%service-file-logger file input))
+    (lambda args
+      (if (= ENOENT (system-error-errno args))
+          (begin
+            (mkdir-p (dirname file))
+            (%service-file-logger file input))
+          (apply throw args)))))
+
 (define (service-builtin-logger command input)
   "Return a thunk meant to run as a fiber that reads from INPUT and logs to
 'log-output-port'."
-- 
2.35.1





Acknowledgement sent to Liliana Marie Prikler <liliana.prikler@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#55080; 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: Sat, 30 Apr 2022 14:30:01 UTC

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