From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Whitfield Diffie Newsgroups: gmane.emacs.bugs Subject: bug#13165: Fwd: Newlines in file names Date: Wed, 12 Dec 2012 14:50:41 -0800 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1355352862 26564 80.91.229.3 (12 Dec 2012 22:54:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Dec 2012 22:54:22 +0000 (UTC) To: 13165@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 12 23:54:36 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TivCF-0007JA-51 for geb-bug-gnu-emacs@m.gmane.org; Wed, 12 Dec 2012 23:54:35 +0100 Original-Received: from localhost ([::1]:45357 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TivC2-0000eb-G6 for geb-bug-gnu-emacs@m.gmane.org; Wed, 12 Dec 2012 17:54:22 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:44030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TivBw-0000dP-1F for bug-gnu-emacs@gnu.org; Wed, 12 Dec 2012 17:54:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TivBt-0003gp-9m for bug-gnu-emacs@gnu.org; Wed, 12 Dec 2012 17:54:15 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57610) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TivBt-0003gk-6n for bug-gnu-emacs@gnu.org; Wed, 12 Dec 2012 17:54:13 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TivCf-0004mE-Pb for bug-gnu-emacs@gnu.org; Wed, 12 Dec 2012 17:55:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Whitfield Diffie Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 12 Dec 2012 22:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13165 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.135535285518294 (code B ref -1); Wed, 12 Dec 2012 22:55:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 Dec 2012 22:54:15 +0000 Original-Received: from localhost ([127.0.0.1]:39627 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TivBv-0004kz-6t for submit@debbugs.gnu.org; Wed, 12 Dec 2012 17:54:15 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:60307) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tiv9X-0004gk-Hy for submit@debbugs.gnu.org; Wed, 12 Dec 2012 17:51:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tiv8g-00032G-9R for submit@debbugs.gnu.org; Wed, 12 Dec 2012 17:50:58 -0500 Original-Received: from lists.gnu.org ([208.118.235.17]:54876) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tiv8g-00032C-5d for submit@debbugs.gnu.org; Wed, 12 Dec 2012 17:50:54 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:43407) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tiv8c-00008B-0o for bug-gnu-emacs@gnu.org; Wed, 12 Dec 2012 17:50:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tiv8U-0002zd-TS for bug-gnu-emacs@gnu.org; Wed, 12 Dec 2012 17:50:49 -0500 Original-Received: from mail-qa0-f48.google.com ([209.85.216.48]:42654) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tiv8U-0002zZ-Kp for bug-gnu-emacs@gnu.org; Wed, 12 Dec 2012 17:50:42 -0500 Original-Received: by mail-qa0-f48.google.com with SMTP id l8so1995708qaq.0 for ; Wed, 12 Dec 2012 14:50:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=ZGhvVbQlsZzzTi0rdRgx53lxqbqMlK5M6Xlj5iPEHm4=; b=OYXSlyXKT0mTUjLJSDleL1V2XiLiYsVjzMUeBYIFYOYhtwcnXshEkfNunO4ipcINOG VERXZjEhZ4EIqo33tlYVZuRcaL0GXY8pGUHlEsearIizqr7wtV9EMrMVTZ8eXTj3UIaW 45kQ6BAi0tHKBcVNG+t3MBnzjrEC9X6+Duznidmcf/5wGi5ibc7SaXgSVJ4Hvzxu7eUs Xw7e8uwxRmHMq2w0YrUew6ldLOaRhqbkF5zVlaHJFG4rkuQaSlFa0lb5DnSHcbRlx5c2 gaILNu+zS6GVgqelGljGIsAePvVSIUDqpSiFGVTyc0XP/Dk9OkpGhVT9jRfAtx37TcsA 9irg== Original-Received: by 10.224.180.205 with SMTP id bv13mr116531qab.7.1355352641747; Wed, 12 Dec 2012 14:50:41 -0800 (PST) Original-Received: by 10.49.36.229 with HTTP; Wed, 12 Dec 2012 14:50:41 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: v3rjlYf0l_Vf6aZiSttgpK4UD_k X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Mailman-Approved-At: Wed, 12 Dec 2012 17:54:14 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:68428 Archived-At: Since this didn't attract much attention as a request for help, let me try it as a bug report. In emacs 22.1.1, if you have a file whose name contains a carriage return and put the cursor on the line with that file in dired, then (file-exists-p (dired-get-filename)) is nil. Whit ---------- Forwarded message ---------- From: Whitfield Diffie Date: Mon, Dec 10, 2012 at 11:47 AM Subject: Newlines in file names To: help-gnu-emacs@gnu.org Question: How do you translate a filename containing a newline to one containing a \n without getting a \\n. Problem: Create a directory ``test''. In the directory create a file with (call-process "touch" nil nil nil "Icon\n"). This file's name has five characters of which the last is a newline. (Such files appear in some downloads.) This directory now appears as /Users/diffie/test: total used in directory 0 available 327738716 drwxr-xr-x 3 diffie staff 102 Dec 10 11:04 . drwxr-xr-x 25 diffie staff 850 Dec 10 11:03 .. -rw-r--r-- 1 diffie staff 0 Dec 9 10:01 Icon Place the cursor on the line with the Icon file and type : (file-exists-p (dired get filename)) The response is ``nil''. Make the buffer writable with and edit the name by hand to ``Icon\n''. Type : (file-exists-p (dired-get-filename)) The response is now ``t''. Type g to revert the buffer and the name returns to being ``Icon''. Place the cursor on the line with the Icon file again and type M+x The entire file line disappears leaving only . and .. in the directory. Type g to revert the buffer and the line reappears but the file has not become executable. Edit the filename as before and repeat the attempt to make it executable. Now the file line becomes -rwxr-xr-x 1 diffie staff 0 Dec 9 10:01 Icon The file has become executable but its name has returned to being ``Icon'', lacks the newline character. Objective: Repair dired so that filenames containing newlines are displayed with \n in place of newline characters (and \r in place of carriage returns). I have tried setting print-escape-newlines to t and recoding filename with buffer-file-coding-system, file-name-coding-system, and default-file-name-coding-system, without success. Whit