all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Allen Li <vianchielfaura@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 29189@debbugs.gnu.org, Andreas Schwab <schwab@suse.de>
Subject: bug#29189: 25.3; Dired does not work with binary filenames
Date: Wed, 15 Nov 2017 22:31:48 -0800	[thread overview]
Message-ID: <CAJr1M6c9oLNSC2rvTvZJrOiyuXM=K-kb6iG2JziUkmt5z=nqEA@mail.gmail.com> (raw)
In-Reply-To: <83h8u0on7y.fsf@gnu.org>

On Sat, Nov 11, 2017 at 7:21 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Sat, 11 Nov 2017 16:18:20 +0200
>> From: Eli Zaretskii <eliz@gnu.org>
>> Cc: schwab@suse.de, 29189@debbugs.gnu.org
>>
>> The problem is in insert-directory.  It manually decodes each file
>> name which was output by 'ls', and that produces strangely
>> inconsistent results when the file name includes raw bytes: sometimes
>> we get the 2-byte sequence starting with \300, sometimes the original
>> byte survives unchanged, and sometimes I see the sequence \301\200
>> instead of a lone \300 in the file name.  I'm trying to understand
>> what's going on and find a solution to that.
>
> Can you please try the patch below?  (You will need to re-dump Emacs
> after patching files.el.)
>
> diff --git a/lisp/files.el b/lisp/files.el
> index b47411f..43198bc 100644
> --- a/lisp/files.el
> +++ b/lisp/files.el
> @@ -6803,10 +6803,13 @@ insert-directory
>                             val (get-text-property (point) 'dired-filename))
>                       (goto-char (next-single-property-change
>                                   (point) 'dired-filename nil (point-max)))
> -                     ;; Force no eol conversion on a file name, so
> -                     ;; that CR is preserved.
> -                     (decode-coding-region pos (point)
> -                                           (if val coding-no-eol coding))
> +                      (let ((fn (buffer-substring-no-properties pos (point))))
> +                        (delete-region pos (point))
> +                        (insert
> +                        ;; Force no eol conversion on a file name, so
> +                        ;; that CR is preserved.
> +                        (decode-coding-string (string-make-unibyte fn)
> +                                              (if val coding-no-eol coding))))
>                       (if val
>                           (put-text-property pos (point)
>                                              'dired-filename t)))))))

This patch works for me.





  reply	other threads:[~2017-11-16  6:31 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07  9:03 bug#29189: 25.3; Dired does not work with binary filenames Allen Li
2017-11-07 10:00 ` Andreas Schwab
2017-11-07 17:08   ` Eli Zaretskii
2017-11-08  5:12     ` Allen Li
2017-11-08  6:22   ` Allen Li
2017-11-08  8:44     ` Eli Zaretskii
2017-11-11  6:59       ` Allen Li
2017-11-11  8:20         ` Eli Zaretskii
2017-11-11 14:18           ` Eli Zaretskii
2017-11-11 15:21             ` Eli Zaretskii
2017-11-16  6:31               ` Allen Li [this message]
2017-11-16 16:00                 ` Eli Zaretskii
2017-11-18 14:42                   ` Eli Zaretskii
2017-11-20  9:48                     ` Andreas Schwab
2017-11-20 18:15                       ` Eli Zaretskii
2017-11-24  8:52                         ` Eli Zaretskii
2017-12-01  8:41                           ` Eli Zaretskii
2017-12-09  9:03                             ` Eli Zaretskii
2017-12-15  9:09                               ` Eli Zaretskii
2017-12-02  5:21                         ` Allen Li
2017-12-02  9:01                           ` Eli Zaretskii
2018-01-05 22:16                     ` Stefan Monnier
     [not found]                       ` <83h8rz9x6k.fsf@gnu.org>
     [not found]                         ` <jwvbmi72fak.fsf-monnier+emacs@gnu.org>
2018-01-06 16:04                           ` Eli Zaretskii
2018-01-07 15:20                             ` Stefan Monnier
2018-01-07 17:53                               ` Eli Zaretskii
     [not found] <CADbSrJytKAysg4DRNR4iJD5JJbn7iwi_28Gh_oabaE-rnVyqLw@mail.gmail.com>
2018-09-09  0:31 ` Allen Li
2018-09-09  6:12   ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to='CAJr1M6c9oLNSC2rvTvZJrOiyuXM=K-kb6iG2JziUkmt5z=nqEA@mail.gmail.com' \
    --to=vianchielfaura@gmail.com \
    --cc=29189@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=schwab@suse.de \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.