bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#29189: 25.3; Dired does not work with binary filenames


From: Allen Li
Subject: bug#29189: 25.3; Dired does not work with binary filenames
Date: Wed, 15 Nov 2017 22:31:48 -0800

On Sat, Nov 11, 2017 at 7:21 AM, Eli Zaretskii <address@hidden> wrote:
>> Date: Sat, 11 Nov 2017 16:18:20 +0200
>> From: Eli Zaretskii <address@hidden>
>> Cc: address@hidden, address@hidden
>>
>> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]