From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id KKFnFRHNJGdHsQAAqHPOHw:P1 (envelope-from ) for ; Fri, 01 Nov 2024 12:44:01 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id KKFnFRHNJGdHsQAAqHPOHw (envelope-from ) for ; Fri, 01 Nov 2024 13:44:01 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=QM00qrOV; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=XFIdxqo0; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); 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=1730465041; a=rsa-sha256; cv=none; b=PmhouKH8/k4EOUx67C7RBiYmn30axbVSdCxUAUWGH/D/xuS0NIYuGjK19Fzs5MwjNl5l2B yUgw7jsfMusdNh0mlfSfe+yf8SOXiaYDr1nKh7t8FLxKFGosUZoBUKoIRgXd1T1jfAN7xD 1GrE5cZhKlrTUktXUt2fqqequmq4y5W9p+o7H1eiOqvPfuS40GUkW+jX/NRYjCeoZIjd/N VHjpPJ4z03l3Y4UrIk/F0FSgyW3TgW+MrT8V/0Mpy8Rt6CeJsnUy9iHE32mgvUG0ZZPtiC Yl4pBNKV1wsaAi4ddiqerL8Rj+vfttCjgdb5lh2SZa+56JQ3wgvfPNd91Llz4Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=QM00qrOV; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=XFIdxqo0; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); 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=1730465041; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: 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=KGe8VyZN2Ra66xrmhWqWpZAX95htDF0u7v2gQpwIFQo=; b=bOebMev9zQ6pXnLBfxgO1T0nXwW8ttVlI/DLXn/ufrnqsSPNTZRv+699VUHbumbXmlJpPj z5HqA29ETUsaeYwbH+BnZCCvcBKgvtf12AvprTyjZIg9tVsnDqQChD1M/iUV0o6ubEsBY/ +V739Qk1G4nRzhfOPIHlgtsDOuQOQgtiGg8Lf+0zRn24s24k0mp/lhZBdY0iZWrsLHoa3f +Z0WfP/TSSKgKALPig0HArtBESqUuSkGYkVZsW9wxZ5c+tHYGjBgo89tfmH+NfK42iMoDe tRNbgLGVS3PU6pMsMjSmht6vyWk8W842n5oxBdnupIUojZPBH+MpfnlSR3FA9w== 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 18C4218593 for ; Fri, 01 Nov 2024 13:44:00 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6qzd-0007hI-RU; Fri, 01 Nov 2024 08:43:09 -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 ) id 1t6qzc-0007h0-FU for guix-patches@gnu.org; Fri, 01 Nov 2024 08:43:08 -0400 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 1t6qzc-0000SG-6l for guix-patches@gnu.org; Fri, 01 Nov 2024 08:43:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=KGe8VyZN2Ra66xrmhWqWpZAX95htDF0u7v2gQpwIFQo=; b=QM00qrOVlfRFC1eqNDBtAPtk2qgpxH8n1DzrLc+a5TBE6R6fy+HrCATotPjI4rRLJ+6FQPmUmvayO5w55QldKR1zjRMjl+1cFinQF/Tpek/UwQzsGUs/BTcQqRZuWF7o2wZw9l0Z/3LS2YprfG5zzi39YAuKaFuyPfCnxH3zb+YVf0Mmi7vxsCwG/Kfvn/ZnZUUhspCgVuD+PmOvsGipCca3UCyTFM+GaXhNhZl4dEiSAUhz+foV9Y+7CS3jh9SdbgIKADPgalt1cxmfxDoix9Z7klXdjS5XdK9SakayycdxOMeo9xeo0EKTfDorr0i/JHLh8W2EeCx4wTAYBTJGBw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t6qzc-0007wE-1G; Fri, 01 Nov 2024 08:43:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#74151] [PATCH v2 9/9] services: web: Fix race between nginx activation and anonip. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Fri, 01 Nov 2024 12:43:07 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74151 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74151@debbugs.gnu.org Cc: Maxim Cournoyer , Maxim Cournoyer X-Debbugs-Original-Xcc: Maxim Cournoyer Received: via spool by 74151-submit@debbugs.gnu.org id=B74151.173046495930434 (code B ref 74151); Fri, 01 Nov 2024 12:43:07 +0000 Received: (at 74151) by debbugs.gnu.org; 1 Nov 2024 12:42:39 +0000 Received: from localhost ([127.0.0.1]:49231 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6qz8-0007un-Ib for submit@debbugs.gnu.org; Fri, 01 Nov 2024 08:42:39 -0400 Received: from mail-pf1-f178.google.com ([209.85.210.178]:50571) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6qz4-0007uG-9J for 74151@debbugs.gnu.org; Fri, 01 Nov 2024 08:42:35 -0400 Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-71e5a62031aso1510637b3a.1 for <74151@debbugs.gnu.org>; Fri, 01 Nov 2024 05:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730464888; x=1731069688; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KGe8VyZN2Ra66xrmhWqWpZAX95htDF0u7v2gQpwIFQo=; b=XFIdxqo0qSklID+PpydkkU7/5w9LYBmhoZYQ0oJWFaxN16VxANBPe49vDl0YU7YT3u HCsWa5KPY7Xj6h29QnLtYPC01fihyWXOvjtITi/Ujl4/f/Za/bYK2lx2QZ5UY1pUELjg b6iLmfMsVF3FIKt7f+dTOgP+lKT6tLivFJG1Jq0DBs0llqBKlJ3Ta8UvsM3pKYVGwkmt /hkJungIBczNfTKaYtPNge7hsUkcQgXXaI9htL//BHha12ct7xJq6JTyTtj/By0xxn4Y qaw90HK+4a/Rc3ER2avXU5ahaXcDLbPNLhQ3je0qCaHxVyGrqb5jIoPpvpxsdw34lH3i lcbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730464888; x=1731069688; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KGe8VyZN2Ra66xrmhWqWpZAX95htDF0u7v2gQpwIFQo=; b=TWn7U1oYgr2QwZEEduUB1W3WgkyJKIF2Jd0uGlqkWNzjqNd51CbbnUvDM5l3pFKgwI OaAL2REXS4Oi1S4VkOLOdi5QIWl2UGQT7wu4Ppw9hFYBv06xosijinT3N2ut/uebXkxS Mh7lJE4N6NnItmpdI78sZ+yZ/oKqkY2yHYeu5bIIviLowlpoj9kwVk9bMJIIUaQFhIny Kcu82yGqOMHVY3K8FGYkbBuDraThFL2mTCVcAIOlkJoxeuCaHR/lkg8cXOLD3sghCX8r Nmsmd1wsbzaXioC+hzbhe6YF0/70FROMDuVfiDAZ1B70p0Wq/itx23+vAV1QMG85JdzY fdVg== X-Gm-Message-State: AOJu0YzNZE83RA8oGtCkn6mzTvT96L5Zd8906Ld6/7eBlUW5E7HdIfnK fwNke0iEQfG0nRsVykM11mpIOdZwfLeTyB+RBnwDEcPXLQZkGbE0bsaHi9WI X-Google-Smtp-Source: AGHT+IF/jch5hLqJABLw+fRDEF6YIkJ4zKMWjTB7ItkhTzAFCjMrwBETi5z28485ygw4UnzrU4EdRA== X-Received: by 2002:a17:90b:1650:b0:2e2:b45f:53b4 with SMTP id 98e67ed59e1d1-2e94c50d447mr4565972a91.25.1730464887983; Fri, 01 Nov 2024 05:41:27 -0700 (PDT) Received: from localhost.localdomain ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e92fa0ea9bsm4819463a91.10.2024.11.01.05.41.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 05:41:27 -0700 (PDT) From: Maxim Cournoyer Date: Fri, 1 Nov 2024 21:39:29 +0900 Message-ID: <1d6c7e71f2a80a38f801965b7fd27f0b982016ec.1730464675.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <281a4773768a6c271ff464f473fdbc333a58c348.1730464675.git.maxim.cournoyer@gmail.com> References: <281a4773768a6c271ff464f473fdbc333a58c348.1730464675.git.maxim.cournoyer@gmail.com> MIME-Version: 1.0 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: -0.98 X-Spam-Score: -0.98 X-Migadu-Queue-Id: 18C4218593 X-Migadu-Scanner: mx12.migadu.com X-TUID: Yb3+HUqGXhvb * gnu/services/web.scm (anonip-shepherd-service): Recreate the input file when it's not a FIFO. Fixes: Change-Id: I8ba87f9fc48ecfd515e34bdee9e2949a2a559f9c --- New commit in v2 gnu/services/web.scm | 64 ++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/gnu/services/web.scm b/gnu/services/web.scm index cf3515bf70..4cf7c68997 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -1499,41 +1499,35 @@ (define (anonip-shepherd-service config) "Anonimyze the given log file location with anonip.") (start #~(lambda () - (define (spawn) - (fork+exec-command - (append - (list #$(file-append (anonip-configuration-anonip config) - "/bin/anonip") - (string-append "--input=" #$input) - (string-append "--output=" #$output)) - (if #$(anonip-configuration-debug? config) - '("--debug") (list)) - (if #$(anonip-configuration-skip-private? config) - '("--skip-private") (list)) - '#$(optional anonip-configuration-column "--column") - '#$(optional anonip-configuration-ipv4mask "--ipv4mask") - '#$(optional anonip-configuration-ipv6mask "--ipv6mask") - '#$(optional anonip-configuration-increment "--increment") - '#$(optional anonip-configuration-replacement "--replacement") - '#$(optional anonip-configuration-delimiter "--delimiter") - '#$(optional anonip-configuration-regex "--regex")) - ;; Run in a UTF-8 locale - #:environment-variables - (list (string-append "GUIX_LOCPATH=" - #$(libc-utf8-locales-for-target) - "/lib/locale") - "LC_ALL=en_US.utf8"))) - - (let ((stat (stat #$input #f))) - (cond ((not stat) - (mknod #$input 'fifo #o600 0) - (spawn)) - ((eq? 'fifo (stat:type stat)) - (spawn)) - (else - (format #t "'~a' is not a FIFO; bailing out~%" - #$input) - #f))))) + ;; Always attempt to recreate the named pipe, as activation scripts + ;; such as that of nginx may have created plain files in its place + ;; (see: https://issues.guix.gnu.org/59181). + (false-if-exception (delete-file #$input)) + (mknod #$input 'fifo #o600 0) + + (fork+exec-command + (append + (list #$(file-append (anonip-configuration-anonip config) + "/bin/anonip") + (string-append "--input=" #$input) + (string-append "--output=" #$output)) + (if #$(anonip-configuration-debug? config) + '("--debug") (list)) + (if #$(anonip-configuration-skip-private? config) + '("--skip-private") (list)) + '#$(optional anonip-configuration-column "--column") + '#$(optional anonip-configuration-ipv4mask "--ipv4mask") + '#$(optional anonip-configuration-ipv6mask "--ipv6mask") + '#$(optional anonip-configuration-increment "--increment") + '#$(optional anonip-configuration-replacement "--replacement") + '#$(optional anonip-configuration-delimiter "--delimiter") + '#$(optional anonip-configuration-regex "--regex")) + ;; Run in a UTF-8 locale + #:environment-variables + (list (string-append "GUIX_LOCPATH=" + #$(libc-utf8-locales-for-target) + "/lib/locale") + "LC_ALL=en_US.utf8")))) (stop #~(make-kill-destructor)))))) (define anonip-service-type -- 2.46.0