From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.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 SJrcMel/U2W8bwAAG6o9tA:P1 (envelope-from ) for ; Tue, 14 Nov 2023 15:10:50 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id SJrcMel/U2W8bwAAG6o9tA (envelope-from ) for ; Tue, 14 Nov 2023 15:10:49 +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 7EFD3354CE for ; Tue, 14 Nov 2023 15:10:49 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=TWvlOFPI; 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=1699971049; 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: 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=8UUzoZ8WYkWViLnVfuRZp0DdKyxtHcDjT7hKIVtIjT0=; b=d64YOp+BFhN787uNdD8Ht554OT+hnUU5XrFpPhUut49BVR6kUA0wYpCeQDwPDxV0VYXecw WmstE26reiEyP3Bmf7tnWecOFvrEbJF+jmmVud5Jp0NLa2CcfcwpUARRP9IzHFvNVF+lVZ 8txWZsxGVty286XJwbwC26M2VdEWCw+zDEv+e4UkGlU451jPTCme/GPJ7evfjAO/QT7xHW PJdO+paAkGoag5gzCCwO3AbF+JUDqTsRBSzOI8LoytfgJP0mSSMxfkPDbXkNEV8eV4AEcR /1gTLW5MViqHivy7QNblUmqC+suuPV0HKpHd3ox31djzkV2b4gRuxtNx90XDLA== 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=TWvlOFPI; 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=1699971049; a=rsa-sha256; cv=none; b=gjo7vOMw6TBiRF6diSzQuTRC6MfkPOLucCFHNKnUA0NjVE8Z1USVsIbz84SF6rBtDwvIkk UDKQ684Q5JoGvVwvRQzq3BobnKEvYB56azTPfv3kWXBOzjpSGC/nD+wsJLDNrZckDMkLkQ 11SAPFjvbgg4qzsRRIA/9dfxHIdm5c7nsRlQMefwJ7lGWBO4rpBeJrkTrmX/dkJEzm42r2 fTsQeqEncut1mS6fHRQUQ8Tw6/UUiT6knCmbd27Htc8NQ1OALD4OvPs5x4iRQ71uWKzM1E cdrCWx+CQw3yCq5lfVSFSOZnTOqxLIUQqrBRJ9mo7YM63C/XydBDNVnOObqjLQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2u7d-00009r-QP; Tue, 14 Nov 2023 09:10:33 -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 1r2u7U-0008WM-SG for guix-patches@gnu.org; Tue, 14 Nov 2023 09:10: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 1r2u7S-00029H-RX for guix-patches@gnu.org; Tue, 14 Nov 2023 09:10:24 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r2u88-0005ds-Ux for guix-patches@gnu.org; Tue, 14 Nov 2023 09:11:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67175] [PATCH 9/9] shepherd: Remove =?UTF-8?Q?=E2=80=98make-forkexec-constructor/container=E2=80=99.?= Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 14 Nov 2023 14:11:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67175 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67175@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 67175-submit@debbugs.gnu.org id=B67175.169997105021603 (code B ref 67175); Tue, 14 Nov 2023 14:11:04 +0000 Received: (at 67175) by debbugs.gnu.org; 14 Nov 2023 14:10:50 +0000 Received: from localhost ([127.0.0.1]:60601 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2u7u-0005cH-74 for submit@debbugs.gnu.org; Tue, 14 Nov 2023 09:10:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60984) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2u7n-0005aa-Fb for 67175@debbugs.gnu.org; Tue, 14 Nov 2023 09:10:44 -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 1r2u72-0001tD-0x; Tue, 14 Nov 2023 09:09:56 -0500 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=8UUzoZ8WYkWViLnVfuRZp0DdKyxtHcDjT7hKIVtIjT0=; b=TWvlOFPIARVAQmovpMsQ eoswQvflA3wIMKhdbc77S0O6R6W9DEOD3vOlsppTsnHzsZ7XijlgDkKu6HHCfjrPAWPnL+KMgMCwK 2QLhus7GTfWfe7NhQBXowqQ2HcXo/DBCpmwzP5DJ8wZ3SRboXY9VU0ohSDysIPXQXD1ZjakjwPSOx uDxMo6bOdclSNmN9LFDk2foY1G3054GO9uDmhP7CE79sEdI09QzDeu96d83GKyXMyZNmnNhHwYK1C 2FniOdnWco19w9LaJzVjh01LEbFIQrZwVPIoripTE87DjE2l8HXmKupaWwTcR2enPags9JTTf5DpB 1TQDWpBEwunARg==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Tue, 14 Nov 2023 15:09:18 +0100 Message-ID: <814e03ee68566de3912c5962a43e2241b1775b52.1699970930.git.ludo@gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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-Spam-Score: -5.79 X-Spam-Score: -5.79 X-Migadu-Queue-Id: 7EFD3354CE X-Migadu-Scanner: mx10.migadu.com X-TUID: bE4CQSHZ2cvR This was superseded by ‘least-authority-wrapper’. * gnu/build/shepherd.scm (read-pid-file/container) (make-forkexec-constructor/container): Remove. Change-Id: I6acccdff2609a35807608f865a4d381146113a88 --- gnu/build/shepherd.scm | 90 ------------------------------------------ 1 file changed, 90 deletions(-) diff --git a/gnu/build/shepherd.scm b/gnu/build/shepherd.scm index 9d9bfcfbc0..4ead27be0b 100644 --- a/gnu/build/shepherd.scm +++ b/gnu/build/shepherd.scm @@ -33,7 +33,6 @@ (define-module (gnu build shepherd) %precious-signals) #:autoload (shepherd system) (unblock-signals) #:export (default-mounts - make-forkexec-constructor/container fork+exec-command/container)) ;;; Commentary: @@ -101,27 +100,6 @@ (define* (default-mounts #:key (namespaces (default-namespaces '()))) (file-exists? (file-system-mapping-source mapping))) mappings))))) -(define* (read-pid-file/container pid pid-file #:key (max-delay 5)) - "Read PID-FILE in the container namespaces of PID, which exists in a -separate mount and PID name space. Return the \"outer\" PID. " - (match (container-excursion* pid - (lambda () - ;; XXX: Trick for Shepherd 0.9: prevent 'read-pid-file' from - ;; using (@ (fibers) sleep), which would try to suspend the - ;; current task, which doesn't work in this extra process. - (with-continuation-barrier - (lambda () - (read-pid-file pid-file - #:max-delay max-delay))))) - (#f - ;; Send SIGTERM to the whole process group. - (catch-system-error (kill (- pid) SIGTERM)) - #f) - ((? integer? container-pid) - ;; XXX: When COMMAND is started in a separate PID namespace, its - ;; PID is always 1, but that's not what Shepherd needs to know. - pid))) - (define* (exec-command* command #:key user group log-file pid-file (supplementary-groups '()) (directory "/") (environment-variables (environ))) @@ -144,74 +122,6 @@ (define* (exec-command* command #:key user group log-file pid-file #:directory directory #:environment-variables environment-variables)) -(define* (make-forkexec-constructor/container command - #:key - (namespaces - (default-namespaces args)) - (mappings '()) - (user #f) - (group #f) - (supplementary-groups '()) - (log-file #f) - pid-file - (pid-file-timeout 5) - (directory "/") - (environment-variables - (environ)) - #:rest args) - "This is a variant of 'make-forkexec-constructor' that starts COMMAND in -NAMESPACES, a list of Linux namespaces such as '(mnt ipc). MAPPINGS is the -list of to make in the case of a separate mount -namespace, in addition to essential bind-mounts such /proc." - (define container-directory - (match command - ((program _ ...) - (string-append "/var/run/containers/" (basename program))))) - - (define auto-mappings - `(,@(if log-file - (list (file-system-mapping - (source log-file) - (target source) - (writable? #t))) - '()))) - - (define mounts - (append (map file-system-mapping->bind-mount - (append auto-mappings mappings)) - (default-mounts #:namespaces namespaces))) - - (lambda args - (mkdir-p container-directory) - - (when log-file - ;; Create LOG-FILE so we can map it in the container. - (unless (file-exists? log-file) - (close (open log-file (logior O_CREAT O_APPEND O_CLOEXEC) #o640)) - (when user - (let ((pw (getpwnam user))) - (chown log-file (passwd:uid pw) (passwd:gid pw)))))) - - (let ((pid (run-container container-directory - mounts namespaces 1 - (lambda () - (exec-command* command - #:user user - #:group group - #:supplementary-groups - supplementary-groups - #:pid-file pid-file - #:log-file log-file - #:directory directory - #:environment-variables - environment-variables))))) - (if pid-file - (if (or (memq 'mnt namespaces) (memq 'pid namespaces)) - (read-pid-file/container pid pid-file - #:max-delay pid-file-timeout) - (read-pid-file pid-file #:max-delay pid-file-timeout)) - pid)))) - (define* (fork+exec-command/container command #:key pid #:allow-other-keys -- 2.41.0