Subject: bug#48659: closed (Re: bug#48659: Escapes are deleted after executing "dired-toggle-read-only" in *Find* buffer)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 29 May 2021 13:40:01 +0000

Your bug report

#48659: Escapes are deleted after executing "dired-toggle-read-only" in *Find* buffer

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
48659: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=48659
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#48659: Escapes are deleted after executing "dired-toggle-read-only" in *Find* buffer
From: Andreas Schwab <[email-masked]>
To: Rodrigo Morales <[email-masked]>
Cc: [email-masked]
Date: Sat, 29 May 2021 15:39:39 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Should be fixed now.

-- 
Andreas Schwab, [email-masked]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

Subject: Escapes are deleted after executing "dired-toggle-read-only" in *Find* buffer
From: Rodrigo Morales <[email-masked]>
To: [email-masked]
Date: Tue, 25 May 2021 15:40:21 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

* The context

By default, when executing =find-dired=, spaces are escaped (see below)

#+BEGIN_EXAMPLE
  /home/thisisme/e/:
  find . \( -type f \) -ls
   29754046      0 -rw-r--r--   1 thisisme thisisme        0 May 25 15:25 a/bar\ bar.txt
   29753703      0 -rw-r--r--   1 thisisme thisisme        0 May 25 15:25 a/foo\ foo.txt
   29754079      0 -rw-r--r--   1 thisisme thisisme        0 May 25 15:25 b/bar\ bar.txt
   29754078      0 -rw-r--r--   1 thisisme thisisme        0 May 25 15:25 b/foo\ foo.txt
  
  find finished at Tue May 25 15:25:42
#+END_EXAMPLE

This happens because that's the default behavior of =find= when we
execute it in the command-line.

#+begin_src bash
find . \( -type f \) -ls
#+end_src

#+RESULTS:
#+begin_example
 29754078      0 -rw-r--r--   1 thisisme thisisme        0 May 25 15:25 ./b/foo\ foo.txt
 29754079      0 -rw-r--r--   1 thisisme thisisme        0 May 25 15:25 ./b/bar\ bar.txt
 29753703      0 -rw-r--r--   1 thisisme thisisme        0 May 25 15:25 ./a/foo\ foo.txt
 29754046      0 -rw-r--r--   1 thisisme thisisme        0 May 25 15:25 ./a/bar\ bar.txt
#+end_example

* The issue

This is causing =dired-toggle-read-only= to remove spaces after
finishing editing the buffer. I would consider this a bug, but let me
explain this further so that we all can determine whether this is a bug
or not.

* Minimal reproducible example

Let's suppose we have this directory

#+begin_src bash
mkdir {a,b} && touch {a,b}/{foo\ foo,bar\ bar}.txt
#+end_src

#+begin_src bash
tree -a --noreport
#+end_src

#+RESULTS:
#+begin_example
.
├── a
│   ├── bar bar.txt
│   └── foo foo.txt
└── b
    ├── bar bar.txt
    └── foo foo.txt
#+end_example

Let's execute =find-dired= and let's list the files (i.e. =-type
f=). The buffer =*Find*= would show the following

#+begin_example
  /home/thisisme/e/:
  find . \( -type f \) -ls
   29754046      0 -rw-r--r--   1 thisisme thisisme        0 May 25 15:30 a/bar\ bar.txt
   29753703      0 -rw-r--r--   1 thisisme thisisme        0 May 25 15:30 a/foo\ foo.txt
   29754079      0 -rw-r--r--   1 thisisme thisisme        0 May 25 15:30 b/bar\ bar.txt
   29754078      0 -rw-r--r--   1 thisisme thisisme        0 May 25 15:30 b/foo\ foo.txt
  
  find finished at Tue May 25 15:30:49
#+end_example

Now, let's toggle a =dired-toggle-read-only= and edit any name (I
appended =test= after the =a/barbar.txt= file).

Now, see what =tree= reports.

#+begin_src bash
tree -a --noreport
#+end_src

#+RESULTS:
#+begin_example
.
├── a
│   ├── barbar.txt-test
│   └── foofoo.txt
└── b
    ├── barbar.txt
    └── foofoo.txt
#+end_example

As you could see, spaces were removed from filenames and I think that
this happens because =find-file= show spaces as escaped characters.