unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Whitfield Diffie <whitfield.diffie@gmail.com>
To: 13165@debbugs.gnu.org
Subject: bug#13165: Fwd: Newlines in file names
Date: Wed, 12 Dec 2012 14:50:41 -0800	[thread overview]
Message-ID: <CAF+O-CV=cn+nsqVCs-Z5SJPDoxMQ=Nwfif5i=YEuzNVn=AiGNQ@mail.gmail.com> (raw)
In-Reply-To: <CAF+O-CXUO2RzKGMHh7dWsAHsucJtOxJkNAgbipdy=qgW3LMGkQ@mail.gmail.com>

    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 <whitfield.diffie@gmail.com>
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

                <esc>: (file-exists-p (dired get filename))

         The response is ``nil''.

         Make the buffer writable with <ctrl-x><ctrl-q> and edit the
         name by hand to ``Icon\n''.  Type

                <esc>: (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





       reply	other threads:[~2012-12-12 22:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAF+O-CXUO2RzKGMHh7dWsAHsucJtOxJkNAgbipdy=qgW3LMGkQ@mail.gmail.com>
2012-12-12 22:50 ` Whitfield Diffie [this message]
2012-12-12 23:04   ` bug#13165: Fwd: Newlines in file names Glenn Morris
2012-12-15  5:33     ` Whitfield Diffie
2012-12-15 20:04       ` Whitfield Diffie
2012-12-17 15:29         ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='CAF+O-CV=cn+nsqVCs-Z5SJPDoxMQ=Nwfif5i=YEuzNVn=AiGNQ@mail.gmail.com' \
    --to=whitfield.diffie@gmail.com \
    --cc=13165@debbugs.gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).