GNU bug report logs - #1523
[Ivan Shmakov] process-send-string apparently mangles \r into \n

Previous Next

Package: emacs;

Reported by: Sven Joachim <svenjoac <at> gmx.de>

Date: Tue, 9 Dec 2008 21:20:03 UTC

Severity: normal

Tags: confirmed, notabug, patch

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1523 in the body.
You can then email your comments to 1523 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Sven Joachim <svenjoac <at> gmx.de>, Ivan Shmakov <oneingray <at> gmail.com>, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1523; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Sven Joachim <svenjoac <at> gmx.de>:
New bug report received and forwarded. Copy sent to Sven Joachim <svenjoac <at> gmx.de>, Ivan Shmakov <oneingray <at> gmail.com>, Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Sven Joachim <svenjoac <at> gmx.de>
To: bug-gnu-emacs <at> gnu.org
Subject: [Ivan Shmakov] process-send-string apparently mangles \r into \n
Date: Tue, 09 Dec 2008 22:15:41 +0100
[Message part 1 (text/plain, inline)]
I received the following report via the Debian bug tracking system.
It is reproducible in the trunk.

[Message part 2 (message/rfc822, inline)]
From: Ivan Shmakov <oneingray <at> gmail.com>
To: submit <at> bugs.debian.org
Cc: Ivan Shmakov <oneingray <at> gmail.com>
Subject: Bug#508300: process-send-string apparently mangles \r into \n
Date: Wed, 10 Dec 2008 01:14:09 +0600
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*--



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1523; Package emacs. (Mon, 12 Jan 2009 17:30:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to richardeng <richardeng <at> foxmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 12 Jan 2009 17:30:02 GMT) Full text and rfc822 format available.

Message #10 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: richardeng <richardeng <at> foxmail.com>
To: Sven Joachim <svenjoac <at> gmx.de>, 1523 <at> debbugs.gnu.org
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#1523: [Ivan Shmakov] process-send-string apparently mangles
 \r	into \n
Date: Tue, 13 Jan 2009 01:24:20 +0800
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 <at> gmail.com>
> Date:
> Wed, 10 Dec 2008 01:14:09 +0600
> To:
> submit <at> bugs.debian.org
>
> To:
> submit <at> bugs.debian.org
> CC:
> Ivan Shmakov <oneingray <at> 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 */    






Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1523; Package emacs. (Mon, 12 Jan 2009 17:30:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to richardeng <richardeng <at> foxmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 12 Jan 2009 17:30:04 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1523; Package emacs. (Mon, 12 Jan 2009 18:05:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to richardeng <richardeng <at> foxmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 12 Jan 2009 18:05:04 GMT) Full text and rfc822 format available.

Message #20 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: richardeng <richardeng <at> foxmail.com>
To: Sven Joachim <svenjoac <at> gmx.de>, 1523 <at> debbugs.gnu.org
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#1523: [Ivan Shmakov] process-send-string apparently mangles
 \r	into \n
Date: Tue, 13 Jan 2009 01:58:56 +0800
[Message part 1 (text/html, inline)]

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1523; Package emacs. (Mon, 12 Jan 2009 18:05:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to richardeng <richardeng <at> foxmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 12 Jan 2009 18:05:07 GMT) Full text and rfc822 format available.

Added tag(s) patch. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 23 Jan 2010 00:53:02 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#1523; Package emacs. (Sun, 11 Sep 2011 18:35:03 GMT) Full text and rfc822 format available.

Message #30 received at 1523 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Sven Joachim <svenjoac <at> gmx.de>
Cc: Ivan Shmakov <oneingray <at> gmail.com>, 1523 <at> debbugs.gnu.org
Subject: Re: [Ivan Shmakov] process-send-string apparently mangles \r into \n
Date: Sun, 11 Sep 2011 20:26:13 +0200
Sven Joachim <svenjoac <at> gmx.de> writes:

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

I can confirm this behaviour in Emacs 24.  And it's isn't just CRLF
conversion -- all "\r"s are translated into "\n":

(let* ((coding-system-for-read  'binary)
       (coding-system-for-write 'binary)
       (p (start-process "foo" "*foo*" "od" "-td1")))
    (process-send-string p "a\rb\n")
    (process-send-eof p))

Gives:    
    
Process foo<2> finished
0000000   97   10   98   10
0000004

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Added tag(s) confirmed. Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 11 Sep 2011 18:35:04 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#1523; Package emacs. (Sun, 11 Sep 2011 19:30:02 GMT) Full text and rfc822 format available.

Message #35 received at 1523 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: Ivan Shmakov <oneingray <at> gmail.com>, Sven Joachim <svenjoac <at> gmx.de>,
	1523 <at> debbugs.gnu.org
Subject: Re: bug#1523: [Ivan Shmakov] process-send-string apparently mangles
	\r into \n
Date: Sun, 11 Sep 2011 21:24:51 +0200
Lars Magne Ingebrigtsen <larsi <at> gnus.org> writes:

> I can confirm this behaviour in Emacs 24.  And it's isn't just CRLF
> conversion -- all "\r"s are translated into "\n":

That's stty icrnl.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#1523; Package emacs. (Sun, 11 Sep 2011 19:36:02 GMT) Full text and rfc822 format available.

Message #38 received at 1523 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: Ivan Shmakov <oneingray <at> gmail.com>, Sven Joachim <svenjoac <at> gmx.de>,
	1523 <at> debbugs.gnu.org
Subject: Re: bug#1523: [Ivan Shmakov] process-send-string apparently mangles
	\r into \n
Date: Sun, 11 Sep 2011 21:27:18 +0200
Andreas Schwab <schwab <at> linux-m68k.org> writes:

>> I can confirm this behaviour in Emacs 24.  And it's isn't just CRLF
>> conversion -- all "\r"s are translated into "\n":
>
> That's stty icrnl.

So...  is this a bug or not?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#1523; Package emacs. (Sun, 11 Sep 2011 20:28:01 GMT) Full text and rfc822 format available.

Message #41 received at 1523 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: Ivan Shmakov <oneingray <at> gmail.com>, Sven Joachim <svenjoac <at> gmx.de>,
	1523 <at> debbugs.gnu.org
Subject: Re: bug#1523: [Ivan Shmakov] process-send-string apparently mangles
	\r into \n
Date: Sun, 11 Sep 2011 22:23:30 +0200
Lars Magne Ingebrigtsen <larsi <at> gnus.org> writes:

> Andreas Schwab <schwab <at> linux-m68k.org> writes:
>
>>> I can confirm this behaviour in Emacs 24.  And it's isn't just CRLF
>>> conversion -- all "\r"s are translated into "\n":
>>
>> That's stty icrnl.
>
> So...  is this a bug or not?

Don't use a pty if you want a literal communication channel.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#1523; Package emacs. (Sun, 11 Sep 2011 20:49:01 GMT) Full text and rfc822 format available.

Message #44 received at 1523 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: Ivan Shmakov <oneingray <at> gmail.com>, Sven Joachim <svenjoac <at> gmx.de>,
	1523 <at> debbugs.gnu.org
Subject: Re: bug#1523: [Ivan Shmakov] process-send-string apparently mangles
	\r into \n
Date: Sun, 11 Sep 2011 22:40:52 +0200
Andreas Schwab <schwab <at> linux-m68k.org> writes:

> Don't use a pty if you want a literal communication channel.

Ok; then it's not a bug.  I'm closing the report.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Added tag(s) notabug. Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 11 Sep 2011 20:49:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 1523 <at> debbugs.gnu.org and Sven Joachim <svenjoac <at> gmx.de> Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 11 Sep 2011 20:49:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 10 Oct 2011 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 317 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.