From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id AMSWJ2Y+YF+oeQAA0tVLHw (envelope-from ) for ; Tue, 15 Sep 2020 04:09:10 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id +Er/IWY+YF/SNgAAB5/wlQ (envelope-from ) for ; Tue, 15 Sep 2020 04:09:10 +0000 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 1CB6B94036A for ; Tue, 15 Sep 2020 04:09:10 +0000 (UTC) Received: from localhost ([::1]:60052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kI2HF-0004Go-45 for larch@yhetil.org; Tue, 15 Sep 2020 00:09:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57750) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kI2H8-0004GR-Dc for bug-guix@gnu.org; Tue, 15 Sep 2020 00:09:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:45302) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kI2H8-0005Ju-0o for bug-guix@gnu.org; Tue, 15 Sep 2020 00:09:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kI2H7-0003g9-Sp for bug-guix@gnu.org; Tue, 15 Sep 2020 00:09:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#43366: [PATCH core-updates] utils: Do not raise exceptions in delete-file-recursively. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 15 Sep 2020 04:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43366 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 43366@debbugs.gnu.org Received: via spool by 43366-submit@debbugs.gnu.org id=B43366.160014292314107 (code B ref 43366); Tue, 15 Sep 2020 04:09:01 +0000 Received: (at 43366) by debbugs.gnu.org; 15 Sep 2020 04:08:43 +0000 Received: from localhost ([127.0.0.1]:56848 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kI2Go-0003fT-RV for submit@debbugs.gnu.org; Tue, 15 Sep 2020 00:08:43 -0400 Received: from mail-qt1-f173.google.com ([209.85.160.173]:45607) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kI2Gl-0003f8-CC for 43366@debbugs.gnu.org; Tue, 15 Sep 2020 00:08:41 -0400 Received: by mail-qt1-f173.google.com with SMTP id z2so2170112qtv.12 for <43366@debbugs.gnu.org>; Mon, 14 Sep 2020 21:08:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8JdylyF98Lg7KQ3ylzub6SzwqwHqEbHWfnkultfTlnY=; b=ACLefPaEzeF9P/3Dxdt9+06edLV+kMTLiSM89K+Ibf3kyOHONMFNswtUdp4ZMExReK IhHV1ZCUC6/WGqpuo5UMzVkv9eL2JYZWVQHGHnp63tv/0OxC0lm+ORF/OTJiHyE4wH8z TE6extpSOCMltNPK9V3mbENIOZ+xkKwFSsANXAxC/ivgJQStcGC0sV5oycn/ZrjppwJT NyEAlsie6oXOKyB7QBSHg5Z7NVfxZoVbrtnbLi4S05LsuReRrX3dsLzfFU1tRTd8qcgA nAN6Sc2B36dnfdeDhuWvB4Ju4Ib/SOi0BntlbORMh4sTQvK5FVi3xeYs3OohGqtOIqsR +axQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8JdylyF98Lg7KQ3ylzub6SzwqwHqEbHWfnkultfTlnY=; b=rQa36mYHlKGGDMWIWRwwOzx46rh4GwLO7+ysCLvyRNgcVHaoCfMx+EWS5AQzB3Jak8 1tinF4Fv86DVKbbuI9j+lQJkY+zyDJgTg0jxMan0pV+ejJzXi7Kx3Ume0MtRtTA0VDXF 1bM7lmzYknljXLERP4E6gctAkOE1RT+6OdTbhVfNGr3zdgFm47LvRBRRFpbGVPKyyphf IjMpPdGiMhobvVDZ2wtXqVubsqutA0yliOpG0pe0j8IksPW6wJBhjkZHSbUKssaXuJXH hJrbkNvAqwuW04XlGJNzTtiAk4SEDSyfbmycdK/Py0dOGryDx0zBKRh/jchiTnCHWJJV HoPg== X-Gm-Message-State: AOAM533fM3zEIuIYe5TkxyFnsYukkqupAVplMFUM1eJwyV7zI2fLG0KS vJxM0o8PAOo7oyqQKXgJtuWfxoKS9xCiLw== X-Google-Smtp-Source: ABdhPJxNRxHLAYdmounLy/hy1Ztee1Ify67RJ8Ib6z6qfz4cZZ5BLgFlFMhTP1ebzySD0ZhYPA7RRw== X-Received: by 2002:ac8:2942:: with SMTP id z2mr16822759qtz.376.1600142913430; Mon, 14 Sep 2020 21:08:33 -0700 (PDT) Received: from localhost.localdomain (dsl-205-233-124-4.b2b2c.ca. [205.233.124.4]) by smtp.gmail.com with ESMTPSA id 29sm15964073qkr.114.2020.09.14.21.08.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2020 21:08:33 -0700 (PDT) From: Maxim Cournoyer Date: Tue, 15 Sep 2020 00:08:37 -0400 Message-Id: <20200915040837.26098-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <87v9gi5ou8.fsf@posteo.net> References: <87v9gi5ou8.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=yes Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fredrik Salomonsson , Maxim Cournoyer Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=ACLefPaE; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: 5Ej08o5RTTeY This makes it so that delete-file-recursively honors its docstring, which says it should "report but ignore errors". Fixes . * guix/build/utils.scm (warn-on-error): New syntax. (delete-file-recursively): Use it to catch exceptions and print warning messages. Reported-by: Fredrik Salomonsson --- guix/build/utils.scm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 0a04032834..fbf4f2d61a 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2018 Arun Isaac ;;; Copyright © 2018, 2019 Ricardo Wurmus ;;; Copyright © 2020 Efraim Flashner +;;; Copyright © 2020 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -366,6 +367,16 @@ verbose output to the LOG port." stat lstat))) +(define-syntax-rule (warn-on-error expr file) + (catch 'system-error + (lambda () + expr) + (lambda args + (format (current-error-port) + "warning: failed to delete ~a: ~a~%" + file (strerror + (system-error-errno args)))))) + (define* (delete-file-recursively dir #:key follow-mounts?) "Delete DIR recursively, like `rm -rf', without following symlinks. Don't @@ -376,10 +387,10 @@ errors." (or follow-mounts? (= dev (stat:dev stat)))) (lambda (file stat result) ; leaf - (delete-file file)) + (warn-on-error (delete-file file) file)) (const #t) ; down (lambda (dir stat result) ; up - (rmdir dir)) + (warn-on-error (rmdir dir) dir)) (const #t) ; skip (lambda (file stat errno result) (format (current-error-port) -- 2.28.0