From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 18 03:56:10 2015 Received: (at submit) by debbugs.gnu.org; 18 Jul 2015 07:56:10 +0000 Received: from localhost ([127.0.0.1]:52510 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZGMyg-00015t-EA for submit@debbugs.gnu.org; Sat, 18 Jul 2015 03:56:10 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39807) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZGMyd-00015d-Kq for submit@debbugs.gnu.org; Sat, 18 Jul 2015 03:56:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZGMyX-0008IP-Gg for submit@debbugs.gnu.org; Sat, 18 Jul 2015 03:56:02 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:33968) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGMyX-0008IL-Dm for submit@debbugs.gnu.org; Sat, 18 Jul 2015 03:56:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53309) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGMyW-0005vk-8r for bug-coreutils@gnu.org; Sat, 18 Jul 2015 03:56:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZGMyR-0008EQ-NY for bug-coreutils@gnu.org; Sat, 18 Jul 2015 03:56:00 -0400 Received: from ishtar.tlinx.org ([173.164.175.65]:42108 helo=Ishtar.hs.tlinx.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGMyR-0008A8-2L for bug-coreutils@gnu.org; Sat, 18 Jul 2015 03:55:55 -0400 Received: from [192.168.4.12] (Athenae [192.168.4.12]) by Ishtar.hs.tlinx.org (8.14.9/8.14.4/SuSE Linux 0.8) with ESMTP id t6I7tjlg018288 for ; Sat, 18 Jul 2015 00:55:48 -0700 Message-ID: <55AA0682.2000408@tlinx.org> Date: Sat, 18 Jul 2015 00:55:46 -0700 From: Linda Walsh User-Agent: Thunderbird MIME-Version: 1.0 To: bug-coreutils@gnu.org Subject: rm appears to no longer be POSIX compliant (as of 2013 edition) re: deleting empty dirs and files under /. Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -5.0 (-----) In looking at the 2013 specification for rm (http://pubs.opengroup.org/onlinepubs/9699919799/utilities/rm.html), it no longer says to stop processing if the path basename equals "." or "..". It says that the entries "." and ".." shall not be removed. It also says rm shall behave like "rmdir" -- i.e. it will delete empty directories. But in the case of foo/. it would be expected to process child inodes before processing the directory itself. But step 4 on that page says that rm should remove empty directories without requiring other special switches. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 18 04:43:39 2015 Received: (at 21084) by debbugs.gnu.org; 18 Jul 2015 08:43:39 +0000 Received: from localhost ([127.0.0.1]:52515 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZGNic-0002AS-FY for submit@debbugs.gnu.org; Sat, 18 Jul 2015 04:43:38 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:40711) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZGNiZ-0002AI-Lt for 21084@debbugs.gnu.org; Sat, 18 Jul 2015 04:43:36 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3mYNBs6CGqz3hkJW; Sat, 18 Jul 2015 10:43:33 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3mYNBs4c9szvhQT; Sat, 18 Jul 2015 10:43:33 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id b2HsnxuqHwCS; Sat, 18 Jul 2015 10:43:32 +0200 (CEST) X-Auth-Info: 3umtikKnLIiYpptjq6raF9ThzI96Zl1fmykiE9NKQy6vTUgTezqIXj2LsbzckZ+2 Received: from linux.local (ppp-62-216-212-91.dynamic.mnet-online.de [62.216.212.91]) by mail.mnet-online.de (Postfix) with ESMTPA; Sat, 18 Jul 2015 10:43:32 +0200 (CEST) Received: by linux.local (Postfix, from userid 501) id EA9981E5308; Sat, 18 Jul 2015 10:43:28 +0200 (CEST) From: Andreas Schwab To: Linda Walsh Subject: Re: bug#21084: rm appears to no longer be POSIX compliant (as of 2013 edition) re: deleting empty dirs and files under /. References: <55AA0682.2000408@tlinx.org> X-Yow: ..I just walked into th' HOUSE OF REPRESENTATIVES with fourteen WET DOLPHINS and an out-of-date MARRIAGE MANUAL... Date: Sat, 18 Jul 2015 10:43:28 +0200 In-Reply-To: <55AA0682.2000408@tlinx.org> (Linda Walsh's message of "Sat, 18 Jul 2015 00:55:46 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 21084 Cc: 21084@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.7 (/) Linda Walsh writes: > In looking at the 2013 specification for rm > (http://pubs.opengroup.org/onlinepubs/9699919799/utilities/rm.html), > > it no longer says to stop processing if the path basename equals > "." or "..". "If either of the files dot or dot-dot are specified as the basename portion of an operand (that is, the final pathname component) or if an operand resolves to the root directory, rm shall write a diagnostic message to standard error and do nothing more with such operands." Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 18 04:46:19 2015 Received: (at 21084) by debbugs.gnu.org; 18 Jul 2015 08:46:19 +0000 Received: from localhost ([127.0.0.1]:52519 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZGNlD-0002FK-6E for submit@debbugs.gnu.org; Sat, 18 Jul 2015 04:46:19 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:56577) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZGNlA-0002F9-SM for 21084@debbugs.gnu.org; Sat, 18 Jul 2015 04:46:17 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3mYNFz4krSz3hjX4; Sat, 18 Jul 2015 10:46:15 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3mYNFz3BWzzvhQR; Sat, 18 Jul 2015 10:46:15 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id y16HXcJFHhUh; Sat, 18 Jul 2015 10:46:14 +0200 (CEST) X-Auth-Info: ExBygeVigpeJXjlRnNkPijNsiYtfgJyi2GBOd+ho32k94AR2cn53QwEVfAGFmByb Received: from linux.local (ppp-62-216-212-91.dynamic.mnet-online.de [62.216.212.91]) by mail.mnet-online.de (Postfix) with ESMTPA; Sat, 18 Jul 2015 10:46:14 +0200 (CEST) Received: by linux.local (Postfix, from userid 501) id EBD9A1E5308; Sat, 18 Jul 2015 10:46:13 +0200 (CEST) From: Andreas Schwab To: Linda Walsh Subject: Re: bug#21084: rm appears to no longer be POSIX compliant (as of 2013 edition) re: deleting empty dirs and files under /. References: <55AA0682.2000408@tlinx.org> X-Yow: ..Are we having FUN yet...? Date: Sat, 18 Jul 2015 10:46:13 +0200 In-Reply-To: <55AA0682.2000408@tlinx.org> (Linda Walsh's message of "Sat, 18 Jul 2015 00:55:46 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 21084 Cc: 21084@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.7 (/) Linda Walsh writes: > But step 4 on that page says that rm should remove empty directories > without requiring other special switches. Please read step 2a. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 18 11:47:37 2015 Received: (at control) by debbugs.gnu.org; 18 Jul 2015 15:47:37 +0000 Received: from localhost ([127.0.0.1]:53178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZGUKv-0005GI-Cp for submit@debbugs.gnu.org; Sat, 18 Jul 2015 11:47:37 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:43175) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZGUKt-0005G4-G3 for control@debbugs.gnu.org; Sat, 18 Jul 2015 11:47:36 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 596BC1601B0 for ; Sat, 18 Jul 2015 08:47:29 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id mMuB0IfMhc54 for ; Sat, 18 Jul 2015 08:47:28 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B5B03160999 for ; Sat, 18 Jul 2015 08:47:28 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id wwVssyba5stg for ; Sat, 18 Jul 2015 08:47:28 -0700 (PDT) Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 948321601B0 for ; Sat, 18 Jul 2015 08:47:28 -0700 (PDT) Message-ID: <55AA7510.70206@cs.ucla.edu> Date: Sat, 18 Jul 2015 08:47:28 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: control@debbugs.gnu.org Subject: 21084 is not a bug Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.2 (-) tags 21084 notabug close 21084 thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 18 18:11:14 2015 Received: (at 21084) by debbugs.gnu.org; 18 Jul 2015 22:11:14 +0000 Received: from localhost ([127.0.0.1]:53385 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZGaK9-0007QO-BW for submit@debbugs.gnu.org; Sat, 18 Jul 2015 18:11:13 -0400 Received: from ishtar.tlinx.org ([173.164.175.65]:40042 helo=Ishtar.hs.tlinx.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZGaK6-0007QF-G5 for 21084@debbugs.gnu.org; Sat, 18 Jul 2015 18:11:11 -0400 Received: from [192.168.4.12] (Athenae [192.168.4.12]) by Ishtar.hs.tlinx.org (8.14.9/8.14.4/SuSE Linux 0.8) with ESMTP id t6IMB4q1006208; Sat, 18 Jul 2015 15:11:07 -0700 Message-ID: <55AACEF7.4010500@tlinx.org> Date: Sat, 18 Jul 2015 15:11:03 -0700 From: Linda Walsh User-Agent: Thunderbird MIME-Version: 1.0 To: Andreas Schwab Subject: Re: bug#21084: rm appears to no longer be POSIX compliant (as of 2013 edition) re: deleting empty dirs and files under /. References: <55AA0682.2000408@tlinx.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 21084 Cc: 21084@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.2 (-) reopen 21084 thanks Andreas Schwab wrote: > Linda Walsh writes: > >> In looking at the 2013 specification for rm >> (http://pubs.opengroup.org/onlinepubs/9699919799/utilities/rm.html), >> >> it no longer says to stop processing if the path basename equals >> "." or "..". > > "If either of the files dot or dot-dot are specified as the basename > portion of an operand (that is, the final pathname component) or if an > operand resolves to the root directory, rm shall write a diagnostic > message to standard error and do nothing more with such operands." ---- I'll grant it also says you can't remove "/", So a special flag "--use_depth_first_inspection" that says not to look at a "basename" until it's children have been processed wouldn't be any more out of place than special flags to handle "/" processing, right? The fact that they put the ".", ".." and "/" together, outside of the 1-4 processing leads one to the idea that they should be treated similarly, no? From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 31 19:57:02 2015 Received: (at 21084) by debbugs.gnu.org; 31 Jul 2015 23:57:02 +0000 Received: from localhost ([127.0.0.1]:36174 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZLKAf-0005qo-T6 for submit@debbugs.gnu.org; Fri, 31 Jul 2015 19:57:02 -0400 Received: from ishtar.tlinx.org ([173.164.175.65]:52411 helo=Ishtar.hs.tlinx.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZLKAd-0005qc-Vu for 21084@debbugs.gnu.org; Fri, 31 Jul 2015 19:57:00 -0400 Received: from [192.168.4.12] (Athenae [192.168.4.12]) by Ishtar.hs.tlinx.org (8.14.9/8.14.4/SuSE Linux 0.8) with ESMTP id t6VNusk7077538; Fri, 31 Jul 2015 16:56:58 -0700 Message-ID: <55BC0B46.1020009@tlinx.org> Date: Fri, 31 Jul 2015 16:56:54 -0700 From: Linda Walsh User-Agent: Thunderbird MIME-Version: 1.0 To: Andreas Schwab Subject: Re: bug#21084: rm appears to no longer be POSIX compliant (as of 2013 edition) re: deleting empty dirs and files under /. References: <55AA0682.2000408@tlinx.org> <55AACEF7.4010500@tlinx.org> In-Reply-To: <55AACEF7.4010500@tlinx.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 21084 Cc: 21084@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.4 (-) Linda Walsh wrote: > Andreas Schwab wrote: >> "If either of the files dot or dot-dot are specified as the basename >> portion of an operand (that is, the final pathname component) or if an >> operand resolves to the root directory, rm shall write a diagnostic >> message to standard error and do nothing more with such operands." > ---- > I'll grant it also says you can't remove "/", > > So a special flag "--use_depth_first_inspection" that says not to > look at > a "basename" until it's children have been processed wouldn't be any > more out of place than special flags to handle "/" processing, right? > > The fact that they put the ".", ".." and "/" together, outside of > the 1-4 processing leads one to the idea that they should be treated > similarly, > no? --- Since there is no opposition to this, I presume, all you need now is a patch? I.e. - POSIX now demands that "/", "." and ".." all be ignored in a basename, yet the some smart gnu folks decided that leaving in a non-default optional behavior to override the new dumb-down restrictions would best serve the community. So I might reason that they would be equally smart and/or use similar logic to allow a non-default option to remove the dumb-down on the "." path. NOTE: I have no issue with NOT _attempting_ a delete on "." after doing the designed depth-first traversal. Applying the POSIX restriction on not attempting to delete "." makes perfect sense to me, since I know that doing so can give inconsistent and "undefined" behavior depending on the OS, but using "." as a semantic place holder to allow one to reference a starting point for some action (imagine using 'find' if '.' was banned as starting point: > find '' -type f find: ‘’: No such file or directory *cheers* From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 31 21:29:53 2015 Received: (at 21084) by debbugs.gnu.org; 1 Aug 2015 01:29:53 +0000 Received: from localhost ([127.0.0.1]:36181 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZLLcX-0007vw-EU for submit@debbugs.gnu.org; Fri, 31 Jul 2015 21:29:53 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:57639) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZLLcV-0007vn-5B for 21084@debbugs.gnu.org; Fri, 31 Jul 2015 21:29:51 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6A0FB160728; Fri, 31 Jul 2015 18:29:49 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Zw3WRxOeocXW; Fri, 31 Jul 2015 18:29:48 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id AEB15160CBF; Fri, 31 Jul 2015 18:29:48 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id KMdiJ3W3fvQh; Fri, 31 Jul 2015 18:29:48 -0700 (PDT) Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 8BCC1160728; Fri, 31 Jul 2015 18:29:48 -0700 (PDT) Message-ID: <55BC210C.1000203@cs.ucla.edu> Date: Fri, 31 Jul 2015 18:29:48 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Linda Walsh , Andreas Schwab Subject: Re: bug#21084: rm appears to no longer be POSIX compliant (as of 2013 edition) re: deleting empty dirs and files under /. References: <55AA0682.2000408@tlinx.org> <55AACEF7.4010500@tlinx.org> <55BC0B46.1020009@tlinx.org> In-Reply-To: <55BC0B46.1020009@tlinx.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 21084 Cc: 21084@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.4 (-) Linda Walsh wrote: > Since there is no opposition to this, I presume, all you need now > is a patch? My impression is that hardly anybody cares about this corner case. How about the following idea instead? We could have --no-preserve-root also skip the special treatment for '.' and '..'. That way, we shouldn't need to add an option. From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 31 23:13:42 2015 Received: (at 21084) by debbugs.gnu.org; 1 Aug 2015 03:13:42 +0000 Received: from localhost ([127.0.0.1]:36201 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZLNEz-0001vN-NE for submit@debbugs.gnu.org; Fri, 31 Jul 2015 23:13:42 -0400 Received: from ishtar.tlinx.org ([173.164.175.65]:55997 helo=Ishtar.hs.tlinx.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZLNEx-0001vE-6Q for 21084@debbugs.gnu.org; Fri, 31 Jul 2015 23:13:39 -0400 Received: from [192.168.4.12] (Athenae [192.168.4.12]) by Ishtar.hs.tlinx.org (8.14.9/8.14.4/SuSE Linux 0.8) with ESMTP id t713DJbQ004600; Fri, 31 Jul 2015 20:13:22 -0700 Message-ID: <55BC3950.3020204@tlinx.org> Date: Fri, 31 Jul 2015 20:13:20 -0700 From: Linda Walsh User-Agent: Thunderbird MIME-Version: 1.0 To: Paul Eggert Subject: Re: bug#21084: rm appears to no longer be POSIX compliant (as of 2013 edition) re: deleting empty dirs and files under /. References: <55AA0682.2000408@tlinx.org> <55AACEF7.4010500@tlinx.org> <55BC0B46.1020009@tlinx.org> <55BC210C.1000203@cs.ucla.edu> In-Reply-To: <55BC210C.1000203@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 21084 Cc: Andreas Schwab , 21084@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.4 (-) Paul Eggert wrote: > Linda Walsh wrote: >> Since there is no opposition to this, I presume, all you need now >> is a patch? > > My impression is that hardly anybody cares about this corner case. > > How about the following idea instead? We could have --no-preserve-root > also skip the special treatment for '.' and '..'. That way, we > shouldn't need to add an option. --- Though I've never had a problem with doing something like 'rm -fr /', I'd prefer not to chance it -- I can't believe this is a corner case -- not given the putrid hate spewed at me by some BSD supporter who pushed through the mandatory restrictions. Instead of 'rm -fr /', I prefer dd if=/dev/sda2 of=/dev/sda ...wait, where was my new partition? ARG! Another issue I haven't raised yet, because this is more important to me is the horrible execution of --one-file-system. Since the rm -fr --one-file-system foo/. was removed and the suggested replacements were use '*'... gee.. so you mean under "foo/' you had bind mounts to your root, /usr and /home partitions? But one-file-system didn't catch it because they all were presented to 'rm' as cmd-line args -- and the man page legalese says "when removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argument. So it limits it to deleting files for all the files you used to be safe from deleting when dir/. was allowed. Example on my system... snapshot dir: Filesystem Size Used Avail Use% Mounted on /dev/Data/Home-2015.04.22-03.07.02 6.8G 5.5G 1.3G 81% /home/.snapdir/@GMT-2015.04.22-03.07.02 /dev/Data/Home-2015.04.30-03.07.02 1.1G 913M 186M 84% /home/.snapdir/@GMT-2015.04.30-03.07.02 /dev/Data/Home-2015.05.17-13.11.21 762M 647M 115M 85% /home/.snapdir/@GMT-2015.05.17-13.11.21 /dev/Data/Home-2015.05.18-00.40.55 1.2G 981M 193M 84% /home/.snapdir/@GMT-2015.05.18-00.40.55 /dev/Data/Home-2015.05.18-13.05.04 1.7G 1.4G 287M 83% /home/.snapdir/@GMT-2015.05.18-13.05.04 /dev/Data/Home-2015.05.19-04.08.02 1.2G 957M 189M 84% /home/.snapdir/@GMT-2015.05.19-04.08.02 /dev/Data/Home-2015.05.20-04.08.02 922M 774M 149M 84% /home/.snapdir/@GMT-2015.05.20-04.08.02 /dev/Data/Home-2015.05.21-04.08.03 802M 676M 126M 85% /home/.snapdir/@GMT-2015.05.21-04.08.03 /dev/Data/Home-2015.05.22-04.08.02 2.3G 1.9G 421M 82% /home/.snapdir/@GMT-2015.05.22-04.08.02 /dev/Data/Home-2015.05.23-04.08.02 4.5G 3.7G 874M 81% /home/.snapdir/@GMT-2015.05.23-04.08.02 /dev/Data/Home-2015.05.24-04.08.04 7.2G 5.8G 1.4G 81% /home/.snapdir/@GMT-2015.05.24-04.08.04 /dev/Data/Home-2015.05.26-03.39.31 1.3G 1.1G 218M 84% /home/.snapdir/@GMT-2015.05.26-03.39.31 /dev/Data/Home-2015.05.27-04.08.05 5.4G 4.4G 1.1G 82% /home/.snapdir/@GMT-2015.05.27-04.08.05 /dev/Data/Home-2015.06.01-14.19.28 4.1G 3.3G 779M 82% /home/.snapdir/@GMT-2015.06.01-14.19.28 /dev/Data/Home 1.5T 1.1T 494G 68% /home /dev/Data/Home-2015.06.02-12.53.34 1.5T 1.1T 502G 68% /home/.snapdir/@GMT-2015.06.02-12.53.34 That's the type of harm caused by removing the "cd snapshots && rm -fr --one-file-system ." or "rm -fr --one-file-system snapshots/." and telling them it's not needed in rm because the shell's '*' will expand it. I could safely use the disabled features in that dir -- sometimes junk builds up where something got copied into a directory that didn't have the corresponding partition mounted, as an example. With "snapshots" becoming more "in vogue" -- in another decade or so, POSIX will require banning wildcard usage from a shell (if shell-access hasn't been disabled before that, of course... ;^). Besides.. with my suggested change, rm would only need 1 new switch, not '2' like '/' did ;-), though I admit to wanting to add "-x" (find, rsync, maybe others having such a switch as meaning stay on 1-dev (--xdev) -- and if I had my druthers, using -x would NOT use the fact that cmdline args were on different filesystems as an excuse to do more than operate on "one-file-system"... (would it be that hard to check the device id's of the cmd-line args before starting a recursive delete based off them?)... Eh...like I said, for me, just the special option to allow "." or dir/. is far more important. From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 01 17:17:15 2015 Received: (at 21084) by debbugs.gnu.org; 1 Aug 2015 21:17:16 +0000 Received: from localhost ([127.0.0.1]:36861 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZLe9b-0005ni-E7 for submit@debbugs.gnu.org; Sat, 01 Aug 2015 17:17:15 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:52340) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZLe9Z-0005nZ-EL for 21084@debbugs.gnu.org; Sat, 01 Aug 2015 17:17:13 -0400 Received: from [192.168.101.10] ([217.86.93.54]) by mrelayeu.kundenserver.de (mreue102) with ESMTPSA (Nemesis) id 0MIe7s-1ZJSIR1yfo-002IkE; Sat, 01 Aug 2015 23:17:11 +0200 Subject: Re: bug#21084: rm appears to no longer be POSIX compliant (as of 2013 edition) re: deleting empty dirs and files under /. To: Linda Walsh , Paul Eggert References: <55AA0682.2000408@tlinx.org> <55AACEF7.4010500@tlinx.org> <55BC0B46.1020009@tlinx.org> <55BC210C.1000203@cs.ucla.edu> <55BC3950.3020204@tlinx.org> From: Bernhard Voelker Message-ID: <55BD3755.2040803@bernhard-voelker.de> Date: Sat, 1 Aug 2015 23:17:09 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <55BC3950.3020204@tlinx.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:2mGGEPdSLYafHElpchpoxqCRVahupSNwYumdMRCcgYIWE3wrasv 9arouh55PDelcgG5dIlHx2Z8qRXdSy3e5BfG6SOUN/ZiLOlD0TJYl+QukM0TKxEFXyPabkQ 8LXPAZS8JWFQvCb7ORTTQcqcqkUuvLxwxSRd+xXjmtY/0HfR1ynGgRKu457eHKhNM2BgdQU bNYnhVUBQ1C4IfKPWfCFA== X-UI-Out-Filterresults: notjunk:1;V01:K0:pfQWDHi4FD0=:uhYnsiLubtgdkxozhi2m+W zJ6hi9KOdjj5yV0L5DtxhbwRSDleUxP2fYkMY5symwDy4n59BaeWXQeLvVf+zyJzVUtvR7KUE aU4+PUcUUggAVx4z45gJ2E3n3OU+BVe/7KxgHOBiLjnKF2mmBlNwq/+e0BS0OGslzlBbxJ1of FQzwch+pO9cJT22HrqyUwd9FIDTx0QlzABs4bUtVFr6Zs+7aYKXc9eenGHjZAGpvFVe+YRidR LhP3V21G6+/6z4wRvYMg1fO4Zm7v4yVm/dcERECrYyjTmoW7V2EJJHnLUGbF0dgkchUXheJZu 4A85lJ62qLqT91Dn4pHxWgpslOJ7zMNBtMYxpbk1avmaa6pxvGcyvTteyvfpozYtlwO023zks zyaI9NFJbC4PBi1t+3T+WZj/SNTZ12VVupo044fKaahBH00yLGKOXuRdPwpLLErp5+a4dKQJi R+XkVF+HhhQcW8WMv1GpLNwSbtfT3CHf3AFCJxjbtNVFzqWMehd/yrfXaldDzuspH4lekop4x YQBWA7a0U+uqrxCpIk1FQlNvxQVce9lxQLnkMWSbZdeKkMFc3fdlAGo2RMqgSNqyu5wqh4lWc sC+dhYHSCl24HF3rg8n00k4oys79zYVdM85T7otHk4Q8XDTosC5T/F2BIIpskL1VOjSZZkjRI lhoehkBluBnHaOY6FARE4PXPeYDV/SeHU9s4iwLIah9ijow== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 21084 Cc: Andreas Schwab , 21084@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.7 (/) On 08/01/2015 05:13 AM, Linda Walsh wrote: > [...] for me, just the special option to allow "." or dir/. is far more > important. You're discussing several aspects at once - '.' as operand, stopping the removal at file system boundaries, etc. - but this all sounds to me as if you simply wanted this one, right? $ find '.' -mindepth 1 -xdev -delete Have a nice day, Berny From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 02 04:02:28 2015 Received: (at 21084) by debbugs.gnu.org; 2 Aug 2015 08:02:28 +0000 Received: from localhost ([127.0.0.1]:37007 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZLoE0-0003ta-0x for submit@debbugs.gnu.org; Sun, 02 Aug 2015 04:02:28 -0400 Received: from ishtar.tlinx.org ([173.164.175.65]:38422 helo=Ishtar.hs.tlinx.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZLoDx-0003tR-Ng for 21084@debbugs.gnu.org; Sun, 02 Aug 2015 04:02:26 -0400 Received: from [192.168.4.12] (Athenae [192.168.4.12]) by Ishtar.hs.tlinx.org (8.14.9/8.14.4/SuSE Linux 0.8) with ESMTP id t72825HQ026633; Sun, 2 Aug 2015 01:02:07 -0700 Message-ID: <55BDCE7D.7080107@tlinx.org> Date: Sun, 02 Aug 2015 01:02:05 -0700 From: Linda Walsh User-Agent: Thunderbird MIME-Version: 1.0 To: Bernhard Voelker Subject: Re: bug#21084: rm appears to no longer be POSIX compliant (as of 2013 edition) re: deleting empty dirs and files under /. References: <55AA0682.2000408@tlinx.org> <55AACEF7.4010500@tlinx.org> <55BC0B46.1020009@tlinx.org> <55BC210C.1000203@cs.ucla.edu> <55BC3950.3020204@tlinx.org> <55BD3755.2040803@bernhard-voelker.de> In-Reply-To: <55BD3755.2040803@bernhard-voelker.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: 21084 Cc: Paul Eggert , Andreas Schwab , 21084@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.1 (-) Bernhard Voelker wrote: > On 08/01/2015 05:13 AM, Linda Walsh wrote: >> [...] for me, just the special option to allow "." or dir/. is far more >> important. > > You're discussing several aspects at once - '.' as operand, stopping > the removal at file system boundaries, etc. - but this all sounds to me > as if you simply wanted this one, right? > > $ find '.' -mindepth 1 -xdev -delete --- (1) Tsk, tsk.... how could I possibly want that one when there is no '-delete' arg in the POSIX version of find. What were you thinking?! ;) (2) You aren't really showing my example but more of my "rmx -r ." case rmx being an alias to add -1-filesys and using 'x' to be compatible with most other tools have come across with such an option -- AND, my 'rmx -r .' only takes 1/4th the space -- I design shortcuts to typing because I can only type about 1/2 = 1/3 the speed I did before I got a moderately nasty case of RSI -- and a boss who pushed me to type more in hopes that I'd quit, as he didn't have any thing substantial to get rid of me -- even when he wrote a negative review -- the HR person who knew the facts told him he had to rewrite it -- he never did. BTW, you can make your example 2 characters shorter by removing those single quotes: they aren't needed. But still 4x the typing for something I used alot. But that -- also is part of the problem. I have alot of scripts -- many use the standard rm semantics and don't expect a crippled version. Just finding all the places it was used would be a royal pain. (3) You aren't handling legacy SVr4 systems. The voiding of the standard functionality (strictly, depth-first operation: you don't examine anything about about the current object until all of it's children are gone -- this is especially true of the command line arguments. (4) The posix change made cmdline behavior inconsistent. This change says to process `some' newly created "restriction rules" (for their 3 restricted paths) **before** processing contents. However with the 1-fs (--one-file-system) switch, the current 'rm' does not inspect the initial paths to verify that they are on the same filesystem -- it is only acting on those arguments on the basis of their type: if file: delete; if directory: descend. but it does not pay attention to their names even long enough to do a 'stat' to check that they are really all on 1 filesystem. It looks bad for rm to suddenly not fit in with other core utils which can process "." as a __Semantic__ place-holder. For an example of that, we have too look into the 'arcane' 'cp' program. :) > if you do this: > cp -a dir dir1 #expected behavior: want to update maybe > diff -r dir dir1 > cp -au dir dir1 > diff -r dir dir1 Only in dir1: dir You can do the same example adding a slash at the end to force both paths to be considered dirs, but that does the same thing.. if you try wildcards: > cp -aux dir/* dir1 It might work -- might not for the same reason that the -1fs switch in rm doesn't really work as expected. ***NOTE***: I haven't tested that example, but if does the "right thing" then the behaviors would be different between it and rm. The safe way to do the update: (Note 'cp' also has -x as did find > cp -aux dir/. dir1/. > touch dir/newfile > cp -vaux dir/. dir1/. ‘dir/./newfile’ -> ‘dir1/././newfile’ > diff -r dir dir1 >> Only the dot worked. << In experimenting with a few utils, I found some similar and some different behaviors. > du -hdx 1 -x dir > du -hdx1 -x dir/. ## both the same output. rsync also has a -x for staying on 1 fs and has semantics not too far off copy, but also allows "/. " semantics (been in unix since the earliest rm versions I saw in mid 80's. I seems obvious that someone got the votes to push through a bad feature: one that was default on, and allowed for no alternatives. That should not be the way Gnu should handle their SW -- a posix-compat mode, yes, but if Chet took ever non posix feature and behavior out of bash -- it would set the shell back 20 years. But that's only pointing out the prevalence of using "." as meaning "start here" across many other tools. (5) -- the example you gave above doesn't handle a very important case: It doesn't handle "-f" -- first I do a find to show that I own all the files below ".". (! -user law). > find . -mindepth 1 -xdev ! -user law|wc -l #do I own all the files? 0 Now I follow your option with the change that I only pipe stderr through the pipe -- which looks only for the words "Permission denied" and that into wc -l showing 832 errors that rm -fr . handles but are not handled by your find example. > find '.' -mindepth 1 -xdev -delete 2>&1 1>/dev/null|grep Permission\ denied|wc -l 832 AFAIK, find, by itself, has no way to remove all of the items under a tree even if you own them all. Whereas rm -fr . did. --- I hope my writing was sufficiently clear. I have tried to be clear about why I think rm w/'.' should have it's own switch (and combining it with '..' -- I can think of no one or any reason to enable that functionality. Even though I am careful, Having the protection against doing a bad-thing in '/' but allowing the 20+ year previous behavior to be returned, thus the need for a separate switch. Cheers! Linda From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 02 04:15:13 2015 Received: (at 21084) by debbugs.gnu.org; 2 Aug 2015 08:15:13 +0000 Received: from localhost ([127.0.0.1]:37012 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZLoQK-0004Bx-Qh for submit@debbugs.gnu.org; Sun, 02 Aug 2015 04:15:13 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:57062) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZLoQH-0004Bo-Qn for 21084@debbugs.gnu.org; Sun, 02 Aug 2015 04:15:10 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E06AF160CDD; Sun, 2 Aug 2015 01:15:08 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id nBHibYfdwjsJ; Sun, 2 Aug 2015 01:15:08 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 35E2B160CDA; Sun, 2 Aug 2015 01:15:08 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id pRyCgmF1HBua; Sun, 2 Aug 2015 01:15:08 -0700 (PDT) Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 0CEF5160195; Sun, 2 Aug 2015 01:15:08 -0700 (PDT) Message-ID: <55BDD18B.80106@cs.ucla.edu> Date: Sun, 02 Aug 2015 01:15:07 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Linda Walsh , Bernhard Voelker Subject: Re: bug#21084: rm appears to no longer be POSIX compliant (as of 2013 edition) re: deleting empty dirs and files under /. References: <55AA0682.2000408@tlinx.org> <55AACEF7.4010500@tlinx.org> <55BC0B46.1020009@tlinx.org> <55BC210C.1000203@cs.ucla.edu> <55BC3950.3020204@tlinx.org> <55BD3755.2040803@bernhard-voelker.de> <55BDCE7D.7080107@tlinx.org> In-Reply-To: <55BDCE7D.7080107@tlinx.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: 21084 Cc: Andreas Schwab , 21084@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.1 (-) Linda Walsh wrote: > find, by itself, has no way to remove all of the items under a > tree even if you own them all. That's not a problem. Have 'find' call 'rm'. Something like this, say: find . ! -name . -prune -exec rm -fr {} + So there's no need to change 'rm'. From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 02 16:31:32 2015 Received: (at 21084) by debbugs.gnu.org; 2 Aug 2015 20:31:32 +0000 Received: from localhost ([127.0.0.1]:37512 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZLzuu-0007EQ-IL for submit@debbugs.gnu.org; Sun, 02 Aug 2015 16:31:32 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:65233) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZLzut-0007EJ-HS for 21084@debbugs.gnu.org; Sun, 02 Aug 2015 16:31:32 -0400 Received: from [192.168.101.10] ([217.86.93.54]) by mrelayeu.kundenserver.de (mreue002) with ESMTPSA (Nemesis) id 0ME6mN-1Z59s8188t-00HQB9; Sun, 02 Aug 2015 22:31:19 +0200 Subject: Re: bug#21084: rm appears to no longer be POSIX compliant (as of 2013 edition) re: deleting empty dirs and files under /. To: Paul Eggert , Linda Walsh References: <55AA0682.2000408@tlinx.org> <55AACEF7.4010500@tlinx.org> <55BC0B46.1020009@tlinx.org> <55BC210C.1000203@cs.ucla.edu> <55BC3950.3020204@tlinx.org> <55BD3755.2040803@bernhard-voelker.de> <55BDCE7D.7080107@tlinx.org> <55BDD18B.80106@cs.ucla.edu> From: Bernhard Voelker Message-ID: <55BE7E14.9020204@bernhard-voelker.de> Date: Sun, 2 Aug 2015 22:31:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <55BDD18B.80106@cs.ucla.edu> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:2vxLUWhEeMW4pD8JE0ED9EfnKecWWKFEWBMMqhPt43DWwIFXCfi ce6+fz9De3nQ5qnyqH9zNtMQ7rC172uoSqZjT8eE0bJSJ/D87toaOdUEQy/45pcTZlrxtSY QJgdKC+Glgn2Sbu+/A5K76UoAKjUyjMLUK99GBcQC+XFIAHlp49a1HHNnRpVw2zR84ZFkVm CFgFPwudKux1CGJxnFvBQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:Hv10/TX76bw=:UvyOKa8tK+foDASBUimkzw Wk0BlsdYm7C/gqCEw/mXi7f13QMnesdJ8m4JR0ekvW1VXHh/0InDrBDrrjMHzyeU+Qbra0Pt3 uF8qQX9xu+h3XYLBJqzQ3G7n0UxBGeopLvFbOsK5Y08hR/Uo+mITJpM0OYMh4yzHvEqxizKZv HVYk4EBMInCCvrqwtWDwgnmXOoucJljKETXjRLgTBzMq+zr4zYkwVEJxyRM4lFAUkSdcYOn5g M9zDKRtl1DGfFtj5JFV5LKo0Ct+WcMeuXGwnjl9d35GT3n36ThVdJCQsfXTnRJDtt3egjnnln Po5Fn2a+fXdqHh+R7vwjnEAz47G+uHuQ05Jo63OGJvrbVymsIFM8pgXusQK72RLgifYWtfF0Z CC9z8vU+eW9dG8puXZVix5YJ9mjRz32I2uVySFLdmwK0pVOzuc4YW9ZlXxxsvNoXm59CsAF8E a4u8uKDbuVJ4+A9yK8fyE5SoSwHy18bvu2YC1bSCAVtwIDwq9Ous1d5c4GCKqtjFrEzrogecC uDyr+03EpKoVP01VlZK/dUvpYAiqdstm98dg1aEteL4mF4bKcJKl+SCHnXKPiQlYPg8IEKkxD OsBuZdeVIlDXkd9PDlU5uTGpbsPbcIN46FJZVGsy7mwoz1sLpoxkvRrdT+5uriw5I90bjVY77 KwypUSUi47TfDrv+nXgEMYzMlX0s7k+xP1Er9LAREke61aQ== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 21084 Cc: Andreas Schwab , 21084@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.7 (/) On 08/02/2015 10:15 AM, Paul Eggert wrote: > Linda Walsh wrote: >> find, by itself, has no way to remove all of the items under a >> tree even if you own them all. > > That's not a problem. Have 'find' call 'rm'. Something like this, say: > > find . ! -name . -prune -exec rm -fr {} + > > So there's no need to change 'rm'. +1 Adding additional code to find out if the file to remove is still on the same file system would add bloat, and would open another can of worms: corner cases, races and a big performance penalty. E.g. one might blindly assume that only directories are mount points, but in reality also a regular file can be 'over-mounted'. Have a nice day, Berny From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 02 21:32:31 2015 Received: (at 21084) by debbugs.gnu.org; 3 Aug 2015 01:32:31 +0000 Received: from localhost ([127.0.0.1]:37590 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZM4cB-00064C-BD for submit@debbugs.gnu.org; Sun, 02 Aug 2015 21:32:31 -0400 Received: from ishtar.tlinx.org ([173.164.175.65]:51882 helo=Ishtar.hs.tlinx.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZM4c7-00063n-Ak for 21084@debbugs.gnu.org; Sun, 02 Aug 2015 21:32:28 -0400 Received: from [192.168.4.12] (Athenae [192.168.4.12]) by Ishtar.hs.tlinx.org (8.14.9/8.14.4/SuSE Linux 0.8) with ESMTP id t731W8Wo021319; Sun, 2 Aug 2015 18:32:11 -0700 Message-ID: <55BEC498.9090106@tlinx.org> Date: Sun, 02 Aug 2015 18:32:08 -0700 From: Linda Walsh User-Agent: Thunderbird MIME-Version: 1.0 To: Bernhard Voelker Subject: Re: bug#21084: rm appears to no longer be POSIX compliant (as of 2013 edition) re: deleting empty dirs and files under /. References: <55AA0682.2000408@tlinx.org> <55AACEF7.4010500@tlinx.org> <55BC0B46.1020009@tlinx.org> <55BC210C.1000203@cs.ucla.edu> <55BC3950.3020204@tlinx.org> <55BD3755.2040803@bernhard-voelker.de> <55BDCE7D.7080107@tlinx.org> <55BDD18B.80106@cs.ucla.edu> <55BE7E14.9020204@bernhard-voelker.de> In-Reply-To: <55BE7E14.9020204@bernhard-voelker.de> Content-Type: multipart/mixed; boundary="------------070300040906000104090409" X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: 21084 Cc: Paul Eggert , Andreas Schwab , 21084@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.1 (/) This is a multi-part message in MIME format. --------------070300040906000104090409 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Bernhard Voelker wrote: > On 08/02/2015 10:15 AM, Paul Eggert wrote: >> Linda Walsh wrote: >>> find, by itself, has no way to remove all of the items under a >>> tree even if you own them all. >> That's not a problem. Have 'find' call 'rm'. Something like this, say: >> >> find . ! -name . -prune -exec rm -fr {} + >> >> So there's no need to change 'rm'. > > +1 > > Adding additional code to find out if the file to remove is still on the > same file system would add bloat, and would open another can of worms: > corner cases, races and a big performance penalty Um... The code to find out if the file to remove is on the same file system is already in "rm". -3 for attempting to create strawmen. --------------070300040906000104090409 Content-Type: text/plain; name="treescan-aio.pl" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="treescan-aio.pl" IyEvdXNyL2Jpbi9wZXJsCgpldmFsICdleGVjIC91c3IvYmluL3BlcmwgIC1TICQwICR7MSsi JEAifScKICAgIGlmIDA7ICMgbm90IHJ1bm5pbmcgdW5kZXIgc29tZSBzaGVsbAoKIyBpbnNw aXJlZCBieSB0cmVlc2NhbiBieSBKYW1pZSBMb2tpZXIgPGphbWllQGltYm9sYy51Y2MuaWU+ CiMgYWJvdXQgNDAlIGZhc3RlciB0aGFuIHRoZSBvcmlnaW5hbCB2ZXJzaW9uIChvbiBteSBm cyBhbmQgcmFpZCA6KQoKdXNlIHN0cmljdDsKdXNlIEdldG9wdDo6TG9uZzsKdXNlIFRpbWU6 OkhpUmVzICgpOwp1c2UgSU86OkFJTzsKCm91ciAkVkVSU0lPTiA9ICRJTzo6QUlPOjpWRVJT SU9OOwoKR2V0b3B0OjpMb25nOjpDb25maWd1cmUgKCJidW5kbGluZyIsICJub19pZ25vcmVf Y2FzZSIsICJyZXF1aXJlX29yZGVyIiwgImF1dG9faGVscCIsICJhdXRvX3ZlcnNpb24iKTsK Cm15ICgkb3B0X3NpbGVudCwgJG9wdF9wcmludDAsICRvcHRfc3RhdCwgJG9wdF9ub2RpcnMs CiAgICAkb3B0X25vZmlsZXMsICRvcHRfZ3JlcCwgJG9wdF9wcm9ncmVzcyk7CgpHZXRPcHRp b25zCiAgICJxdWlldHxxIiAgICA9PiBcJG9wdF9zaWxlbnQsCiAgICJwcmludDB8MCIgICA9 PiBcJG9wdF9wcmludDAsCiAgICJzdGF0fHMiICAgICA9PiBcJG9wdF9zdGF0LAogICAiZGly c3xkIiAgICAgPT4gXCRvcHRfbm9maWxlcywKICAgImZpbGVzfGYiICAgID0+IFwkb3B0X25v ZGlycywKICAgImdyZXB8Zz1zIiAgID0+IFwkb3B0X2dyZXAsCiAgICJwcm9ncmVzc3xwIiA9 PiBcJG9wdF9wcm9ncmVzcywKICAgb3IgZGllICJVc2FnZTogdHJ5ICQwIC0taGVscCI7CgpA QVJHViA9ICIuIiB1bmxlc3MgQEFSR1Y7Cgokb3B0X2dyZXAgJiY9IHFyeyRvcHRfZ3JlcH1z OwoKbXkgKCRuX2RpcnMsICRuX2ZpbGVzLCAkbl9zdGF0cykgPSAoMCwgMCwgMCk7Cm15ICgk bl9sYXN0LCAkbl9zdGFydCkgPSAoVGltZTo6SGlSZXM6OnRpbWUpIHggMjsKCnN1YiBwcmlu dGZuIHsKICAgbXkgKCRwcmVmaXgsICRmaWxlcywgJHN1ZmZpeCkgPSBAXzsKCiAgIGlmICgk b3B0X2dyZXApIHsKICAgICAgQCRmaWxlcyA9IGdyZXAgIiRwcmVmaXgkXyIgPX4gJG9wdF9n cmVwLCBAJGZpbGVzOwogICB9CiAgIAogICBpZiAoJG9wdF9wcmludDApIHsKICAgICAgcHJp bnQgbWFwICIkcHJlZml4JF8kc3VmZml4XDAiLCBAJGZpbGVzOwogICB9IGVsc2lmICghJG9w dF9zaWxlbnQpIHsKICAgICAgcHJpbnQgbWFwICIkcHJlZml4JF8kc3VmZml4XG4iLCBAJGZp bGVzOwogICB9Cn0KCnN1YiBzY2FuIHsKICAgbXkgKCRwYXRoKSA9IEBfOwoKICAgJHBhdGgg Lj0gIi8iOwoKICAgSU86OkFJTzo6cG9sbF9jYjsKCiAgIGlmICgkb3B0X3Byb2dyZXNzIGFu ZCAkbl9sYXN0ICsgMSA8IFRpbWU6OkhpUmVzOjp0aW1lKSB7CiAgICAgICRuX2xhc3QgPSBU aW1lOjpIaVJlczo6dGltZTsKICAgICAgbXkgJGQgPSAkbl9sYXN0IC0gJG5fc3RhcnQ7CiAg ICAgIHByaW50ZiBTVERFUlIgIlxyJWQgZGlycyAoJWcvcykgJWQgZmlsZXMgKCVnL3MpICVk IHN0YXRzICglZy9zKSAgICAgICAiLAogICAgICAgICAgICAgJG5fZGlycywgJG5fZGlycyAv ICRkLAogICAgICAgICAgICAgJG5fZmlsZXMsICRuX2ZpbGVzIC8gJGQsCiAgICAgICAgICAg ICAkbl9zdGF0cywgJG5fc3RhdHMgLyAkZAogICAgICAgICBpZiAkb3B0X3Byb2dyZXNzOwog ICB9CgogICBhaW9yZXFfcHJpICgtMSk7CiAgICsrJG5fZGlyczsKICAgYWlvX3NjYW5kaXIg JHBhdGgsIDgsIHN1YiB7CiAgICAgIG15ICgkZGlycywgJGZpbGVzKSA9IEBfCiAgICAgICAg IG9yIHdhcm4gIiRwYXRoOiAkIVxuIjsKCiAgICAgIHByaW50Zm4gIiIsIFskcGF0aF0gICB1 bmxlc3MgJG9wdF9ub2RpcnM7CiAgICAgIHByaW50Zm4gJHBhdGgsICRmaWxlcyB1bmxlc3Mg JG9wdF9ub2ZpbGVzOwoKICAgICAgJG5fZmlsZXMgKz0gQCRmaWxlczsKCiAgICAgIGlmICgk b3B0X3N0YXQpIHsKICAgICAgICAgYWlvX3dkICRwYXRoLCBzdWIgewogICAgICAgICAgICBt eSAkd2QgPSBzaGlmdDsKCiAgICAgICAgICAgIGFpb19sc3RhdCBbJHdkLCAkX10gZm9yIEAk ZmlsZXM7CiAgICAgICAgICAgICRuX3N0YXRzICs9IEAkZmlsZXM7CiAgICAgICAgIH07CiAg ICAgIH0KCiAgICAgICZzY2FuICgiJHBhdGgkXyIpIGZvciBAJGRpcnM7CiAgIH07Cn0KCklP OjpBSU86Om1heF9vdXRzdGFuZGluZyAxMDA7ICMgdHdvIGZkcyBwZXIgZGlyZWN0b3J5LCBz byBsaW1pdCBhY2NvcmRpbmdseQpJTzo6QUlPOjptaW5fcGFyYWxsZWwgMjA7Cgpmb3IgbXkg JHNlZWQgKEBBUkdWKSB7CiAgICRzZWVkID1+IHMvXC8rJC8vOwogICBhaW9fbHN0YXQgIiRz ZWVkLy4iLCBzdWIgewogICAgICBpZiAoJF9bMF0pIHsKICAgICAgICAgcHJpbnQgU1RERVJS ICIkc2VlZDogJCFcbiI7CiAgICAgIH0gZWxzaWYgKC1kIF8pIHsKICAgICAgICAgc2NhbiAk c2VlZDsKICAgICAgfSBlbHNlIHsKICAgICAgICAgcHJpbnRmbiAiIiwgJHNlZWQsICIvIjsK ICAgICAgfQogICB9Owp9CgpJTzo6QUlPOjpmbHVzaDsKCg== --------------070300040906000104090409-- From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 02 21:37:54 2015 Received: (at 21084) by debbugs.gnu.org; 3 Aug 2015 01:37:54 +0000 Received: from localhost ([127.0.0.1]:37597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZM4hO-0006Bi-91 for submit@debbugs.gnu.org; Sun, 02 Aug 2015 21:37:54 -0400 Received: from ishtar.tlinx.org ([173.164.175.65]:53316 helo=Ishtar.hs.tlinx.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZM4hM-0006Ba-Dc for 21084@debbugs.gnu.org; Sun, 02 Aug 2015 21:37:52 -0400 Received: from [192.168.4.12] (Athenae [192.168.4.12]) by Ishtar.hs.tlinx.org (8.14.9/8.14.4/SuSE Linux 0.8) with ESMTP id t731bhrk021883; Sun, 2 Aug 2015 18:37:45 -0700 Message-ID: <55BEC5E7.7070805@tlinx.org> Date: Sun, 02 Aug 2015 18:37:43 -0700 From: Linda Walsh User-Agent: Thunderbird MIME-Version: 1.0 To: Paul Eggert Subject: Re: bug#21084: rm appears to no longer be POSIX compliant (as of 2013 edition) re: deleting empty dirs and files under /. References: <55AA0682.2000408@tlinx.org> <55AACEF7.4010500@tlinx.org> <55BC0B46.1020009@tlinx.org> <55BC210C.1000203@cs.ucla.edu> <55BC3950.3020204@tlinx.org> <55BD3755.2040803@bernhard-voelker.de> <55BDCE7D.7080107@tlinx.org> <55BDD18B.80106@cs.ucla.edu> In-Reply-To: <55BDD18B.80106@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: 21084 Cc: Bernhard Voelker , Andreas Schwab , 21084@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.1 (/) Paul Eggert wrote: > Linda Walsh wrote: >> find, by itself, has no way to remove all of the items under a >> tree even if you own them all. > > That's not a problem. Have 'find' call 'rm'. Something like this, say: > > find . ! -name . -prune -exec rm -fr {} + > > So there's no need to change 'rm'. ---- Bernard is worried about performance. Do you know how long it would take for find to call rm? a half-a-million times? Um.... > time rm -fr . 183.23sec 0.69usr 36.25sys (20.16% cpu) > time find . ! -name . -prune -exec rm -fr {} + 219.58sec 0.87usr 40.81sys (18.98% cpu) -- about 36 seconds (~20%) longer So you've already slowed things down -- and those times were just for my home directory...! (non-critical data was used for these tests (copies of my home directory that existed on different partitions)) But you also didn't address points (3), (4) or (5).. -.5 From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 03 01:23:51 2015 Received: (at 21084) by debbugs.gnu.org; 3 Aug 2015 05:23:51 +0000 Received: from localhost ([127.0.0.1]:37695 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZM8E2-0004lO-N2 for submit@debbugs.gnu.org; Mon, 03 Aug 2015 01:23:50 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:49635) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZM8E0-0004lF-A5 for 21084@debbugs.gnu.org; Mon, 03 Aug 2015 01:23:49 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 59E51160506; Sun, 2 Aug 2015 22:23:47 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id RBHR23MUWIKI; Sun, 2 Aug 2015 22:23:46 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 9DB32160869; Sun, 2 Aug 2015 22:23:46 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Dwdf27YTeutg; Sun, 2 Aug 2015 22:23:46 -0700 (PDT) Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 76138160506; Sun, 2 Aug 2015 22:23:46 -0700 (PDT) Message-ID: <55BEFAE2.2000605@cs.ucla.edu> Date: Sun, 02 Aug 2015 22:23:46 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Linda Walsh Subject: Re: bug#21084: rm appears to no longer be POSIX compliant (as of 2013 edition) re: deleting empty dirs and files under /. References: <55AA0682.2000408@tlinx.org> <55AACEF7.4010500@tlinx.org> <55BC0B46.1020009@tlinx.org> <55BC210C.1000203@cs.ucla.edu> <55BC3950.3020204@tlinx.org> <55BD3755.2040803@bernhard-voelker.de> <55BDCE7D.7080107@tlinx.org> <55BDD18B.80106@cs.ucla.edu> <55BEC5E7.7070805@tlinx.org> In-Reply-To: <55BEC5E7.7070805@tlinx.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: 21084 Cc: 21084@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.1 (/) Linda Walsh wrote: > >> time rm -fr . > 183.23sec 0.69usr 36.25sys (20.16% cpu) >> time find . ! -name . -prune -exec rm -fr {} + > 219.58sec 0.87usr 40.81sys (18.98% cpu) -- about 36 seconds (~20%) longer Benchmarks like this are often suspect since a lot of it depends on factors that are hard to reproduce. That being said, when I tried a similar benchmark on my machine, the 'find' solution was over 30% faster. In any event the minor performance improvements we're talking about would not be a compelling argument for adding UI complexity to 'rm', even if the 'rm' approach was uniformly faster > But you also didn't address points (3), (4) or (5).. They aren't a problem either. As I mentioned, the "find" approach conforms to POSIX and so is quite portable; that covers (3). If you don't want to cross file system boundaries, add the POSIX-required -xdev option to 'find' and the GNU extension --one-file-system argument to 'rm'; that covers (4). And the example already uses rm's -f option; that covers (5). From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 03 01:38:40 2015 Received: (at 21084) by debbugs.gnu.org; 3 Aug 2015 05:38:41 +0000 Received: from localhost ([127.0.0.1]:37699 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZM8SO-0005AH-Fb for submit@debbugs.gnu.org; Mon, 03 Aug 2015 01:38:40 -0400 Received: from ishtar.tlinx.org ([173.164.175.65]:39761 helo=Ishtar.hs.tlinx.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZM8SL-0005A8-F0 for 21084@debbugs.gnu.org; Mon, 03 Aug 2015 01:38:38 -0400 Received: from [192.168.4.12] (Athenae [192.168.4.12]) by Ishtar.hs.tlinx.org (8.14.9/8.14.4/SuSE Linux 0.8) with ESMTP id t735cI6r048068; Sun, 2 Aug 2015 22:38:21 -0700 Message-ID: <55BEFE4A.3080703@tlinx.org> Date: Sun, 02 Aug 2015 22:38:18 -0700 From: Linda Walsh User-Agent: Thunderbird MIME-Version: 1.0 To: Paul Eggert Subject: Re: bug#21084: rm appears to no longer be POSIX compliant (as of 2013 edition) re: deleting empty dirs and files under /. References: <55AA0682.2000408@tlinx.org> <55AACEF7.4010500@tlinx.org> <55BC0B46.1020009@tlinx.org> <55BC210C.1000203@cs.ucla.edu> <55BC3950.3020204@tlinx.org> <55BD3755.2040803@bernhard-voelker.de> <55BDCE7D.7080107@tlinx.org> <55BDD18B.80106@cs.ucla.edu> In-Reply-To: <55BDD18B.80106@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: 21084 Cc: Bernhard Voelker , Andreas Schwab , 21084@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.1 (/) Paul Eggert wrote: > Linda Walsh wrote: >> find, by itself, has no way to remove all of the items under a >> tree even if you own them all. > > That's not a problem. Have 'find' call 'rm'. Something like this, say: > > find . ! -name . -prune -exec rm -fr {} + > > So there's no need to change 'rm'. ---- Actually, I was thinking about this -- if adding a switch to provide the original behavior it had for 20+ years is so stressful to you guys, then really, you should revert the change -- think about it -- it would *simplify* the code -- which means Bernard should be happy as it would imply less bloat. for those who wanted protection, they could have **easily** put a shell wrapper-function around 'rm' to provide that functionality -- there was no need to change rm -- the code they added breaks the original behavior and and, Bernhard, has already opened a can of worms, cornder cases, races and a sizable performance penalty. All they things that you accuse function restoration of have already been done. I assert that this change make problems MORE likely to happen as they try the easiest workarounds they can find. In my 26 years of unix-related experience, not once have I heard of anyone accidentally doing rm -fr dir/. by accident. You say hardly anybody cares for the corner case -- that was because no the problem it is solving is one that was hardly ever a problem. How about this: (not my favorite beverage), BUT switch the code to allow the above (dir/.) but not a lone ".". I'd leave the .. restriction in for dir/.. and .., since there is no legitimate use for it: just delete 'dir'. But there is a legitimate use to use "dir/." -- since it let the users avoid the bug of using '*' and deleting multiple file systems while they thought that "one-file-system" meant "1 file system[period]", not 1 filesystem per command line argument. That's just a lame definition that someone thought up justify the new bug that was being introduced. So if any of you are serious about making the tools more robust and less prone accidents -- especially if you only enable "." if it is preceeded by a directory component (not likely to be typed by accident, but useful to keep things on 1 device), while using a lone ".", I could see as being as easily mistyped as the rm -fr / as the two are right next to each other. Oh, in addition to that, I *am* asking for compatibility in "-x" being the short version of "--one-file-system" ('cp', 'rsync', 'find' (though find make it short for --xdev -- it still uses -x as the short form). I hope you don't have your eyes shut so tight that you can't see that the removal of dir/. has brought about needs for workarounds with the easiest one using shell expansion. You realize with bash shell expansion and globstar turned on, the "one-file-system" switch is useless. Not allowing dir/. breaks --onefs" in all cases as rm -fr ** would list all files on the cmd line (hadn't thought of that till just now, this is not a corner case, as ** will list all the files and directories on the command line. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 03 02:09:18 2015 Received: (at 21084) by debbugs.gnu.org; 3 Aug 2015 06:09:18 +0000 Received: from localhost ([127.0.0.1]:37707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZM8w1-0005uw-8d for submit@debbugs.gnu.org; Mon, 03 Aug 2015 02:09:17 -0400 Received: from ishtar.tlinx.org ([173.164.175.65]:40816 helo=Ishtar.hs.tlinx.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZM8vz-0005uo-1g for 21084@debbugs.gnu.org; Mon, 03 Aug 2015 02:09:15 -0400 Received: from [192.168.4.12] (Athenae [192.168.4.12]) by Ishtar.hs.tlinx.org (8.14.9/8.14.4/SuSE Linux 0.8) with ESMTP id t7369AcY052235; Sun, 2 Aug 2015 23:09:12 -0700 Message-ID: <55BF0586.3030707@tlinx.org> Date: Sun, 02 Aug 2015 23:09:10 -0700 From: Linda Walsh User-Agent: Thunderbird MIME-Version: 1.0 To: Paul Eggert Subject: Re: bug#21084: rm appears to no longer be POSIX compliant (as of 2013 edition) re: deleting empty dirs and files under /. References: <55AA0682.2000408@tlinx.org> <55AACEF7.4010500@tlinx.org> <55BC0B46.1020009@tlinx.org> <55BC210C.1000203@cs.ucla.edu> <55BC3950.3020204@tlinx.org> <55BD3755.2040803@bernhard-voelker.de> <55BDCE7D.7080107@tlinx.org> <55BDD18B.80106@cs.ucla.edu> <55BEC5E7.7070805@tlinx.org> <55BEFAE2.2000605@cs.ucla.edu> In-Reply-To: <55BEFAE2.2000605@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: 21084 Cc: 21084@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.1 (/) Paul Eggert wrote: > Linda Walsh wrote: >> >>> time rm -fr . >> 183.23sec 0.69usr 36.25sys (20.16% cpu) >>> time find . ! -name . -prune -exec rm -fr {} + >> 219.58sec 0.87usr 40.81sys (18.98% cpu) -- about 36 seconds (~20%) longer > > Benchmarks like this are often suspect since a lot of it depends on > factors that are hard to reproduce. That being said, when I tried a > similar benchmark on my machine, the 'find' solution was over 30% --- Did you run them on separate partitions over the same file-structure? Neither rm nor find had a hot or even warm cache, as I mounted the file systems just for this test. You can use the same partitions/files, if you use dropcaches: #!/bin/bash function dropcaches () { echo -n "3"|sudo dd status=none of=/proc/sys/vm/drop_caches } #if [[ ${BASH_LINE[@]} == 0 ]]; then time dropcaches #fi ------------- If you run it, it runs the function then, if you source it, you'd have to insert 'time' manually later --- which I usually do, as I like to know how long things take. Have had it take as long as over 60 seconds on my system, though more often under 10. > faster. In any event the minor performance improvements we're talking > about would not be a compelling argument for adding UI complexity to > 'rm', even if the 'rm' approach was uniformly faster --- I was addressing Bernhard's explicitly stated concerns. They were not my concerns. > >> But you also didn't address points (3), (4) or (5).. > > They aren't a problem either. As I mentioned, the "find" approach > conforms to POSIX and so is quite portable; that covers (3). --- You can't believe that. People with older systems don't always keep upto-date with the latest versions -- and likely wrote most of their maint-scripts under the original POSIX charter. They won't know until they are bitten and complain alot louder than I'm comfortable with. It doesn't solve '4', since it's about users wanting similar behaviors not only in other packages, but within the same package. It's a broken wart that is not restricted in other utils -- and causes you to have to defend "one-file-system" no longer being usable because the users should have known. It would handle (5), _probably_. But allowing dir/. would not cause the same problems a complete ban has, nor is it a likely candidate for abuse or accident. Can you think of anything I've suggested that you've been supportive on, yet I know I From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 03 02:29:10 2015 Received: (at 21084) by debbugs.gnu.org; 3 Aug 2015 06:29:10 +0000 Received: from localhost ([127.0.0.1]:37720 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZM9FG-0006Oi-6c for submit@debbugs.gnu.org; Mon, 03 Aug 2015 02:29:10 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:50867) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZM9FC-0006OY-Vd for 21084@debbugs.gnu.org; Mon, 03 Aug 2015 02:29:07 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id C4702160193; Sun, 2 Aug 2015 23:29:05 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id RwqxYHdIYg0e; Sun, 2 Aug 2015 23:29:05 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 1F6FC1601AA; Sun, 2 Aug 2015 23:29:05 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id KtBJjobYdchp; Sun, 2 Aug 2015 23:29:05 -0700 (PDT) Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id F2540160193; Sun, 2 Aug 2015 23:29:04 -0700 (PDT) Message-ID: <55BF0A30.7000701@cs.ucla.edu> Date: Sun, 02 Aug 2015 23:29:04 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Linda Walsh Subject: Re: bug#21084: rm appears to no longer be POSIX compliant (as of 2013 edition) re: deleting empty dirs and files under /. References: <55AA0682.2000408@tlinx.org> <55AACEF7.4010500@tlinx.org> <55BC0B46.1020009@tlinx.org> <55BC210C.1000203@cs.ucla.edu> <55BC3950.3020204@tlinx.org> <55BD3755.2040803@bernhard-voelker.de> <55BDCE7D.7080107@tlinx.org> <55BDD18B.80106@cs.ucla.edu> <55BEC5E7.7070805@tlinx.org> <55BEFAE2.2000605@cs.ucla.edu> <55BF0586.3030707@tlinx.org> In-Reply-To: <55BF0586.3030707@tlinx.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: 21084 Cc: 21084@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.1 (/) Linda Walsh wrote: > People with older systems don't always keep upto-date with the latest versions People that don't keep up-to-date can't rely on any changes that we would make to 'rm'. Besides, we don't care about SVR4 systems so old that they're no longer supported. I ran my little test on the same file system. I'm afraid I'm not persuaded. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 03 15:40:19 2015 Received: (at 21084) by debbugs.gnu.org; 3 Aug 2015 19:40:19 +0000 Received: from localhost ([127.0.0.1]:38622 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZMLas-0003eh-Ou for submit@debbugs.gnu.org; Mon, 03 Aug 2015 15:40:19 -0400 Received: from ishtar.tlinx.org ([173.164.175.65]:33083 helo=Ishtar.hs.tlinx.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZMLap-0003eY-TF for 21084@debbugs.gnu.org; Mon, 03 Aug 2015 15:40:17 -0400 Received: from [192.168.4.12] (Athenae [192.168.4.12]) by Ishtar.hs.tlinx.org (8.14.9/8.14.4/SuSE Linux 0.8) with ESMTP id t73Je4OC079504; Mon, 3 Aug 2015 12:40:06 -0700 Message-ID: <55BFC394.9000908@tlinx.org> Date: Mon, 03 Aug 2015 12:40:04 -0700 From: Linda Walsh User-Agent: Thunderbird MIME-Version: 1.0 To: Paul Eggert Subject: Re: bug#21084: rm appears to no longer be POSIX compliant (as of 2013 edition) re: deleting empty dirs and files under /. References: <55AA0682.2000408@tlinx.org> <55AACEF7.4010500@tlinx.org> <55BC0B46.1020009@tlinx.org> <55BC210C.1000203@cs.ucla.edu> <55BC3950.3020204@tlinx.org> <55BD3755.2040803@bernhard-voelker.de> <55BDCE7D.7080107@tlinx.org> <55BDD18B.80106@cs.ucla.edu> <55BEC5E7.7070805@tlinx.org> <55BEFAE2.2000605@cs.ucla.edu> In-Reply-To: <55BEFAE2.2000605@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.2 (/) X-Debbugs-Envelope-To: 21084 Cc: 21084@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.2 (/) Paul Eggert wrote: > Linda Walsh wrote: >> >>> time rm -fr . >> 183.23sec 0.69usr 36.25sys (20.16% cpu) >>> time find . ! -name . -prune -exec rm -fr {} + >> 219.58sec 0.87usr 40.81sys (18.98% cpu) -- about 36 seconds (~20%) longer > > Benchmarks like this are often suspect since a lot of it depends on > factors that are hard to reproduce. That being said, when I tried a > similar benchmark on my machine, the 'find' solution was over 30% > faster. --- Nearly impossible except for leaving out that that find DOES have some multi-cpu capability in it's system scan, If rm had the same, then the addition of 500,000+ calls to an external process can't take 'zero time'. In any event the minor performance improvements we're talking > about would not be a compelling argument for adding UI complexity to > 'rm', even if the 'rm' approach was uniformly faster > >> But you also didn't address points (3), (4) or (5).. > > They aren't a problem either. As I mentioned, the "find" approach > conforms to POSIX and so is quite portable; that covers (3). ---- You claim it adheres to POSIX, but there is no single POSIX -- what version are talking about, as the version of POSIX from 2003 or earlier wouldn't have problems. POSIX was supposed to describe what was actually implemented in the systems out there so people could move to a common base to provide API compatibility. Adding descriptions of the base commands and the arguments supported was to help write shell scripts that would be portable. Removing functionality in a backwards incompatible way is anything but "helping portability". (3) is not maintained. > If you > don't want to cross file system boundaries, add the POSIX-required -xdev > option to 'find' and the GNU extension --one-file-system argument to > 'rm'; that covers (4). ---- Not really -- we are talking about the 'rm' command. Not rewriting scripts and humans to use new commands. Answer this: How does disabling functionality make something more portable? Gnu coreutils have tons of things that enable new functionality, that are not portable unless you assume all platforms will have the new functionality. But **removing** capabilities from programs can never provide backwards compat -- rm -fr dir/. was there for 30 years, and now you think removing that feature makes it portable? I'm sorry, your logic is not logical. If you want to use the safety reason as an overriding reason then I can see banning . .. and / (even though gnu went for a workaround on /. But safety wouldn't be an excuse for removing rm -fr "this_is_a_dir/.". I've never even heard of '.' being aproblem and it is supported in the rest of coreutils (except rmdir -- where dirname_this_is/. should also be allowed. > People that don't keep up-to-date can't rely on any changes that we > would make to 'rm'. I keep up-to-date -- that's why it bit me. But I still haven't upgraded my perl beyond 5.16 because too many of my script break due to them installing or removing various supported featers. I'm still working on that -- but it's alot of scripts. > I ran my little test on the same file system. Did you at least drop the caches between runs (i.e.) by echoing '3' to /proc/sys/vm/drop_caches? > I'm afraid I'm not persuaded. You really think when people find they can't do: > cp -axf /usr/. /usr2/. #... no wanted that in /usr3 > mkdir /usr3 && cp -alxf /usr2/. /usr3/. ... ESPACE...! > rm -fxr /usr2/. /usr3/. ## except this will fail... > cp -axf /usr/. /usr3/. They'll instantly think of find? -- Where else besides rmdir is dir/. banned? From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 03 16:45:36 2015 Received: (at 21084) by debbugs.gnu.org; 3 Aug 2015 20:45:36 +0000 Received: from localhost ([127.0.0.1]:38652 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZMMc4-00059x-IQ for submit@debbugs.gnu.org; Mon, 03 Aug 2015 16:45:36 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:47879) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZMMc1-00059k-JV for 21084@debbugs.gnu.org; Mon, 03 Aug 2015 16:45:34 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 975F91601A7; Mon, 3 Aug 2015 13:45:32 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id H-m8mOHVPtBP; Mon, 3 Aug 2015 13:45:31 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id DFA761601E9; Mon, 3 Aug 2015 13:45:31 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id KYbEF-rC-0hH; Mon, 3 Aug 2015 13:45:31 -0700 (PDT) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id C399A1601A7; Mon, 3 Aug 2015 13:45:31 -0700 (PDT) Subject: Re: bug#21084: rm appears to no longer be POSIX compliant (as of 2013 edition) re: deleting empty dirs and files under /. To: Linda Walsh References: <55AA0682.2000408@tlinx.org> <55AACEF7.4010500@tlinx.org> <55BC0B46.1020009@tlinx.org> <55BC210C.1000203@cs.ucla.edu> <55BC3950.3020204@tlinx.org> <55BD3755.2040803@bernhard-voelker.de> <55BDCE7D.7080107@tlinx.org> <55BDD18B.80106@cs.ucla.edu> <55BEC5E7.7070805@tlinx.org> <55BEFAE2.2000605@cs.ucla.edu> <55BFC394.9000908@tlinx.org> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <55BFD2E8.7060102@cs.ucla.edu> Date: Mon, 3 Aug 2015 13:45:28 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <55BFC394.9000908@tlinx.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.2 (/) X-Debbugs-Envelope-To: 21084 Cc: 21084@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.2 (/) On 08/03/2015 12:40 PM, Linda Walsh wrote: > there is no single POSIX -- > what version are talking about The current version, POSIX.1-2013. The code also works in POSIX.1-2004. At this point older POSIX releases are mostly just historical curiosities; application developers shouldn't need to worry about them. > Did you at least drop the caches between runs (i.e.) > by echoing '3' to /proc/sys/vm/drop_caches? No, I didn't mess with the caches. I'm reasonably sure everything was cached. From unknown Sun Jun 22 22:48:17 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 01 Sep 2015 11:24:03 +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