From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id MEOLBkZk4GXMWAAAqHPOHw:P1 (envelope-from ) for ; Thu, 29 Feb 2024 12:02:30 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id MEOLBkZk4GXMWAAAqHPOHw (envelope-from ) for ; Thu, 29 Feb 2024 12:02:30 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=disroot.org header.s=mail header.b=JKgE3Guq; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1709204550; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: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=8yrosJOQof49QF9x451d98TSL/D4fMsO1p3ITRH7ew4=; b=vBGbhvx3oATisCrgB2qRGEf9OBCYqkx7LOUpBsNekFRFIDPmv4DC3cqereiikfZZ61g+pl lBBdy5l9p8YeBLayuaP5i/HyRmgVE/c74y0ZYN1kCFbne5pJTKSr1+Y1DknfFDAG333CQw 4C9xLzfvzPnB42WAjZYD5rA9/xK+oXxL40btGCBz58YLWYe0+KIf9EUvt34Darh0zDiNck qGQct8okyZNuv8G2LaeowBzL0ndo3241J99P+oKNH8f8Eq8r4BJz4cqs9doWNL9wTWYeXH khKallLCG/7LrKELjPvCDSfkDjRwVB0RL2T7jiBjwHZol+4O/y9e42GH0OOSWg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=disroot.org header.s=mail header.b=JKgE3Guq; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1709204550; a=rsa-sha256; cv=none; b=m1v0BqNk6FPZTEOm4qcvjW84k37v7bsuVl2sbIXMc5w3CQxzjgilsiuqKtErtC6oyTF/CH zNiO7PSfX/KJSFhGiq9/yfVLjHIOJsGdjH/Z/KTgEc93nEecOmQ192Mvp3FzE3wZ4CuPAG jWrBkKxMAI9z11f61KE/x4N2R5HYIXi4L6M1YjKNEjy4eMl4Cp7+IEB0n8WUe+qnuhuJzd 7nQvpTOEymseESmHehlOFS+wgrJ2V5oMwTYrGonVo7uOx0NcTUjldvAng0tY11tOoV+EQy 8/muBBA2U/PnyphAdrwyODyyAmaEEm/yPMgk+RG0Zu+k+OG27cOiBfhn8QR4zQ== 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 634D56CC7E for ; Thu, 29 Feb 2024 12:02:29 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rfdEx-0006p0-Pz; Thu, 29 Feb 2024 05:02:11 -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 1rfLnb-0006tR-6V for bug-guix@gnu.org; Wed, 28 Feb 2024 10:24:48 -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 1rfLnS-00066o-B3 for bug-guix@gnu.org; Wed, 28 Feb 2024 10:24:46 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rfLns-00070r-S2 for bug-guix@gnu.org; Wed, 28 Feb 2024 10:25:04 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#65471: home mcron service overwrites PATH with a GuixSD-only directory References: <509099431.327298.1692786160360@office.mailbox.org> In-Reply-To: <509099431.327298.1692786160360@office.mailbox.org> Resent-From: Gary Johnson Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 28 Feb 2024 15:25:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65471 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 65471@debbugs.gnu.org Received: via spool by 65471-submit@debbugs.gnu.org id=B65471.170913387626825 (code B ref 65471); Wed, 28 Feb 2024 15:25:04 +0000 Received: (at 65471) by debbugs.gnu.org; 28 Feb 2024 15:24:36 +0000 Received: from localhost ([127.0.0.1]:48535 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rfLnN-0006yR-VZ for submit@debbugs.gnu.org; Wed, 28 Feb 2024 10:24:35 -0500 Received: from layka.disroot.org ([178.21.23.139]:47102) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rfL8O-0004Xf-2n for 65471@debbugs.gnu.org; Wed, 28 Feb 2024 09:42:14 -0500 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id B28EC419D5 for <65471@debbugs.gnu.org>; Wed, 28 Feb 2024 15:41:43 +0100 (CET) X-Virus-Scanned: SPAM Filter at disroot.org Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QfLQ9DGRGaDw for <65471@debbugs.gnu.org>; Wed, 28 Feb 2024 15:41:42 +0100 (CET) Date: Wed, 28 Feb 2024 08:04:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1709131302; bh=UF5cdzJkkgvIkxgHECK63E8t+Hu8vkYR2Ginf9u+1x4=; h=Date:From:To:Subject; b=JKgE3Guq2SMAnkezGb9gw13QinPYX4lrhkkYwY4oKYefkXjN8TGVbz2c23q3AnCaq WJmT/Rh0cqoF8SUYAXkwbHrRIpOgYyPjCq6jxDUifsEdzc2qoq8MTVNLjX1pHfKTmX gjgNuOd9kPiklKi0gsxU15gOZsA6RJQdsvdbXkjnDuhK6fhpr2gxH9mJVWsHutx6ve wQNnvgmXIKNijginxXadlNueU10IHEzgdUlMn3jmeTb6n8II+PLkaJcaS2vP+tTXC3 3Aqzf9w40dXHXqA5Ve/4sDxUOp721tahuRcAYId0Q0pOfeESuFYsIjPAZ9m04GVId9 XxbGZCpVDdL7g== Message-ID: <87r0gwps6b.fsf@disroot.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailman-Approved-At: Wed, 28 Feb 2024 10:24:27 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Thu, 29 Feb 2024 05:02:09 -0500 X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Gary Johnson From: Gary Johnson via Bug reports for GNU Guix Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -4.91 X-Spam-Score: -4.91 X-Migadu-Queue-Id: 634D56CC7E X-TUID: ClBprRo1L+Ao Hi Guix, The bug in which home-mcron-service-type overwrites the user's PATH with a = single non-existent directory makes mcron completely unusable on foreign di= stros. Since it seems to me that foreign distros are the main target for ho= me mcron services (since there is no global shepherd to run mcron for you),= this really should be elevated to a high priority bug. I see that earlier in this message thread questions were raised as to what = the proper behavior should be for setting the PATH, but I think we can say = with no reservations that setting PATH to a directory that is guaranteed no= t to exist on a foreign distro is definitely not the correct choice. Also, = setting it explicitly to directories not managed by Guix profiles or Guix H= ome like /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin,= and so on also isn't a great idea since users of the home-cron-service-typ= e are obviously using it through Guix Home. The correct choice IMHO is to f= ollow the principle of least surprise here. Namely, in the Guix info pages at "(guix)Top > Home Configuration > Home Se= rvices > Mcron Home Service", we have section "13.3.3 Scheduled User=E2=80= =99s Job Execution". Under home-mcron-configuration, we see the "jobs" fiel= d, which links us to "mcron job specifications(mcron)" for explanations of = how to define our mcron jobs. Following this link on to "(mcron)Top > Syntax > Guile Syntax", we encounte= r section "3.1.1 Job specification". The final paragraph in this section re= ads as follows: > The second argument to the 'job' function can be either a string, a list,= or a function. The command is executed in the home directory and with the = UID of USER. If a string is passed, it is assumed to be shell script and is= executed with the user's default shell. If a list is passed it is assumed = to be Scheme code and is _eval_'d as such. A supplied function should take = exactly zero arguments, and will be called at the pertinent times. Note the third sentence: "If a string is passed, it is assumed to be shell script and is executed wi= th the user's default shell." Reading that, I (and I imagine most mcron users) will infer that the enviro= nment my job command will run in will be the same as what I would get if I = spawned a new non-interactive shell. That is, the new mcron job shell shoul= d inherit all the environment variables that were defined when the user's s= heperd process was launched (which will be everything loaded into a standar= d login shell, such as /etc/profile, ~/.bash_profile, and everything that t= hey source like Guix Home's ~/.profile) plus a fresh run of ~/.bashrc (or t= he equivalent non-interactive shell config file for whatever shell the user= has chosen). It seems to me that this is what most people reading the manu= al are going to understand (and therefore expect) and that it is the most c= ompatible with Guix Home since all environment variables set in the `home-e= nvironment` will be available to our mcron jobs. However, with the current behavior, it appears that the shell spawned for t= he user mcron job actually reads /etc/profile and ~/.profile (but not ~/.ba= sh_profile or ~/.bashrc). The ~/.profile file sources ~/.guix-home/setup-en= vironment and then runs ~/.guix-home/on-first-login. While being very confu= sing and unintuitive (because my default shell is /bin/bash and is reported= correctly within the mcron job environment as "SHELL=3D/bin/bash"), this a= t least loads ~/.guix-home/profile/etc/profile and ~/.guix-profile/etc/prof= ile. However, since mcron then promptly erases the correctly built up PATH = from Guix Home and the user's main Guix profile, the commands executed in t= his PATH-less shell are borked. As others in this thread have previously noted, with the current behavior o= f providing an unintuitive and completely unusable PATH to user mcron jobs,= the home-mcron-service-type is largely unusable except for the simplest co= mmands in which you can use ungexp package directory expansion to build up = the locations of a Guix-installed executable. However, if any job command e= ver needs to shell out to any other executable, it will not be found, and t= he job will crash and burn. Please fix this, folks. And if you aren't willing to implement the intuitiv= e, documented, and Guix Home compatible shell behavior described above, ple= ase at the very least extend the "job" function with a keyword to allow us = to pass environment variables into the mcron job shell along with something= like the "(default-environment-variables)" function that is available for = shepherd service "start" functions. Thanks! Gary --=20 GPG Key ID: C4FBEDBD Use `gpg --search-keys tracker@disroot.org' to find me Protect yourself from surveillance: https://emailselfdefense.fsf.org =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments Why is HTML email a security nightmare? See https://useplaintext.email/ Please avoid sending me MS-Office attachments. See http://www.gnu.org/philosophy/no-word-attachments.html