From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Allen Li Newsgroups: gmane.emacs.bugs Subject: bug#29189: 25.3; Dired does not work with binary filenames Date: Wed, 15 Nov 2017 22:31:48 -0800 Message-ID: References: <3CE09384-E9D6-4DB9-853A-11088CF8DF80@gnu.org> <83a7ztp6p7.fsf@gnu.org> <83k1ywoq4z.fsf@gnu.org> <83h8u0on7y.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1510813935 21694 195.159.176.226 (16 Nov 2017 06:32:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 16 Nov 2017 06:32:15 +0000 (UTC) Cc: 29189@debbugs.gnu.org, Andreas Schwab To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Nov 16 07:32:09 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eFDia-00059n-JT for geb-bug-gnu-emacs@m.gmane.org; Thu, 16 Nov 2017 07:32:08 +0100 Original-Received: from localhost ([::1]:39245 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFDig-0007wT-Gf for geb-bug-gnu-emacs@m.gmane.org; Thu, 16 Nov 2017 01:32:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFDia-0007wB-05 for bug-gnu-emacs@gnu.org; Thu, 16 Nov 2017 01:32:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFDiV-0006K8-MG for bug-gnu-emacs@gnu.org; Thu, 16 Nov 2017 01:32:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33792) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eFDiV-0006Jt-JX for bug-gnu-emacs@gnu.org; Thu, 16 Nov 2017 01:32:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eFDiV-0003zR-4O for bug-gnu-emacs@gnu.org; Thu, 16 Nov 2017 01:32:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Allen Li Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 Nov 2017 06:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29189 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29189-submit@debbugs.gnu.org id=B29189.151081391715326 (code B ref 29189); Thu, 16 Nov 2017 06:32:02 +0000 Original-Received: (at 29189) by debbugs.gnu.org; 16 Nov 2017 06:31:57 +0000 Original-Received: from localhost ([127.0.0.1]:42473 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eFDiO-0003z7-9X for submit@debbugs.gnu.org; Thu, 16 Nov 2017 01:31:57 -0500 Original-Received: from mail-qt0-f173.google.com ([209.85.216.173]:57343) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eFDiM-0003yu-J6 for 29189@debbugs.gnu.org; Thu, 16 Nov 2017 01:31:54 -0500 Original-Received: by mail-qt0-f173.google.com with SMTP id r39so23845081qtr.13 for <29189@debbugs.gnu.org>; Wed, 15 Nov 2017 22:31:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=/3F8ngCcsWMLgKjYQvfRqCtjJgGv2YvED0gmwAsxP6s=; b=efN1zzf7t+xsBnYi090QRX7/2VQ4eTa/dYgBtIsFYHaga+LsU3vIRfWmmKd73q95RL 9GvZK0jKl+YjlmquY0BAMXKwzufmEDBC9cpeKpd0KwU00e0x6tQ6qMaTRN8pDVo/d7yt vVu0Lamt7ZKH0cmO9L2jgVxczvoxJfJJE1uu9s2ExwOJcbrt2OXutZrfA6gBPVsiLatU kLv+z4Bpp7GVY7lgUVrg8RsQijmtYGA8s/3sUZnWAe8masFClTmMBcDUanGfAHtHORQ0 c2ERPDBIC0Bvt7rPPBRkQonxLnaCBGpNA403RKPqFeJeSBFTTTVQYj1gMRzFXEkCp802 jNvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=/3F8ngCcsWMLgKjYQvfRqCtjJgGv2YvED0gmwAsxP6s=; b=F2HRN4G5GjmJCG806S1RuiJLm/gINqVDxjTmU9tYw7c/2GcRrBLEaPZdkOR1cO2FYc R2G2iRrInVIvAZTg0vmwRznkdKLOdiqxV9QYXXrNRaYNiQlN5iE1+ZJ1NCt/HAMzCmH+ 3lXAZS8cqTEIY2gKdNboBPp695DQd+NBJ2nWdqKZertpVWmQ1QUJ5YLDifdDKc4in8SJ zttdFZdgy6J1zp54Xk82+OnVwxoYMyp6fM7tdlvK1rlmkDTkVpgDFneMb//X83SC80TN IVayD/KMFo06LzJXtgFwpaCsB27zIVpuxDAxG7iwNw82sbsKPSKxSenu1U05X7wJ6UIN RbPw== X-Gm-Message-State: AJaThX7ADtJzRN/zPRTKcdxm7j/j+CuEGoZcnoNqADfgB5G5sRFCbFBr cUVUNj0IjMj605L+ux7moSRwpDvWg2efzwwH+2Q= X-Google-Smtp-Source: AGs4zMbK0HQsfwx5etADxS5ka23LejbEHIyk3tj5XJXAz/hkg8MiDgwfPCshXRg9eCDin4eJOntjfTbohxRh5XSRSuI= X-Received: by 10.55.54.146 with SMTP id d140mr891066qka.39.1510813909065; Wed, 15 Nov 2017 22:31:49 -0800 (PST) Original-Received: by 10.237.53.92 with HTTP; Wed, 15 Nov 2017 22:31:48 -0800 (PST) In-Reply-To: <83h8u0on7y.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:139951 Archived-At: On Sat, Nov 11, 2017 at 7:21 AM, Eli Zaretskii wrote: >> Date: Sat, 11 Nov 2017 16:18:20 +0200 >> From: Eli Zaretskii >> 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.