unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: John Cummings <john@rootabega.net>
To: "50630@debbugs.gnu.org" <50630@debbugs.gnu.org>
Subject: bug#50630: Confirmation of instances in ls-lisp.el and tramp-sh.el
Date: Tue, 21 Sep 2021 10:57:53 +0000	[thread overview]
Message-ID: <VWhThBOn_8UbEsqtqwIlHg9d1tagST0xslc7yY7KF-gUPxegkot9mk2aZD8Sj34b7BaUC8jOtRTQvknMvTys7tiZOabPZwSXloAytqBYIAQ=@rootabega.net> (raw)
In-Reply-To: <JBqm7KQ2DJUp-dhplOvmXWA9jYAO3_nq6esSKGU1ESYNcZUg0jrRtN-W6J8LQ9umlAyPYR633evnmi_kWgBuIWC0fSwtNeeJ1eZtbUJRK_Q=@rootabega.net>

[-- Attachment #1: Type: text/plain, Size: 2145 bytes --]

I think I've found all the instances of this bug: files.el (already
fixed) and ls-lisp.el (already identified) and tramp-sh.el. I attached
recipes to reproduce against master @
0646c6817139aa905a2f6079fdc82eb4be944de0.  The preceding libraries are
the 3 implementations of insert-directory I found. From what I can
tell, these are usually expected to be called from dired and
list-directory, the former of which ensures default-directory is set
as expected before calling insert-directory, and the latter of which
does not, which is where this was initially reported.

Testing these in a real scenario doesn't show any other interesting
behaviors.  Invoking via dired always does the correct thing, and
invoking via list-directory, or calling insert-directory directly,
always does the wrong thing (i.e. shows the free space of
default-directory instead of the insert-directory file arg) when the
default-directory does not match the file argument. This is true when
either/both of the insert-directory arg or the default-directory are
standard paths or tramp paths.

I think the fixes for the remaining two libraries are going to be as
simple as the previous fix: pass file-system-info the actual file arg
instead of ".". While ensuring default-directory is set as we want
seems to allow "." to work correctly, I haven't found a concrete
advantage to that over just passing the file arg through. (e.g. some
path expansion that only file-system-info can do.) I'm not very
confident that I understand that space fully, though.

Though the fixes may be simple, the tests for even one of the
libraries would be large enough to require my completed copyright
assignment, which is in progress now. The approach I have working now
is just to stub out file-system-info to simulate returning different
free space for different paths and verifying
list-directory/insert-directory shows the matching free space. Anybody
see any big problems with that or have other suggestions?  I also
don't want to duplicate that test for each of the 3 libraries, but I
haven't found a good way to share test utilities like that yet.

[-- Attachment #2: 50630-recipe.txt --]
[-- Type: text/plain, Size: 2381 bytes --]

Recipes to confirm bug 50630
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=50630

These will show two buffers with a directory listing for the same directory, but with different available space depending on the default-directory when executing.

On Windows, I confirmed the bug using two different drive letters for pwd-a and pwd-b. But my main testing was doing all 3 of these on GNU/Linux. On Windows, ls-lisp will probably always be used unless it's disabled.

for lisp/files.el (already fixed):

emacs -Q --eval "\
(progn \
   (setq pwd-a \"/\") \
   (setq pwd-b \"/proc\")  \
   (setq list-dir \"~\") \
   (with-current-buffer-window \"a\" nil nil \
      (cd pwd-a) \
      (insert-directory list-dir \"-l\" nil t) \
      (insert (format \"listing of %s in cwd %s\" list-dir (pwd)))) \
   (with-current-buffer-window \"b\" nil nil \
      (cd pwd-b) \
      (insert-directory list-dir \"-l\" nil t) \
      (insert (format \"listing of %s in cwd %s\" list-dir (pwd)))) \
   (switch-to-buffer \"a\") \
   (switch-to-buffer-other-window \"b\"))"


for lisp/ls-lisp.el:

emacs -Q --eval "\
(progn \
   (setq pwd-a \"/\") \
   (setq pwd-b \"/proc\")  \
   (setq list-dir \"~\") \
   (require 'ls-lisp) \
   (setq ls-lisp-use-insert-directory-program nil) \
   (with-current-buffer-window \"a\" nil nil \
      (cd pwd-a) \
      (insert-directory list-dir \"-l\" nil t) \
      (insert (format \"listing of %s in cwd %s\" list-dir (pwd)))) \
   (with-current-buffer-window \"b\" nil nil \
      (cd pwd-b) \
      (insert-directory list-dir \"-l\" nil t) \
      (insert (format \"listing of %s in cwd %s\" list-dir (pwd)))) \
   (switch-to-buffer \"a\") \
   (switch-to-buffer-other-window \"b\"))"


for lisp/net/tramp-sh.el:

emacs -Q --eval "\
(progn \
   (setq pwd-a \"/\") \
   (setq pwd-b \"/proc\")  \
   (setq list-dir \"/ssh:emacsdev@localhost:~/\") \
   (require 'tramp) \
   (setq ls-lisp-use-insert-directory-program t) \
   (with-current-buffer-window \"a\" nil nil \
      (cd pwd-a) \
      (insert-directory list-dir \"-l\" nil t) \
      (insert (format \"listing of %s in cwd %s\" list-dir (pwd)))) \
   (with-current-buffer-window \"b\" nil nil \
      (cd pwd-b) \
      (insert-directory list-dir \"-l\" nil t) \
      (insert (format \"listing of %s in cwd %s\" list-dir (pwd)))) \
   (switch-to-buffer \"a\") \
   (switch-to-buffer-other-window \"b\"))"

  parent reply	other threads:[~2021-09-21 10:57 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16 23:00 bug#50630: 28.0.50; list-directory shows free space for current directory, not the specified one John Cummings
2021-09-17  7:07 ` Eli Zaretskii
2021-09-17 10:24   ` John Cummings
2021-09-17 10:36     ` Eli Zaretskii
2021-09-17 17:38   ` bug#50630: [External] : " Drew Adams
2021-09-17 18:04     ` Eli Zaretskii
2021-09-17 20:32       ` John Cummings
2021-09-18  5:56         ` Eli Zaretskii
2021-09-18 10:04           ` John Cummings
2021-09-21 10:57 ` John Cummings [this message]
2021-09-24 19:58 ` bug#50630: [PATCH] Add tests for insert-directory John Cummings
2021-09-25  1:47   ` Lars Ingebrigtsen
2021-09-25 10:45     ` John Cummings
2021-09-25 11:38       ` Michael Albinus
2021-09-25 12:13         ` John Cummings
2021-09-25  6:10   ` Eli Zaretskii
2021-09-25 11:38     ` John Cummings
2021-09-25 12:30       ` John Cummings
2021-09-25 13:06       ` Eli Zaretskii
2021-09-25 14:29         ` John Cummings
2021-09-25 14:55           ` Eli Zaretskii
2021-09-25 17:15             ` John Cummings
2021-09-25 17:26               ` Eli Zaretskii
2021-09-25 17:37                 ` John Cummings
2021-09-25 17:44                   ` Eli Zaretskii
2021-09-25 18:01                     ` John Cummings
2021-09-25 18:44                       ` Eli Zaretskii
2021-09-25 19:00                         ` John Cummings
2021-09-25 19:07                           ` Eli Zaretskii
2021-09-25 19:58                             ` John Cummings

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='VWhThBOn_8UbEsqtqwIlHg9d1tagST0xslc7yY7KF-gUPxegkot9mk2aZD8Sj34b7BaUC8jOtRTQvknMvTys7tiZOabPZwSXloAytqBYIAQ=@rootabega.net' \
    --to=john@rootabega.net \
    --cc=50630@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).