From unknown Thu Jun 19 13:59:40 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#44889 <44889@debbugs.gnu.org> To: bug#44889 <44889@debbugs.gnu.org> Subject: Status: [PATCH] rm: do not skip extra files when removal of empty directories fails Reply-To: bug#44889 <44889@debbugs.gnu.org> Date: Thu, 19 Jun 2025 20:59:40 +0000 retitle 44889 [PATCH] rm: do not skip extra files when removal of empty dir= ectories fails reassign 44889 coreutils submitter 44889 Nick Alcock severity 44889 normal tag 44889 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 26 10:16:06 2020 Received: (at submit) by debbugs.gnu.org; 26 Nov 2020 15:16:07 +0000 Received: from localhost ([127.0.0.1]:42446 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kiJ06-0001dY-Rd for submit@debbugs.gnu.org; Thu, 26 Nov 2020 10:16:06 -0500 Received: from lists.gnu.org ([209.51.188.17]:53640) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kiIP2-0000Bv-19 for submit@debbugs.gnu.org; Thu, 26 Nov 2020 09:37:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35270) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kiIP0-0005kP-QB for bug-coreutils@gnu.org; Thu, 26 Nov 2020 09:37:43 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:38564) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kiIOu-0002Zp-MZ; Thu, 26 Nov 2020 09:37:42 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AQEYgm0072137; Thu, 26 Nov 2020 14:37:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=9n+g2KdAjtvR1m/8LjBzmr2VsvDDN73V9WSc0cd8udE=; b=f9+bP38/RpP0J0OSNvCAphxXv41bJjfGzOedesupFU3TmAYxGSOXYhIjHTdZexpNU8ip gQVVwCHFt4yQRhlpMeeELPlGwYgFG0moS4YQqW750UI7fke9dB4xiY2opt8vha5deohp RJqLHtvrjS7X8noNACWGR8NS7kHnzp5hq8JwnHx/HTTuEzO2N3Sp1pWw7DPJmof24wz5 UTSpTQhbqxiDNHgg5BVCuuAMFCn8qYaJMQIToESCLwqx6YajfvvB1hCkeY+qbLcy55ve b70TiZ3ZpI9sihzuSa+5v1YEaZoZ4a6oCkwPp2VBXDye9Fu4rRxumhz0t7WSwbyCMMiQ dQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 351kwheaqw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 26 Nov 2020 14:37:28 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AQEQ6bT113960; Thu, 26 Nov 2020 14:35:27 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 351n2kbfbw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Nov 2020 14:35:27 +0000 Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0AQEZQl9003060; Thu, 26 Nov 2020 14:35:26 GMT Received: from loom.srvr.nix (/81.187.191.129) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 26 Nov 2020 06:35:26 -0800 From: Nick Alcock To: bug-coreutils@gnu.org Subject: [PATCH] rm: do not skip extra files when removal of empty directories fails Date: Thu, 26 Nov 2020 14:35:17 +0000 Message-Id: <20201126143517.338855-1-nick.alcock@oracle.com> X-Mailer: git-send-email 2.29.0.249.g249b51256f MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9816 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 mlxlogscore=999 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011260088 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9816 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 impostorscore=0 suspectscore=0 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1011 priorityscore=1501 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011260088 Received-SPF: pass client-ip=141.146.126.79; envelope-from=nick.alcock@oracle.com; helo=aserp2130.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 26 Nov 2020 10:15:59 -0500 Cc: nishant.nayan@oracle.com, bert.barbe@oracle.com, elena.zannoni@oracle.com, jemarch@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) From: Nishant Nayan When removing a directory fails for some reason, and that directory is empty, the rm_fts code gets the return value of the excise call confused with the return value of its earlier call to prompt, causing fts_skip_tree to be called repeatedly and the next file that rm would otherwise have deleted to survive. [nca: added commit log, test] * src/remove.c (rm_fts): Only ever carry out one branch of the rm -i failure path for directories, never both (a user cannot both answer y and n to an rm -i prompt). * tests/rm/empty-immutable-skip.sh: New root-only test. * tests/local.mk: Add it. * NEWS: Mention the bug fix. --- NEWS | 3 +++ src/remove.c | 3 +-- tests/local.mk | 1 + tests/rm/empty-immutable-skip.sh | 46 ++++++++++++++++++++++++++++++++ 4 files changed, 51 insertions(+), 2 deletions(-) create mode 100755 tests/rm/empty-immutable-skip.sh diff --git a/NEWS b/NEWS index 61b5d42f6..ce40fc4ff 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,9 @@ GNU coreutils NEWS -*- outline -*- invalid combinations of case character classes. [bug introduced in coreutils-8.6] + rm no longer skips an extra file when the removal of an empty directory fails. + [introduced by the rewrite to make rm use fts in coreutils-8.0] + ** Changes in behavior cp and install now default to copy-on-write (COW) if available. diff --git a/src/remove.c b/src/remove.c index 2d40c55cd..1150cf179 100644 --- a/src/remove.c +++ b/src/remove.c @@ -508,8 +508,7 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x) s = excise (fts, ent, x, true); fts_skip_tree (fts, ent); } - - if (s != RM_OK) + else if (s != RM_OK) { mark_ancestor_dirs (ent); fts_skip_tree (fts, ent); diff --git a/tests/local.mk b/tests/local.mk index e1c4675c2..297760cc5 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -136,6 +136,7 @@ all_root_tests = \ tests/rm/no-give-up.sh \ tests/rm/one-file-system.sh \ tests/rm/read-only.sh \ + tests/rm/empty-immutable-skip.sh \ tests/tail-2/append-only.sh \ tests/tail-2/end-of-device.sh \ tests/touch/now-owned-by-other.sh diff --git a/tests/rm/empty-immutable-skip.sh b/tests/rm/empty-immutable-skip.sh new file mode 100755 index 000000000..e31417073 --- /dev/null +++ b/tests/rm/empty-immutable-skip.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# Ensure that rm does not skip extra files after hitting an empty immutable dir. +# Requires root access to do chattr +i, as well as an ext[23] or xfs file system + +# Copyright (C) 2006-2020 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src +print_ver_ tail +require_root_ + +# These simple one-file operations are expected to work even in the +# presence of this bug, and we need them to set up the rest of the test. +chattr_i_works=1 +touch f +chattr +i f 2>/dev/null || chattr_i_works=0 +rm f 2>/dev/null +test -f f || chattr_i_works=0 +chattr -i f 2>/dev/null || chattr_i_works=0 +rm f 2>/dev/null || chattr_i_works=0 +test -f f && chattr_i_works=0 + +if test $chattr_i_works = 0; then + skip_ "chattr +i doesn't work on this file system" +fi + +mkdir empty +touch x y +chattr +i empty +rm -rf empty x y +{ test -f x || test -f y || test -f z; } && fail=1 +chattr -i empty + +Exit $fail -- 2.29.0.249.g249b51256f From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 26 12:01:29 2020 Received: (at 44889) by debbugs.gnu.org; 26 Nov 2020 17:01:29 +0000 Received: from localhost ([127.0.0.1]:42686 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kiKe8-0006U3-VJ for submit@debbugs.gnu.org; Thu, 26 Nov 2020 12:01:29 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:43660) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kiKe0-0006TP-I6; Thu, 26 Nov 2020 12:01:21 -0500 Received: by mail-wr1-f65.google.com with SMTP id s8so2844243wrw.10; Thu, 26 Nov 2020 09:01:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=9w2l3zLM35r6UXakmfpO0iIqQygWw4nof6xtBk9qsvM=; b=T1FQ7TkjVaS1RyTzLzaqRtS/uov83oEnC5c6Fx9KXBwjOOTn2ca8DSMBpu4CKQ3GR/ ZGXf1nMk6hRKmvI4pu1oFxVjwmJylkSHfAu5ZUuZKhn1LGgkQsVzV/5EdJZZPVDsMBxI SAHLGbXdc/K2EsNBwxzo+A6lfz37bX17b+/jdRYIheMF6l75MlE7gBpOU/jj4+W8oZrj egtj1SBi6HwKs54vnAIQ5XqIM2Z8wWEz9sxwS93VfU2OHXGShsxqJo7b74uxacM551A6 qbVrGqwrbURUwXL7YnFgC2UuISAu8AVL5wuWsSYnbysBFFN3gCxCyWAwVvhp/3XXYp6e Hw0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=9w2l3zLM35r6UXakmfpO0iIqQygWw4nof6xtBk9qsvM=; b=BtHavrtIsjOK8apQyDbyc0nFaT5kJZNK0GgL6ihvZzaAhsxFpRnCZsfXBRVKgyG3am XQB9tVtTNuIfbI0AZCYM/AudDLuL38fSGxCAm3AaIClcodYL0XzFemJJFJFQ+V2y2Jxi vlrpeyl5oCKG9h0X0ge0MrV4wv791u/wez3DQ1Rp9QvHq5Jxc747jNRRtb4oLw2qj+6T +jim4tvCe9LsOYQ6c9lg5uxlcJmhOib1Rl209V7oOvI+CwaXE65EUH4UqHoVPQnbKd26 aTI4+3/xKUv7xZqqEUaEvuIerrXfu3NYLur66hdgr8IRxXpiE7NtxbwTd4Qe5eC9oIFo FM7g== X-Gm-Message-State: AOAM5325sAxTgJslLR1VQj58WDE4pUZquiIdFd++I0zXhZFKBLKg146Q CbFRNQZc54ku0cwboBXquBYTV0Gx9GQLjYtP X-Google-Smtp-Source: ABdhPJyZNsXtBpN+ZBJnJp3PjnPUQI3aV0YQjoT0xJB9fes1Hwpw/HGSoc7J9j+DjDYJEWd8CtcaBA== X-Received: by 2002:adf:e544:: with SMTP id z4mr5131815wrm.83.1606410074392; Thu, 26 Nov 2020 09:01:14 -0800 (PST) Received: from localhost.localdomain (86-42-14-227-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.42.14.227]) by smtp.googlemail.com with UTF8SMTPSA id u8sm9407342wmg.6.2020.11.26.09.01.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 Nov 2020 09:01:13 -0800 (PST) Subject: Re: bug#44889: [PATCH] rm: do not skip extra files when removal of empty directories fails To: Nick Alcock , 44889@debbugs.gnu.org References: <20201126143517.338855-1-nick.alcock@oracle.com> From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: <39b4ee3e-2510-3acf-b6b0-0457986aedf1@draigBrady.com> Date: Thu, 26 Nov 2020 17:01:12 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Thunderbird/83.0 MIME-Version: 1.0 In-Reply-To: <20201126143517.338855-1-nick.alcock@oracle.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 44889 Cc: nishant.nayan@oracle.com, bert.barbe@oracle.com, elena.zannoni@oracle.com, jemarch@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) forcemerge 44889 44865 44883 stop On 26/11/2020 14:35, Nick Alcock wrote: > diff --git a/src/remove.c b/src/remove.c > index 2d40c55cd..1150cf179 100644 > --- a/src/remove.c > +++ b/src/remove.c > @@ -508,8 +508,7 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x) > s = excise (fts, ent, x, true); > fts_skip_tree (fts, ent); > } > - > - if (s != RM_OK) > + else if (s != RM_OK) > { > mark_ancestor_dirs (ent); > fts_skip_tree (fts, ent); I think we'd still like to mark ancestors when failing to remove, so that we don't prompt unnecessarily. I think it would be better to do: diff --git a/src/remove.c b/src/remove.c index 2d40c55cd..adf948935 100644 --- a/src/remove.c +++ b/src/remove.c @@ -506,7 +506,8 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x) /* When we know (from prompt when in interactive mode) that this is an empty directory, don't prompt twice. */ s = excise (fts, ent, x, true); - fts_skip_tree (fts, ent); + if (s == RM_OK) + fts_skip_tree (fts, ent); } I've also adjusted the test slightly to not check for `tail`, and another few cleanups. I'll push in your name if you're ok with the above changes. thanks, Pádraig From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 26 12:08:32 2020 Received: (at control) by debbugs.gnu.org; 26 Nov 2020 17:08:32 +0000 Received: from localhost ([127.0.0.1]:42706 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kiKky-0006f1-4F for submit@debbugs.gnu.org; Thu, 26 Nov 2020 12:08:32 -0500 Received: from mail-wr1-f45.google.com ([209.85.221.45]:39277) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kiKku-0006em-Ix for control@debbugs.gnu.org; Thu, 26 Nov 2020 12:08:30 -0500 Received: by mail-wr1-f45.google.com with SMTP id e7so2888622wrv.6 for ; Thu, 26 Nov 2020 09:08:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:from:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=McBry5DlbloDiKXbTL28tNn8amZom0AbCvKUqrfXLUs=; b=BCvVnlHG2I85UlFdEWMsKwF2o0bhvwQVUFj4j3NEuWVVctKEwUbwGrIRSlb4w3yLOu iJSAKhLOcNZSUyAFFYJ0Mk+TbQRZBOsJ4X2H/Km5LmRVoX33jm779XybAzyLj1aHx6ly qHuxu2/6xSkWjy2Ea3gJnYZ9cg6mGzIyI6DUUZ/Lb/SpoNVUTaa5rfU1n5ktl8xzQ7lT W3XShEFnq59JvZ/pZqOvB5v+6wWZYPl0VJ5xucQWubX2NsTRQAVny86KrR9OgfYUrp55 Wo79rmKEKBx2/Xd2NXUzx+ncEcohJqnwWn/nzjTBQ+suQobvQQmFuGepsE+UBA0zqny2 8D2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:from:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=McBry5DlbloDiKXbTL28tNn8amZom0AbCvKUqrfXLUs=; b=aa7Nm7gXSHVBbFOcHG8amtEGWnNiXG/4jh6qIKkC3ktpH63Mj2G/0newhhbFCICdAf lEhg8AOlRZgnmmhO2DHZSwebtiDNj1RNJ+dmJ1U+VdVQcz++9FabFJBy7xqKvGni57Vv rYzyRV7RttXHK1zIUzFgUHRn7EQpgtmu2RHmEVvmCvBpeWOX3B2n+/M6IlFiNrXmj6w0 CWpXG7MxyeEBt+JDmkgdKFGoOkZ86BTDErslWnYFAOxKzoLeD6Ts1FQ9XODFicV6KoW5 MU1+4ujSM3rYLgXkEb5DbD589+YxEB2E63L9uHLIjFqoXvY2PcmBtLKNM5jJ6olludsz B0SA== X-Gm-Message-State: AOAM5302uA43dj2M83oop4QYZhgJ2kVdE8vguQRoL2xeOV0yvauvfaQy R36Dd0k3DRiFIUwfBN/UwtGjypj7xppXzw== X-Google-Smtp-Source: ABdhPJz95kjz0nnV8B3Z73P1NzjBIKAc/sY9ENF1SfjSO2qslpKtIw2NlZER1jxwjei5foZfxaFVgA== X-Received: by 2002:adf:fb06:: with SMTP id c6mr5009110wrr.117.1606410502461; Thu, 26 Nov 2020 09:08:22 -0800 (PST) Received: from localhost.localdomain (86-42-14-227-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.42.14.227]) by smtp.googlemail.com with UTF8SMTPSA id g186sm10782472wma.1.2020.11.26.09.08.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 Nov 2020 09:08:21 -0800 (PST) To: GNU bug tracker automated control server From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: Date: Thu, 26 Nov 2020 17:08:21 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Thunderbird/83.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 2.5 (++) 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: forcemerge 44889 44884 Content analysis details: (2.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 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 (pixelbeat[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.221.45 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.221.45 listed in wl.mailspike.net] 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.5 (+) 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: forcemerge 44889 44884 Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.221.45 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.221.45 listed in list.dnswl.org] 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 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 (pixelbeat[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.0 TVD_SPACE_RATIO No description available. 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different forcemerge 44889 44884 From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 26 12:11:13 2020 Received: (at control) by debbugs.gnu.org; 26 Nov 2020 17:11:13 +0000 Received: from localhost ([127.0.0.1]:42721 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kiKnZ-0006jm-E6 for submit@debbugs.gnu.org; Thu, 26 Nov 2020 12:11:13 -0500 Received: from mail-wm1-f46.google.com ([209.85.128.46]:38879) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kiKnW-0006jX-UO for control@debbugs.gnu.org; Thu, 26 Nov 2020 12:11:12 -0500 Received: by mail-wm1-f46.google.com with SMTP id 1so3099749wme.3 for ; Thu, 26 Nov 2020 09:11:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:from:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=4Pf4CRvdm0tTmu8lOHtV0JU/jhKI+KTBuAy7IVUh6y4=; b=E/N1BzvxIsh2ZjkfOJnlDj43dJGsq4rG34mkx4UE8WCfLT1b/T0wM2C+N5jPr1IvEh uTHVlMvdX1LL3W7kfqRetgAdq9/5hkzJkQ/qxWAZlef0yjkI5/opzatrqa2kUFmTeS9s tiaitCC5bPxC7CwOTKWXR8iVpo4I+wHJU5a2Brf1gtdpOEXX3eujLVD6MBH81R9dxDMe vLqqUYjSG52ywOy9Ohzpbb8ysmYtR8B0OpY+Mfibkc3bsxdkpKSwq7mHUF03+tRG6coV 1tHsrwxHK5wDONWwiyQ0/gi0PdFmdJpJqltUiek0Jfwy2H7dmrXFvgseTTaunyqDt1gS AxeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:from:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=4Pf4CRvdm0tTmu8lOHtV0JU/jhKI+KTBuAy7IVUh6y4=; b=lbSBPNFHeBsN1UOtsV50w1k28hgqcNfYpZQjOzYS7dQ23oef1hTaruqIHFNxRrv2/7 ncDN2oKECuvMl3uqhRYpMk2UV8KniBzRfg/zePl+PFkaNSp5Y8KdFvQm6Zfa3E2l6AKr dqlby7RVRXraAUINVII5pPyO+cNNfNbkvC/jh3FQghVTInHZoJDu4zMwg2QfsS4OAL62 U5BdbAS+qVwDtqHtEll9JhMpjDhNo4VUlsr5wf5g9YOWUBHgXBFr3WcXzX5GUfYvKjQp 8ZotkGTvRYqhfn9RWBeoUUqGzps8ctKNwyqAW8b+49j44CgSFNQ7NMrtDSmKBaA9hKCT cGZQ== X-Gm-Message-State: AOAM532NdZrk0OK4DF5QceralZiMYaReUd7nMjnbyEsVcZ0sUumqhpUb WNHrLYWvYB0pnOLY+zJbq+8e+ofIj0Frwg== X-Google-Smtp-Source: ABdhPJyB2cHEkoXRwy8y5OHqApk7Kj2jRWQdcEArw4rnRTLal07znr1p3v2kNWofD6ENquBqz//mQw== X-Received: by 2002:a1c:2e48:: with SMTP id u69mr4471482wmu.30.1606410665061; Thu, 26 Nov 2020 09:11:05 -0800 (PST) Received: from localhost.localdomain (86-42-14-227-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.42.14.227]) by smtp.googlemail.com with UTF8SMTPSA id w11sm9379013wmg.36.2020.11.26.09.11.04 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 Nov 2020 09:11:04 -0800 (PST) To: control@debbugs.gnu.org From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: <4242a28f-a68e-2e58-00f6-008f143f9b1b@draigBrady.com> Date: Thu, 26 Nov 2020 17:11:03 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Thunderbird/83.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 2.5 (++) 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: unmerge 44865 tag 44865 notabug close 44865 stop Content analysis details: (2.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 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 (pixelbeat[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.128.46 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.128.46 listed in list.dnswl.org] 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.5 (+) 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: unmerge 44865 tag 44865 notabug close 44865 stop Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.128.46 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.128.46 listed in list.dnswl.org] 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 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 (pixelbeat[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different unmerge 44865 tag 44865 notabug close 44865 stop From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 26 13:49:58 2020 Received: (at 44889) by debbugs.gnu.org; 26 Nov 2020 18:49:58 +0000 Received: from localhost ([127.0.0.1]:42861 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kiML8-0002ov-5r for submit@debbugs.gnu.org; Thu, 26 Nov 2020 13:49:58 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:50834) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kiML5-0002of-Gp for 44889@debbugs.gnu.org; Thu, 26 Nov 2020 13:49:56 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AQIj3oG150350; Thu, 26 Nov 2020 18:49:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : references : date : in-reply-to : message-id : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=ItqhnLKAfYYTXk5jaw0gYzZHFlIunsPYit71NBr5mq4=; b=kA51OQ14keUTUaa78C0QGJ9SzfIGdiN0BLZYaPXPWgB6VMLqbCDVrLSjbjrQYhy9n3Fv 6I4SshYNoqoH5kU/ZkMeOGm9LnMRP/I2FuGQkka7/utxfnkR/tYbBrM1Tj3zGCnBNg2c LwetX+PxYu8eSDS3WBQZg3N0nWi9Ly1EFRfEickU+2aYAvN0KR9g+wVzg1xlCGFG7WdW QZVcEDPasKF8mNskVj7f9hsu2W8PxyAIyBNtMFKWcNS4u4X+h/JLdhfhJlSsvHlM/Xrl AGjjSnJANoMxpk+6z4KVb6Wwd8bUf4nyiRJ8Rj/AlpqoTmxoOW2mqmENozBgGyVv0lmz wA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 351kwheypy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 26 Nov 2020 18:49:49 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AQIjm19035238; Thu, 26 Nov 2020 18:49:48 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 351kwfsugk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Nov 2020 18:49:48 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0AQInjRm021807; Thu, 26 Nov 2020 18:49:46 GMT Received: from loom (/81.187.191.129) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 26 Nov 2020 10:49:45 -0800 From: Nick Alcock To: =?utf-8?Q?P=C3=A1draig?= Brady Subject: Re: bug#44889: [PATCH] rm: do not skip extra files when removal of empty directories fails References: <20201126143517.338855-1-nick.alcock@oracle.com> <39b4ee3e-2510-3acf-b6b0-0457986aedf1@draigBrady.com> Emacs: why choose between a word processor and a Lisp interpreter when you could have neither instead? Date: Thu, 26 Nov 2020 18:49:43 +0000 In-Reply-To: <39b4ee3e-2510-3acf-b6b0-0457986aedf1@draigBrady.com> (=?utf-8?Q?=22P=C3=A1draig?= Brady"'s message of "Thu, 26 Nov 2020 17:01:12 +0000") Message-ID: <87k0u8dkc8.fsf@esperi.org.uk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9817 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 suspectscore=0 phishscore=0 mlxscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011260115 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9817 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 impostorscore=0 suspectscore=0 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1011 priorityscore=1501 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011260115 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 44889 Cc: elena.zannoni@oracle.com, nishant.nayan@oracle.com, bert.barbe@oracle.com, 44889@debbugs.gnu.org, jemarch@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On 26 Nov 2020, Pádraig Brady verbalised: > On 26/11/2020 14:35, Nick Alcock wrote: >> diff --git a/src/remove.c b/src/remove.c >> index 2d40c55cd..1150cf179 100644 >> --- a/src/remove.c >> +++ b/src/remove.c >> @@ -508,8 +508,7 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x) >> s = excise (fts, ent, x, true); >> fts_skip_tree (fts, ent); >> } >> - >> - if (s != RM_OK) >> + else if (s != RM_OK) >> { >> mark_ancestor_dirs (ent); >> fts_skip_tree (fts, ent); > > I think we'd still like to mark ancestors when failing to remove, > so that we don't prompt unnecessarily. If this doesn't make the test fail, I'm fine with it. > I think it would be better to do: > > diff --git a/src/remove.c b/src/remove.c > index 2d40c55cd..adf948935 100644 > --- a/src/remove.c > +++ b/src/remove.c > @@ -506,7 +506,8 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x) > /* When we know (from prompt when in interactive mode) > that this is an empty directory, don't prompt twice. */ > s = excise (fts, ent, x, true); > - fts_skip_tree (fts, ent); > + if (s == RM_OK) > + fts_skip_tree (fts, ent); > } I don't really understand what mark_ancestor_dirs is doing, but as long as it's not making the file disappear and the new test still passes I'm fine with this (though honestly the s= stuff is incredibly confusing and really should be using two distinct variables for result-of-prompt and result-of-excision to make it obvious what the flaming dingbats is going on). Another worry of mine is that I don't understand why fts_skip_tree is skipping an entry *other* than ent the second time it's called. Naively I'd have assumed fts_skip_tree (fts, ent) would be idempotent: calling it repeatedly with the same ent should do the same as calling it only once. But clearly this is not the case, so I'm misreading the code in gnulib and/or glibc somehow. > I'll push in your name if you're ok with the above changes. It's really in Nishan's name, but OK :) From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 26 14:40:06 2020 Received: (at 44889-done) by debbugs.gnu.org; 26 Nov 2020 19:40:06 +0000 Received: from localhost ([127.0.0.1]:42933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kiN7e-000444-9x for submit@debbugs.gnu.org; Thu, 26 Nov 2020 14:40:06 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:32983) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kiN7a-00043Q-NH for 44889-done@debbugs.gnu.org; Thu, 26 Nov 2020 14:40:05 -0500 Received: by mail-wr1-f67.google.com with SMTP id u12so3352182wrt.0 for <44889-done@debbugs.gnu.org>; Thu, 26 Nov 2020 11:40:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=SSSJrtqUtK/jS0fb1xEpIpJT9D9ddkR6ZlcOQsCoT2w=; b=FxXyneS1nHEAScrF5DT8JEVrU0oJ+g3BaQIFI0yDBfVo/p4Sh/sBFq50UHoxJP/Lx1 N7tTLeK9vli9wp1GnBP0U5e+RE7I4COApqgtK4s4Pv9qijGgLR+gCQ9DBdi7b/XI8Cgx DDR7vBOSj0juW5Z4A7aTQn/Z2fArQNp7tkLD3i738C78176WMlYF4kXZogich5aUP+N7 Dp3I7/wbLChMv+6x+mUh5o4btUGZZ+I+3OtPLvUaA213qHjX6mty1PmPYtAh1ylY8mvQ yyW5Pm617/Y7crbysqmKQcPeNyY6XzKpXo+kc/N2wZcFWpABsmFlYWelmS5KkZqqlHzx Y3qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=SSSJrtqUtK/jS0fb1xEpIpJT9D9ddkR6ZlcOQsCoT2w=; b=YRgOiBHKViLyHATOmfcvY0FvmYvHoLPQCqbRID6JOXxqCwnX9CF/AlXgSZz1vfWPss EW9i1XUM4mt31qEsE1ncmNQaz+c0S+vgUL4XkrZURxp7Zcumw0m4E2P7lNzWH5BaGXuR m7KgcQV7bVuspeXaofWDor3FPpMISh06IJnH+PsKZT24eajTSvEltWuoZ9VcZX7FNhef spHDwv46snMDAyqAacharU4SUFPHtvzmpxrDbDMhMU9Al3RtFj/1iwbCs839IQLZ/Q0l zARxlPwVWpEZX8D9jZDgiKDx8p/Me2iWG8xBLc0Pww+iQ40u761pzLxm0Ctxwm2u8+G4 OBRg== X-Gm-Message-State: AOAM530uRAVlEmCOyginfHniFUO54ZNDLflU95QM22ykQoT5gX0zoO0K lwruDet2sZ1uinhr2Zhef+Y= X-Google-Smtp-Source: ABdhPJwCH5bV83H4l4Jel2jHPjfsTk8v+lsWC0ZMx90LYQvay33rhh0kFtmxli+0KD1t0BMMPggMgQ== X-Received: by 2002:adf:aada:: with SMTP id i26mr5861282wrc.300.1606419596883; Thu, 26 Nov 2020 11:39:56 -0800 (PST) Received: from localhost.localdomain (86-42-14-227-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.42.14.227]) by smtp.googlemail.com with UTF8SMTPSA id m3sm9998540wrv.6.2020.11.26.11.39.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 Nov 2020 11:39:56 -0800 (PST) Subject: Re: bug#44889: [PATCH] rm: do not skip extra files when removal of empty directories fails To: Nick Alcock References: <20201126143517.338855-1-nick.alcock@oracle.com> <39b4ee3e-2510-3acf-b6b0-0457986aedf1@draigBrady.com> <87k0u8dkc8.fsf@esperi.org.uk> From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: <5b72061f-dc81-118f-bfa1-95d968e3900d@draigBrady.com> Date: Thu, 26 Nov 2020 19:39:54 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Thunderbird/83.0 MIME-Version: 1.0 In-Reply-To: <87k0u8dkc8.fsf@esperi.org.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 44889-done Cc: elena.zannoni@oracle.com, nishant.nayan@oracle.com, bert.barbe@oracle.com, 44889-done@debbugs.gnu.org, jemarch@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On 26/11/2020 18:49, Nick Alcock wrote: > On 26 Nov 2020, Pádraig Brady verbalised: > >> On 26/11/2020 14:35, Nick Alcock wrote: >>> diff --git a/src/remove.c b/src/remove.c >>> index 2d40c55cd..1150cf179 100644 >>> --- a/src/remove.c >>> +++ b/src/remove.c >>> @@ -508,8 +508,7 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x) >>> s = excise (fts, ent, x, true); >>> fts_skip_tree (fts, ent); >>> } >>> - >>> - if (s != RM_OK) >>> + else if (s != RM_OK) >>> { >>> mark_ancestor_dirs (ent); >>> fts_skip_tree (fts, ent); >> >> I think we'd still like to mark ancestors when failing to remove, >> so that we don't prompt unnecessarily. > > If this doesn't make the test fail, I'm fine with it. Cool, the test still passes :) >> I think it would be better to do: >> >> diff --git a/src/remove.c b/src/remove.c >> index 2d40c55cd..adf948935 100644 >> --- a/src/remove.c >> +++ b/src/remove.c >> @@ -506,7 +506,8 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x) >> /* When we know (from prompt when in interactive mode) >> that this is an empty directory, don't prompt twice. */ >> s = excise (fts, ent, x, true); >> - fts_skip_tree (fts, ent); >> + if (s == RM_OK) >> + fts_skip_tree (fts, ent); >> } > > I don't really understand what mark_ancestor_dirs is doing, but as long > as it's not making the file disappear and the new test still passes I'm > fine with this (though honestly the s= stuff is incredibly confusing and > really should be using two distinct variables for result-of-prompt and > result-of-excision to make it obvious what the flaming dingbats is going > on). > > Another worry of mine is that I don't understand why fts_skip_tree is > skipping an entry *other* than ent the second time it's called. Naively > I'd have assumed fts_skip_tree (fts, ent) would be idempotent: calling > it repeatedly with the same ent should do the same as calling it only > once. But clearly this is not the case, so I'm misreading the code in > gnulib and/or glibc somehow. There is an fts_read() in fts_skip_tree() that's consuming the entry. Pushed at: https://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=6bf108358 cheers, Pádraig From unknown Thu Jun 19 13:59:40 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 25 Dec 2020 12:24:09 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator