Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > muc.lists.netbsd.tech.userlevel > #11719

Re: rm -iR

Path csiph.com!weretis.net!feeder8.news.weretis.net!sewer!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail
From Greg Troxel <gdt@lexort.com>
Newsgroups muc.lists.netbsd.tech.userlevel
Subject Re: rm -iR
Date Tue, 03 Feb 2026 15:21:04 -0500
Organization Newsgate at muc.de e.V.
Sender tech-userlevel-owner@NetBSD.org
Approved news-admin@muc.de
Distribution world
Message-ID <rmisebhefyn.fsf@s1.lexort.com> (permalink)
References <aYJM5gKn0cEA4EFA@netmeister.org>
MIME-Version 1.0
Content-Type text/plain
Injection-Info news.muc.de; posting-host="news.muc.de:193.149.48.2"; logging-data="62860"; mail-complaints-to="news-admin@muc.de"
User-Agent Gnus/5.13 (Gnus v5.13)
Authentication-Results mail.netbsd.org (amavisd-new); dkim=pass (1024-bit key) header.d=lexort.com
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=lexort.com; s=mail; t=1770150064; bh=2CpzP4zujyyRTPm1oPsW5AbbtRONy6MMq5ALismJm3g=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=QcgokSUrCkeIygcqHfqfjwl9cAqKFr/JbOm9Py7x7i4Dl4Z74PyzLMP6zZHx7vguK HV54lOEYj24ey8QjseNyF8aFX1k7UbZOcdL9Gfd9V7Ir+L3LoMNRfgAU/DSoRYVu1U 4KlSngLPrDPaDM+H46mHUddbp3jjwZ8UbsLtf/rk=
In-Reply-To <aYJM5gKn0cEA4EFA@netmeister.org> (Jan Schaumann's message of "Tue, 3 Feb 2026 14:30:46 -0500")
OpenPGP id=098ED60E
Precedence bulk
X-Newsgate-Id f02c70b8849f+
X-No-Archive Yes
Xref csiph.com muc.lists.netbsd.tech.userlevel:11719

Show key headers only | View raw


Jan Schaumann <jschauma@netmeister.org> writes:

> rm(1) currently says for the '-R' flag:
>
> "If the -i option is specified, the user is prompted
> for confirmation before each directory's contents are
> processed (as well as before the attempt is made to
> remove the directory)."
>
> But it's actually a bit misleading and only prompts
> for _removal_ of a directory, not for processing the
> contents:
>
> $ mkdir -p dir/subdir/subsub dir/subdir2
> $ touch dir/file dir/subdir/file dir/subdir/subsub/file dir/subdir2/file
> $ rm -ir dir
> remove 'dir'? n
> $
>
> On macOS, rm(1) behaves like this:
>
> $ rm -ir dir
> examine files in directory dir? y
> examine files in directory dir/subdir2? y
> remove dir/subdir2/file? n
> examine files in directory dir/subdir2/subsub? n
> remove dir/subdir2? 
>
> Linux / GNU coreutils likewise:
>
> $ rm -ir dir
> rm: descend into directory 'dir'? y
> rm: descend into directory 'dir/subdir'? y
> rm: remove regular empty file 'dir/subdir/file'? n
> rm: descend into directory 'dir/subdir/subsub'? n
> rm: remove regular empty file 'dir/file'? 
>
> That behavior seems to match what the manual page
> describes much more than what we do.  Should we match
> that?

We should ensure that the code and the man page conform to POSIX, unless
there's a really good reason, in which the man page should explain and
justify the nonconformance.

https://pubs.opengroup.org/onlinepubs/9799919799/utilities/rm.html

The other systems look conforming.

It's a good question how FreeBSD documents -i and processes it.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de

Back to muc.lists.netbsd.tech.userlevel | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

rm -iR Jan Schaumann <jschauma@netmeister.org> - 2026-02-03 14:30 -0500
  Re: rm -iR Greg Troxel <gdt@lexort.com> - 2026-02-03 15:21 -0500
    Re: rm -iR Jan Schaumann <jschauma@netmeister.org> - 2026-02-03 16:11 -0500
      Re: rm -iR Greg Troxel <gdt@lexort.com> - 2026-02-03 17:27 -0500
        Re: rm -iR Robert Elz <kre@munnari.OZ.AU> - 2026-02-04 15:46 +0700
  Re: rm -iR Mouse <mouse@Rodents-Montreal.ORG> - 2026-02-03 16:52 -0500
  Re: rm -iR RVP <rvp@SDF.ORG> - 2026-02-04 05:48 +0000
    Re: rm -iR Jan Schaumann <jschauma@netmeister.org> - 2026-02-06 16:33 -0500
      Re: rm -iR Reinoud Zandijk <reinoud@NetBSD.org> - 2026-04-19 18:15 +0200
        Re: rm -iR Jan Schaumann <jschauma@netmeister.org> - 2026-04-25 16:24 -0400

csiph-web