GNU bug report logs - #8484
24.0.50; Dired problems with marking and hidden subdirs

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Stephen Berman <stephen.berman@HIDDEN>; merged with #23454; dated Tue, 12 Apr 2011 12:00:04 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Merged 8484 23454. Request was from Glenn Morris <rgm@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 8484 <at> debbugs.gnu.org:


Received: (at 8484) by debbugs.gnu.org; 22 Jan 2016 20:55:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 22 15:55:36 2016
Received: from localhost ([127.0.0.1]:58122 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1aMik4-00081Q-Ad
	for submit <at> debbugs.gnu.org; Fri, 22 Jan 2016 15:55:36 -0500
Received: from mail.mojserwer.eu ([195.110.48.8]:55429)
 by debbugs.gnu.org with esmtp (Exim 4.84)
 (envelope-from <mbork@HIDDEN>) id 1aMik2-00081I-G2
 for 8484 <at> debbugs.gnu.org; Fri, 22 Jan 2016 15:55:35 -0500
Received: from localhost (localhost [127.0.0.1])
 by mail.mojserwer.eu (Postfix) with ESMTP id 6D115893489;
 Fri, 22 Jan 2016 21:55:31 +0100 (CET)
X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu
Received: from mail.mojserwer.eu ([127.0.0.1])
 by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id YrI+Vewb31mt; Fri, 22 Jan 2016 21:55:25 +0100 (CET)
Received: from localhost (unknown [109.232.24.28])
 by mail.mojserwer.eu (Postfix) with ESMTPSA id 51DE6893487;
 Fri, 22 Jan 2016 21:55:25 +0100 (CET)
From: Marcin Borkowski <mbork@HIDDEN>
To: Stephen Berman <stephen.berman@HIDDEN>
Subject: Re: bug#8484: 24.0.50; Dired problems with marking and hidden subdirs
References: <87k4ez8yva.fsf@HIDDEN>
Date: Fri, 22 Jan 2016 21:55:21 +0100
In-Reply-To: <87k4ez8yva.fsf@HIDDEN> (Stephen Berman's message of
 "Tue, 12 Apr 2011 13:58:49 +0200")
Message-ID: <87y4bh72rq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 8484
Cc: 8484 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

Hello,

I'm writing to confirm that I can reproduce this under GNU Emacs
25.1.50.1.

Best,
Marcin Borkowski


On 2011-04-12, at 14:58, Stephen Berman <stephen.berman@HIDDEN> wrote:

> 1. emacs -Q
> 2. Create a directory containing a non-empty directory,
>    e.g. "~/test/test0/test1". 
> 3. Visit "test" in Dired: `C-x d ~/test RET'
> 4. Put point on "test0" and type `i' to insert the subdirectory.
> 5. With point within the inserted subdirectory type `$' to hide it.
> 6. Type `% m RET' to mark all files except "." and "..".  This is what
>    buffer "test" now looks like:
>
>      /home/steve/test:
>      total used in directory 12 available 24083132
>      drwxr-xr-x 3 steve users 4096 2011-04-12 09:22 .
>      drwxr-xr-x 6 steve users 4096 2011-04-12 09:20 ..
>    * drwxr-xr-x 3 steve users 4096 2011-04-12 09:23 test0
>    
>    * /home/steve/test/test0:...
>
> 7. Try to operate on the marked files, e.g. `C', `R', 'D' etc.
> => Instead of the operation being executed, you get the message "Cannot
> operate on `.' or `..'".
> 8. Now type `$' on the hidden subdirectory to unhide it.  The two marked
>    lines remain marked.  Then repeat step 7.
> => Regardless of where point is, you get this error: "No file on this line"
>
> I believe these problems are due to the hidden subdirectory being a
> single line, since selective display replaces "\n" with "\r".  In the
> first case, when dired-mark-if is called in dired-mark-files-regexp,
> with point at the beginning of the hidden subdirectory, (looking-at
> dired-re-dot) is nil but dired-get-filename finds "." inside "test0",
> and this triggers the error message.  In the second case, when
> dired-move-to-filename is called in dired-map-over-marks with point on
> the subdirectory, it fails and raises the error.
>
> I see two directions to go for fixing this: (a) temporarily unhide the
> subdirectory (probably iteratively) and then mark as usual, so that the
> dired-re-dot filter succeeds; (b) prevent any marking of (and hence
> within) hidden subdirectories.  It seems that the latter is more
> consistent with current Dired behavior: if you remove the marks from
> "test" above, then unhide "test0", then type `% m RET', so that now
> "test0" and "test1" are marked, then hide "test0" again, then invoke an
> operation, e.g. `C', `R', 'D' etc. -- only "test0" gets operated on, not
> "test1".  That is, the marked file in the hidden subdirectory is
> ignored.  So marking the hidden subdirectory in step 6 above is the real
> bug, given current Dired behavior.  One way to fix this is the below
> patch to dired-get-filename: this checks whether the current line is a
> hidden subdirectory and if so, unhides it, so that it isn't just a
> single line and the line does not get marked, then after
> dired-move-to-filename fails, hides it again, shortcutting any further
> marking.
>
> In GNU Emacs 24.0.50.1 (i686-suse-linux-gnu, GTK+ Version 2.20.1)
>  of 2011-04-03 on escher
> Windowing system distributor `The X.Org Foundation', version 11.0.10800000
> configured using `configure  '--without-toolkit-scroll-bars' 'CFLAGS=-g -O2 -fno-optimize-sibling-calls''
>
> Important settings:
>   value of $LC_ALL: nil
>   value of $LC_COLLATE: nil
>   value of $LC_CTYPE: nil
>   value of $LC_MESSAGES: nil
>   value of $LC_MONETARY: nil
>   value of $LC_NUMERIC: nil
>   value of $LC_TIME: nil
>   value of $LANG: en_US.UTF-8
>   value of $XMODIFIERS: @im=local
>   locale-coding-system: utf-8-unix
>   default enable-multibyte-characters: t
>
>
> *** /data/steve/bzr/emacs/trunk/lisp/dired.el	2011-04-03 16:10:27.000000000 +0200
> --- /data/steve/bzr/emacs/quickfixes/lisp/dired.el	2011-04-12 12:48:02.000000000 +0200
> ***************
> *** 2049,2058 ****
>   Optional arg NO-ERROR-IF-NOT-FILEP means treat `.' and `..' as
>   regular filenames and return nil if no filename on this line.
>   Otherwise, an error occurs in these cases."
> !   (let (case-fold-search file p1 p2 already-absolute)
>       (save-excursion
>         (if (setq p1 (dired-move-to-filename (not no-error-if-not-filep)))
>   	  (setq p2 (dired-move-to-end-of-filename no-error-if-not-filep))))
>       ;; nil if no file on this line, but no-error-if-not-filep is t:
>       (if (setq file (and p1 p2 (buffer-substring p1 p2)))
>   	(progn
> --- 2049,2061 ----
>   Optional arg NO-ERROR-IF-NOT-FILEP means treat `.' and `..' as
>   regular filenames and return nil if no filename on this line.
>   Otherwise, an error occurs in these cases."
> !   (let ((hidden (dired-subdir-hidden-p (dired-current-directory)))
> ! 	case-fold-search file p1 p2 already-absolute)
> !     (if hidden (dired-unhide-subdir))
>       (save-excursion
>         (if (setq p1 (dired-move-to-filename (not no-error-if-not-filep)))
>   	  (setq p2 (dired-move-to-end-of-filename no-error-if-not-filep))))
> +     (if hidden (dired-hide-subdir 1))
>       ;; nil if no file on this line, but no-error-if-not-filep is t:
>       (if (setq file (and p1 p2 (buffer-substring p1 p2)))
>   	(progn




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#8484; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 12 Apr 2011 11:59:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 12 07:59:20 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Q9cFb-0005Aa-OR
	for submit <at> debbugs.gnu.org; Tue, 12 Apr 2011 07:59:20 -0400
Received: from eggs.gnu.org ([140.186.70.92])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <stephen.berman@HIDDEN>) id 1Q9cFZ-0005AM-Cu
	for submit <at> debbugs.gnu.org; Tue, 12 Apr 2011 07:59:18 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <stephen.berman@HIDDEN>) id 1Q9cFT-0002tg-4U
	for submit <at> debbugs.gnu.org; Tue, 12 Apr 2011 07:59:12 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL
	autolearn=unavailable version=3.3.1
Received: from [140.186.70.17] (port=60304 helo=lists.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <stephen.berman@HIDDEN>) id 1Q9cFT-0002tc-2y
	for submit <at> debbugs.gnu.org; Tue, 12 Apr 2011 07:59:11 -0400
Received: from eggs.gnu.org ([140.186.70.92]:35456)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <stephen.berman@HIDDEN>) id 1Q9cFS-0005Wf-20
	for bug-gnu-emacs@HIDDEN; Tue, 12 Apr 2011 07:59:11 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <stephen.berman@HIDDEN>) id 1Q9cFQ-0002t6-Ie
	for bug-gnu-emacs@HIDDEN; Tue, 12 Apr 2011 07:59:10 -0400
Received: from mailout-de.gmx.net ([213.165.64.22]:38353)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <stephen.berman@HIDDEN>) id 1Q9cFP-0002rB-N4
	for bug-gnu-emacs@HIDDEN; Tue, 12 Apr 2011 07:59:08 -0400
Received: (qmail invoked by alias); 12 Apr 2011 11:58:52 -0000
Received: from i59F56D7F.versanet.de (EHLO escher.home) [89.245.109.127]
	by mail.gmx.net (mp022) with SMTP; 12 Apr 2011 13:58:52 +0200
X-Authenticated: #20778731
X-Provags-ID: V01U2FsdGVkX1+TIAEei2WTrLcTbQO8+Lm+QPRi4SAxtz1WWhHXHg
	87BDTvOu00djox
Received: by escher.home (Postfix, from userid 1000)
	id 042F263902; Tue, 12 Apr 2011 13:58:49 +0200 (CEST)
From: Stephen Berman <stephen.berman@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 24.0.50; Dired problems with marking and hidden subdirs
Date: Tue, 12 Apr 2011 13:58:49 +0200
Message-ID: <87k4ez8yva.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Y-GMX-Trusted: 0
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 140.186.70.17
X-Spam-Score: -4.6 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -4.6 (----)

1. emacs -Q
2. Create a directory containing a non-empty directory,
   e.g. "~/test/test0/test1". 
3. Visit "test" in Dired: `C-x d ~/test RET'
4. Put point on "test0" and type `i' to insert the subdirectory.
5. With point within the inserted subdirectory type `$' to hide it.
6. Type `% m RET' to mark all files except "." and "..".  This is what
   buffer "test" now looks like:

     /home/steve/test:
     total used in directory 12 available 24083132
     drwxr-xr-x 3 steve users 4096 2011-04-12 09:22 .
     drwxr-xr-x 6 steve users 4096 2011-04-12 09:20 ..
   * drwxr-xr-x 3 steve users 4096 2011-04-12 09:23 test0
   
   * /home/steve/test/test0:...

7. Try to operate on the marked files, e.g. `C', `R', 'D' etc.
=> Instead of the operation being executed, you get the message "Cannot
operate on `.' or `..'".
8. Now type `$' on the hidden subdirectory to unhide it.  The two marked
   lines remain marked.  Then repeat step 7.
=> Regardless of where point is, you get this error: "No file on this line"

I believe these problems are due to the hidden subdirectory being a
single line, since selective display replaces "\n" with "\r".  In the
first case, when dired-mark-if is called in dired-mark-files-regexp,
with point at the beginning of the hidden subdirectory, (looking-at
dired-re-dot) is nil but dired-get-filename finds "." inside "test0",
and this triggers the error message.  In the second case, when
dired-move-to-filename is called in dired-map-over-marks with point on
the subdirectory, it fails and raises the error.

I see two directions to go for fixing this: (a) temporarily unhide the
subdirectory (probably iteratively) and then mark as usual, so that the
dired-re-dot filter succeeds; (b) prevent any marking of (and hence
within) hidden subdirectories.  It seems that the latter is more
consistent with current Dired behavior: if you remove the marks from
"test" above, then unhide "test0", then type `% m RET', so that now
"test0" and "test1" are marked, then hide "test0" again, then invoke an
operation, e.g. `C', `R', 'D' etc. -- only "test0" gets operated on, not
"test1".  That is, the marked file in the hidden subdirectory is
ignored.  So marking the hidden subdirectory in step 6 above is the real
bug, given current Dired behavior.  One way to fix this is the below
patch to dired-get-filename: this checks whether the current line is a
hidden subdirectory and if so, unhides it, so that it isn't just a
single line and the line does not get marked, then after
dired-move-to-filename fails, hides it again, shortcutting any further
marking.

In GNU Emacs 24.0.50.1 (i686-suse-linux-gnu, GTK+ Version 2.20.1)
 of 2011-04-03 on escher
Windowing system distributor `The X.Org Foundation', version 11.0.10800000
configured using `configure  '--without-toolkit-scroll-bars' 'CFLAGS=-g -O2 -fno-optimize-sibling-calls''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=local
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t


*** /data/steve/bzr/emacs/trunk/lisp/dired.el	2011-04-03 16:10:27.000000000 +0200
--- /data/steve/bzr/emacs/quickfixes/lisp/dired.el	2011-04-12 12:48:02.000000000 +0200
***************
*** 2049,2058 ****
  Optional arg NO-ERROR-IF-NOT-FILEP means treat `.' and `..' as
  regular filenames and return nil if no filename on this line.
  Otherwise, an error occurs in these cases."
!   (let (case-fold-search file p1 p2 already-absolute)
      (save-excursion
        (if (setq p1 (dired-move-to-filename (not no-error-if-not-filep)))
  	  (setq p2 (dired-move-to-end-of-filename no-error-if-not-filep))))
      ;; nil if no file on this line, but no-error-if-not-filep is t:
      (if (setq file (and p1 p2 (buffer-substring p1 p2)))
  	(progn
--- 2049,2061 ----
  Optional arg NO-ERROR-IF-NOT-FILEP means treat `.' and `..' as
  regular filenames and return nil if no filename on this line.
  Otherwise, an error occurs in these cases."
!   (let ((hidden (dired-subdir-hidden-p (dired-current-directory)))
! 	case-fold-search file p1 p2 already-absolute)
!     (if hidden (dired-unhide-subdir))
      (save-excursion
        (if (setq p1 (dired-move-to-filename (not no-error-if-not-filep)))
  	  (setq p2 (dired-move-to-end-of-filename no-error-if-not-filep))))
+     (if hidden (dired-hide-subdir 1))
      ;; nil if no file on this line, but no-error-if-not-filep is t:
      (if (setq file (and p1 p2 (buffer-substring p1 p2)))
  	(progn




Acknowledgement sent to Stephen Berman <stephen.berman@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#8484; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 5 May 2016 23:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.