From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Dired delete(d) the wrong file! Date: Fri, 05 Jul 2024 14:05:18 +0300 Message-ID: <868qyg6qvl.fsf@gnu.org> References: <86r0c875s4.fsf@gnu.org> <86h6d470oh.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3678"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, emacs-devel@gnu.org To: Dave Goel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jul 05 13:06:41 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sPgm1-0000pf-Ma for ged-emacs-devel@m.gmane-mx.org; Fri, 05 Jul 2024 13:06:41 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPgl3-0003EH-7c; Fri, 05 Jul 2024 07:05:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPgl2-0003E2-Ba for emacs-devel@gnu.org; Fri, 05 Jul 2024 07:05:40 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPgl2-0002Wf-1c; Fri, 05 Jul 2024 07:05:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=TUriD4MJN1Xx4bliNnkY0DOT6SOkWM2i9AkfkMF1loQ=; b=ChdznDFXeJnY eEPvDcGQAaxb2Ef/142gKX7iz3BBEFizFbrkXmUyZf+/aewgjGggAqc5FAKWvzOG/pe+TYdksdwLU q87/R9gLeUsovnXQ4enEu+xMqZkl0nGcoQOusLzMrTks83eA0TdNPA3bB4+ypWS+BuzQ2qx3lIjTF J6UtejHIdosrfJpaDcH68q4nCv3XCfytQqcpdmI4oqm69hGFnf/s7wO8GfX3PTdX/Yn/lRU7XIBHZ gcBLVum8RvTZNuXBxfaRKHJeapX6uFG6T8Jy2yhNw7UJ1uOD+TDGz9oZoSycxDb4GgVG2mVDmO/lS F/sxIm3sQlvAELI6yTk0+w==; In-Reply-To: (message from Dave Goel on Fri, 5 Jul 2024 04:39:29 -0400) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:321390 Archived-At: > From: Dave Goel > Date: Fri, 5 Jul 2024 04:39:29 -0400 > Cc: luangruo@yahoo.com, emacs-devel@gnu.org > > > Eli's patch works! > > I still don't understand one thing - > > The problem is now fixed, right? Yes, I think so. > It appears that it's still using a very hacky regexp - see (defvar directory-listing-before-filename-regexp...) > during file deletion. > which does all kinds of hacky checks, guessing where the timestring ends and where the filename begins. > > (A) So, is this still a hack? > (B) Is the problem fixed for good, or can one still concoct edge cases? > (C) If it is fixed, then why does that regex need this massive hack? That regexp is the best heuristic we could come up with that caters to the various formats of date and time that the various versions of 'ls' out there produce. It is true that the regexp can be tricked into mistakes, but we could not find a better solution that supports all the valid use cases. We use the --dired option of 'ls' when available precisely for this reason: to allow Dired to determine the file names reliably. If --dired is not supported, then there will be problems with certain file names, yes. That is a known limitation, so users are encouraged to install GNU Coreutils (which is where GNU 'ls' comes from) to make Dired immune to those problems.