From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: richardeng Newsgroups: gmane.emacs.bugs Subject: bug#1523: [Ivan Shmakov] process-send-string apparently mangles \r into \n Date: Tue, 13 Jan 2009 01:58:56 +0800 Message-ID: <496B84E0.2030101@foxmail.com> References: <873agxxd6q.fsf@turtle.gmx.de> Reply-To: richardeng , 1523@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1231784664 12351 80.91.229.12 (12 Jan 2009 18:24:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 12 Jan 2009 18:24:24 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org To: Sven Joachim , 1523@emacsbugs.donarmstrong.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 12 19:25:35 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LMRTg-0006We-4U for geb-bug-gnu-emacs@m.gmane.org; Mon, 12 Jan 2009 19:25:33 +0100 Original-Received: from localhost ([127.0.0.1]:37399 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LMRSP-0003aR-KZ for geb-bug-gnu-emacs@m.gmane.org; Mon, 12 Jan 2009 13:24:13 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LMRRj-0002tH-87 for bug-gnu-emacs@gnu.org; Mon, 12 Jan 2009 13:23:31 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LMRRh-0002qd-9Q for bug-gnu-emacs@gnu.org; Mon, 12 Jan 2009 13:23:29 -0500 Original-Received: from [199.232.76.173] (port=34860 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LMRRg-0002q5-QL for bug-gnu-emacs@gnu.org; Mon, 12 Jan 2009 13:23:28 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:33623) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LMRRf-0003TE-Vc for bug-gnu-emacs@gnu.org; Mon, 12 Jan 2009 13:23:28 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0CINPJA003019; Mon, 12 Jan 2009 10:23:26 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n0CI57pr030843; Mon, 12 Jan 2009 10:05:07 -0800 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: richardeng Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Mon, 12 Jan 2009 18:05:07 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 1523 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 1523-submit@emacsbugs.donarmstrong.com id=B1523.123178315428591 (code B ref 1523); Mon, 12 Jan 2009 18:05:07 +0000 Original-Received: (at 1523) by emacsbugs.donarmstrong.com; 12 Jan 2009 17:59:14 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from smtpbg1.foxmail.com (smtpbg1.foxmail.com [58.61.33.111]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id n0CHx9JK028585 for <1523@emacsbugs.donarmstrong.com>; Mon, 12 Jan 2009 09:59:11 -0800 Original-Received: from 172.16.81.120 (foxmail.com [172.16.81.120]) by smtpbg1 (foxmail.com) with SMTP id GzvJNszP; Tue, 13 Jan 2009 01:58:58 +0800 (envelope-from richardeng@foxmail.com) X-QQ-mid: esmtp2123178313840319473 Original-Received: from [192.168.1.111] (unknown [58.25.221.212]) by smtp.foxmail.com (Postfix) with ESMTP id ; Tue, 13 Jan 2009 01:58:58 +0800 (CST) User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) In-Reply-To: <873agxxd6q.fsf@turtle.gmx.de> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Mon, 12 Jan 2009 13:23:29 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:24035 Archived-At: 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*--


  
send again, the "plain text only" format has some problem...

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