unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#1523: [Ivan Shmakov] process-send-string apparently mangles \r into \n
@ 2008-12-09 21:15 Sven Joachim
  2009-01-12 17:24 ` richardeng
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Sven Joachim @ 2008-12-09 21:15 UTC (permalink / raw)
  To: bug-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 102 bytes --]

I received the following report via the Debian bug tracking system.
It is reproducible in the trunk.


[-- Attachment #2: Type: message/rfc822, Size: 1689 bytes --]

From: Ivan Shmakov <oneingray@gmail.com>
To: submit@bugs.debian.org
Cc: Ivan Shmakov <oneingray@gmail.com>
Subject: Bug#508300: process-send-string apparently mangles \r into \n
Date: Wed, 10 Dec 2008 01:14:09 +0600
Message-ID: <87abb5gnzy.fsf@violet.siamics.int>

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



^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#1523: [Ivan Shmakov] process-send-string apparently mangles \r into \n
  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
  2009-01-12 17:58 ` richardeng
  2011-09-11 18:26 ` Lars Magne Ingebrigtsen
  2 siblings, 0 replies; 8+ messages in thread
From: richardeng @ 2009-01-12 17:24 UTC (permalink / raw)
  To: Sven Joachim, 1523; +Cc: bug-gnu-emacs

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 */    







^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#1523: [Ivan Shmakov] process-send-string apparently mangles \r into \n
  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
@ 2009-01-12 17:58 ` richardeng
  2011-09-11 18:26 ` Lars Magne Ingebrigtsen
  2 siblings, 0 replies; 8+ messages in thread
From: richardeng @ 2009-01-12 17:58 UTC (permalink / raw)
  To: Sven Joachim, 1523; +Cc: bug-gnu-emacs

[-- Attachment #1: Type: text/html, Size: 10555 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#1523: [Ivan Shmakov] process-send-string apparently mangles \r into \n
  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
  2009-01-12 17:58 ` richardeng
@ 2011-09-11 18:26 ` Lars Magne Ingebrigtsen
  2011-09-11 19:24   ` Andreas Schwab
  2 siblings, 1 reply; 8+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-09-11 18:26 UTC (permalink / raw)
  To: Sven Joachim; +Cc: Ivan Shmakov, 1523

Sven Joachim <svenjoac@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/





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#1523: [Ivan Shmakov] process-send-string apparently mangles \r into \n
  2011-09-11 18:26 ` Lars Magne Ingebrigtsen
@ 2011-09-11 19:24   ` Andreas Schwab
  2011-09-11 19:27     ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2011-09-11 19:24 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: Ivan Shmakov, Sven Joachim, 1523

Lars Magne Ingebrigtsen <larsi@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@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#1523: [Ivan Shmakov] process-send-string apparently mangles \r into \n
  2011-09-11 19:24   ` Andreas Schwab
@ 2011-09-11 19:27     ` Lars Magne Ingebrigtsen
  2011-09-11 20:23       ` Andreas Schwab
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-09-11 19:27 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Ivan Shmakov, Sven Joachim, 1523

Andreas Schwab <schwab@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/





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#1523: [Ivan Shmakov] process-send-string apparently mangles \r into \n
  2011-09-11 19:27     ` Lars Magne Ingebrigtsen
@ 2011-09-11 20:23       ` Andreas Schwab
  2011-09-11 20:40         ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2011-09-11 20:23 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: Ivan Shmakov, Sven Joachim, 1523

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#1523: [Ivan Shmakov] process-send-string apparently mangles \r into \n
  2011-09-11 20:23       ` Andreas Schwab
@ 2011-09-11 20:40         ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-09-11 20:40 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Ivan Shmakov, Sven Joachim, 1523

Andreas Schwab <schwab@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/





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-09-11 20:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).