From: richardeng <richardeng@foxmail.com>
To: Sven Joachim <svenjoac@gmx.de>, 1523@emacsbugs.donarmstrong.com
Cc: bug-gnu-emacs@gnu.org
Subject: bug#1523: [Ivan Shmakov] process-send-string apparently mangles \r into \n
Date: Tue, 13 Jan 2009 01:24:20 +0800 [thread overview]
Message-ID: <496B7CC4.8000101@foxmail.com> (raw)
In-Reply-To: <873agxxd6q.fsf@turtle.gmx.de>
Sven Joachim wrote:
> I received the following report via the Debian bug tracking system.
> It is reproducible in the trunk.
>
>
>
> ------------------------------------------------------------------------
>
> Subject:
> Bug#508300: process-send-string apparently mangles \r into \n
> From:
> Ivan Shmakov <oneingray@gmail.com>
> Date:
> Wed, 10 Dec 2008 01:14:09 +0600
> To:
> submit@bugs.debian.org
>
> To:
> submit@bugs.debian.org
> CC:
> Ivan Shmakov <oneingray@gmail.com>
>
>
> Package: emacs22
> Version: 22.2+2-5
>
> After running the following program:
>
> (let* ((coding-system-for-read 'binary)
> (coding-system-for-write 'binary)
> (p (start-process "foo" "*foo*" "od" "-td1")))
> (process-send-string p "\r\n")
> (process-send-eof p))
> ;; => #<process foo>
>
> the `*foo*' buffer contains:
>
> --cut: *foo*--
> 0000000 10 10
> 0000002
>
> Process foo finished
> --cut: *foo*--
>
> While I'd expect the following instead:
>
> --cut: *foo*--
> 0000000 13 10
> 0000002
>
> Process foo finished
> --cut: *foo*--
>
> Compare:
>
> (let ((coding-system-for-read 'binary)
> (coding-system-for-write 'binary))
> (save-excursion
> (set-buffer "*foo*")
> (let* ((start (point))
> (end (progn (insert "\r\n") (point))))
> (call-process-region start end "od" t t t "-td1"))))
>
> --cut: *foo*--
> 0000000 13 10
> 0000002
> --cut: *foo*--
>
>
>
(start-process "foo" "*foo*" "od" "-td1") // pty is used,
pty driver will map '\r' <-> '\n'
(call-process-region start end "od" t t t "-td1") // temp file is
used, no such problem
--- process.c.~1.577.~ 2009-01-03 07:03:59.000000000
-0800
+++ process.c 2009-01-13 01:18:08.000000000
-0800
@@ -1871,6 +1871,13 @@
forkin = forkout =
-1;
#endif /* not USG, or USG_SUBTTY_WORKS
*/
pty_flag =
1;
+
{
+ struct emacs_tty
settings;
+ EMACS_GET_TTY(outchannel,
&settings);
+ settings.main.c_iflag &= ~ICRNL; /* Disable map of CR to
NL on input */
+ settings.main.c_iflag &= ~INLCR; /* Disable map of NL to
CR on input */
+ EMACS_SET_TTY(outchannel, &settings,
1);
+
}
}
else
#endif /* HAVE_PTYS */
next prev parent reply other threads:[~2009-01-12 17:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-09 21:15 bug#1523: [Ivan Shmakov] process-send-string apparently mangles \r into \n Sven Joachim
2009-01-12 17:24 ` richardeng [this message]
2009-01-12 17:58 ` richardeng
2011-09-11 18:26 ` Lars Magne Ingebrigtsen
2011-09-11 19:24 ` Andreas Schwab
2011-09-11 19:27 ` Lars Magne Ingebrigtsen
2011-09-11 20:23 ` Andreas Schwab
2011-09-11 20:40 ` Lars Magne Ingebrigtsen
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=496B7CC4.8000101@foxmail.com \
--to=richardeng@foxmail.com \
--cc=1523@emacsbugs.donarmstrong.com \
--cc=bug-gnu-emacs@gnu.org \
--cc=svenjoac@gmx.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.