From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andrew Hyatt Newsgroups: gmane.emacs.bugs Subject: bug#4975: 23.1; comint.el: command line is sometimes echoed in the command output Date: Thu, 14 Jul 2016 00:20:16 -0400 Message-ID: References: <1258648805.4446.1.camel@pasokon> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1468470338 15601 80.91.229.3 (14 Jul 2016 04:25:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Jul 2016 04:25:38 +0000 (UTC) Cc: Simon Marshall , 4975@debbugs.gnu.org, Olin Shivers , Cyril Bouthors To: Johan Euphrosine Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 14 06:25:27 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bNYDG-0005QT-G1 for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Jul 2016 06:25:26 +0200 Original-Received: from localhost ([::1]:51416 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNYDF-0003Ii-OC for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Jul 2016 00:25:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60607) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNY95-0006IG-3B for bug-gnu-emacs@gnu.org; Thu, 14 Jul 2016 00:21:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNY90-0004aV-Pj for bug-gnu-emacs@gnu.org; Thu, 14 Jul 2016 00:21:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38082) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNY90-0004aO-LO for bug-gnu-emacs@gnu.org; Thu, 14 Jul 2016 00:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bNY90-0007uV-Hb for bug-gnu-emacs@gnu.org; Thu, 14 Jul 2016 00:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrew Hyatt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 Jul 2016 04:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 4975 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 4975-submit@debbugs.gnu.org id=B4975.146847002630344 (code B ref 4975); Thu, 14 Jul 2016 04:21:02 +0000 Original-Received: (at 4975) by debbugs.gnu.org; 14 Jul 2016 04:20:26 +0000 Original-Received: from localhost ([127.0.0.1]:50419 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bNY8Q-0007tL-3H for submit@debbugs.gnu.org; Thu, 14 Jul 2016 00:20:26 -0400 Original-Received: from mail-qk0-f170.google.com ([209.85.220.170]:32868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bNY8O-0007t9-BC for 4975@debbugs.gnu.org; Thu, 14 Jul 2016 00:20:24 -0400 Original-Received: by mail-qk0-f170.google.com with SMTP id p74so63142460qka.0 for <4975@debbugs.gnu.org>; Wed, 13 Jul 2016 21:20:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=9Q+d6e+OALqHZM41iPvc4Z0ysuoNmF/Dmy9cBqv+Zd0=; b=zcXFVxBkz0gI2NQDVDJOOmkFxW9ZQQVvBt2AYj6NhJ0u+CsDHnML/pW+KduzHJEqBL hrChsVUq1Ao3ri+oESvj+pE485bQ7SMLhGLifdp7E60gINHPCbqDbp/4N04fxJbB3oO1 O4mGLSE7sG8x2aE+45VkONPuk/3h0wJK+Xck/yQMeFp2dvehAdOwwmOcZpOIs7J9Keii +L9KudaSnVcSv8GC9aXf4TZy+0TtBbXVx5BuDfASFdlTekzuJvXSP3YDyZJQy9LhzfIl XcdvOcylqPgocRLPBFYO/MNuzNjzqT2aZSsKJtXfLtSNOWP9jj0WAXhZqiBQJTtIrhkA XIqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=9Q+d6e+OALqHZM41iPvc4Z0ysuoNmF/Dmy9cBqv+Zd0=; b=cZF6AVmRDoP694uWsaB4PbPoq590YHeOcY0y+erQP+dL3ofM7oxKN9AcL//51ZhwMT HN2hcY097l7f1xBcQDwIDQhw6cZLzmKnKSqaAea+uBLDinPqRW8CCALScd8yV7AEhWdo +jY9YkPZlvnRKm6wBGVcSdMxGZm2B04USltlFbm/Gz4pfCWOLzC256NhuruGXjXXeCAR NlPNs+8iSUuwbya+SLOAzsr3ACTSFR0tgpXsgPOInJGZArZPIGjuxqEriS3hMVhj0YAB 2VJzAX9tYB740VSKSpJD1CEn5udtDddpP6ty0Qh6co0x2fsOJHYbJMWNAmweaRQ8BI37 a8LA== X-Gm-Message-State: ALyK8tK5FnpLacATSNQeWRpU6/g/xOkISJvq1AJ/wnydISCXmHSRLimH83WhWuVfdJ8ATA== X-Received: by 10.55.54.3 with SMTP id d3mr14388520qka.16.1468470018951; Wed, 13 Jul 2016 21:20:18 -0700 (PDT) Original-Received: from Andrews-MacBook-Pro.local (cpe-74-73-128-199.nyc.res.rr.com. [74.73.128.199]) by smtp.gmail.com with ESMTPSA id c15sm199135qkg.46.2016.07.13.21.20.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jul 2016 21:20:17 -0700 (PDT) In-Reply-To: <1258648805.4446.1.camel@pasokon> (Johan Euphrosine's message of "Thu, 19 Nov 2009 17:40:05 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (darwin) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:121056 Archived-At: Hi Johan - I can't reproduce this on Emacs 25. Here's what I got: bash-3.2$ echo 'command is echoed once' command is echoed once bash-3.2$ php -r 'fwrite(STDOUT, "stdout\n");' stdout bash-3.2$ php -r 'fwrite(STDOUT, "stdout\n");' stdout bash-3.2$ echo 'command is echoed twice' command is echoed twice Let me know if you (or anyone else) can still reproduce this, otherwise I'll close this in a few weeks. Johan Euphrosine writes: > Hi, > > I managed to reproduce > http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=284727 with > comint-mode, and emacs23: > > After running php -r 'fwrite(STDOUT, "stdout\n");' in a bash comint > buffer: every command is echoed twice. > > emacs > M-x comint-run > /bin/bash > proppy@pasokon:~$ echo 'command is echoed once' > command is echoed once > proppy@pasokon:~$ php -r 'fwrite(STDOUT, "stdout\n");' > stdout > proppy@pasokon:~$ php -r 'fwrite(STDOUT, "stdout\n");' > php -r 'fwrite(STDOUT, "stdout\n");' > stdout > proppy@pasokon:~$ echo 'command is echoed twice' > echo 'command is echoed twice' > command is echoed twice > > I found out that setting 'comint-process-echoes to 't' workaround > this issue: > > emacs > (setq comint-process-echoes t) > M-x comint-run > /bin/bash > proppy@pasokon:~$ echo 'command is echoed once' > command is echoed once > proppy@pasokon:~$ php -r 'fwrite(STDOUT, "stdout\n");' > stdout > proppy@pasokon:~$ php -r 'fwrite(STDOUT, "stdout\n");' > stdout > proppy@pasokon:~$ echo 'command is *not* echoed twice' > command is *not* echoed twice > > I ran strace on php -r 'fwrite(STDOUT, "stdout\n");' to find out if > there is something strange done with the file descriptors, that might > bother comint-mode: > > fstat64(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 > fstat64(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 > fstat64(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 > mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, > 0) = 0xb7720000 > _llseek(0, 0, 0xbffad494, SEEK_CUR) = -1 ESPIPE (Illegal seek) > fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 > fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 > fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 > mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, > 0) = 0xb771f000 > _llseek(1, 0, 0xbffad494, SEEK_CUR) = -1 ESPIPE (Illegal seek) > fstat64(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 > fstat64(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 > _llseek(2, 0, 0xbffad494, SEEK_CUR) = -1 ESPIPE (Illegal seek) > write(1, "stdout\n", 7stdout > ) = 7 > close(2) = 0 > close(1) = 0 > munmap(0xb771f000, 4096) = 0 > close(0) = 0 > munmap(0xb7720000, 4096) = 0 > open("/dev/urandom", O_RDONLY) = 0 > read(0, "\362\233\264#", 4) = 4 > close(0) = 0 > open("/dev/urandom", O_RDONLY) = 0 > read(0, "\314R}\32", 4) = 4 > close(0) = 0 > open("/dev/urandom", O_RDONLY) = 0 > read(0, "=\247\332f", 4) = 4 > close(0) = 0 > setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={0, 0}}, NULL) = 0 > munmap(0x3c4000, 29352) = 0 > munmap(0xea9000, 89020) = 0 > gettimeofday({1258647750, 866613}, NULL) = 0 > munmap(0x3aa000, 105232) = 0 > munmap(0x39e000, 47616) = 0 > munmap(0xfd9000, 2054564) = 0 > exit_group(0) = ? > > but when trying to mimic this behaviour with a simple c program: > > #include > #include > > int main() { > int a; > llseek(0, 0, 0, SEEK_CUR); > llseek(1, 0, 0, SEEK_CUR); > llseek(2, 0, 0, SEEK_CUR); > write(1, "stdout\n", 7); > close(2); > close(1); > close(0); > open("/dev/urandom", O_RDONLY); > read(0, "\34\256\nY", 4); > close(0); > open("/dev/urandom", O_RDONLY); > read(0, "\34\256\nY", 4); > close(0); > open("/dev/urandom", O_RDONLY); > read(0, "\34\256\nY", 4); > close(0); > return 0; > } > > _llseek(0, 0, 0xbfd27570, SEEK_CUR) = -1 ESPIPE (Illegal seek) > _llseek(1, 0, 0xbfd27570, SEEK_CUR) = -1 ESPIPE (Illegal seek) > _llseek(2, 0, 0xbfd27570, SEEK_CUR) = -1 ESPIPE (Illegal seek) > write(1, "stdout\n", 7stdout > ) = 7 > close(2) = 0 > close(1) = 0 > close(0) = 0 > open("/dev/urandom", O_RDONLY) = 0 > read(0, 0x8048705, 4) = -1 EFAULT (Bad address) > close(0) = 0 > open("/dev/urandom", O_RDONLY) = 0 > read(0, 0x8048705, 4) = -1 EFAULT (Bad address) > close(0) = 0 > open("/dev/urandom", O_RDONLY) = 0 > read(0, 0x8048705, 4) = -1 EFAULT (Bad address) > close(0) = 0 > exit_group(0) = ? > > It do not trigger the issue in comint: > emacs > M-x comint-run > /bin/bash > proppy@pasokon:~$ echo 'command is echoed once' > command is echoed once > proppy@pasokon:~$ /tmp/a > stdout > proppy@pasokon:~$ echo 'command is *not* echoed twice' > command is *not* echoed twice > proppy@pasokon:~$ php -r 'fwrite(STDOUT, "stdout\n");' > stdout > proppy@pasokon:~$ echo 'command is echoed twice' > echo 'command is echoed twice' > command is echoed twice > proppy@pasokon:~$ > > Do you have suggestion on how to debug this issue further ? > > Let me know if you need more information. > > Thanks in advance. > > If Emacs crashed, and you have the Emacs process in the gdb debugger, > please include the output from the following gdb commands: > `bt full' and `xbacktrace'. > If you would like to further debug the crash, please read the file > /usr/share/emacs/23.1/etc/DEBUG for instructions. > > > In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.18.3) > of 2009-11-10 on vernadsky, modified by Debian > Windowing system distributor `The X.Org Foundation', version > 11.0.10604000 > configured using `configure '--build=i486-linux-gnu' > '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' > '--libexecdir=/usr/lib' '--localstatedir=/var/lib' > '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' > '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS='' > > Important settings: > value of $LC_ALL: nil > value of $LC_COLLATE: nil > value of $LC_CTYPE: nil > value of $LC_MESSAGES: nil > value of $LC_MONETARY: nil > value of $LC_NUMERIC: nil > value of $LC_TIME: nil > value of $LANG: en_US.UTF-8 > value of $XMODIFIERS: nil > locale-coding-system: utf-8-unix > default-enable-multibyte-characters: t > > Major mode: Emacs-Lisp > > Minor modes in effect: > rcirc-track-minor-mode: t > tooltip-mode: t > tool-bar-mode: t > mouse-wheel-mode: t > menu-bar-mode: t > file-name-shadow-mode: t > global-font-lock-mode: t > font-lock-mode: t > blink-cursor-mode: t > global-auto-composition-mode: t > auto-composition-mode: t > auto-encryption-mode: t > auto-compression-mode: t > line-number-mode: t > transient-mark-mode: t > > Recent input: > M-p M-p M-p M-p M-p M-p M-n M-n > C-x b > 0 , SPC 0 , SPC > 0 , SPC C-x C-s M-x c o m p i > l e C-x b M-> M-p M-p > C-x 1 C-x b > M-d M-d 0 M-d > M-d 0 M-d M-d 0 C-x C-s M-x c o m p i > l e C-x b M-> M-p > C-x 1 M-> l s > C-x k M-x M-p M-p C-a C-g C-g M-x s h e l > l M-p > M-p l s l s l s SPC - a > l C-x 1 > C-x b C-x b c o M-< > > > M-x r e p o t r > t c o m i n t SPC C-x o C-s p r o c > e s C-x o C-x b C-g C-x b b u M-< > > > > M-f M-f C-x b M-x M-p M-p C-g C-g C-x > b M-f C-SPC C-e > M-w M-w C-x b M-x c o m i C-g > M-x r e p o t - > r t - e > > Recent messages: > call-interactively: Beginning of buffer > Making completion list... > read-buffer-to-switch: Command attempted to use minibuffer while in > minibuffer > Quit [2 times] > Mark set > Quit [2 times] > Mark set > Making completion list... > Quit > Making completion list...