GNU bug report logs - #36103
24.5; Blank spaces around parentheses in history expansion in shell mode

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Enric Rodríguez Carbonell <erodri@HIDDEN>; merged with #1795, #5007, #8027; dated Wed, 5 Jun 2019 14:42:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Merged 1795 5007 8027 36103. Request was from Noam Postavsky <npostavs@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 36103 <at> debbugs.gnu.org:


Received: (at 36103) by debbugs.gnu.org; 6 Jun 2019 01:02:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 05 21:02:42 2019
Received: from localhost ([127.0.0.1]:48548 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hYgni-0003MY-HA
	for submit <at> debbugs.gnu.org; Wed, 05 Jun 2019 21:02:42 -0400
Received: from mail-it1-f177.google.com ([209.85.166.177]:39723)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>)
 id 1hYgng-0003MC-Bn; Wed, 05 Jun 2019 21:02:40 -0400
Received: by mail-it1-f177.google.com with SMTP id j204so543681ite.4;
 Wed, 05 Jun 2019 18:02:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=hFdGH19eIudgryTri2JuSQlCV0p8gtqht+dfABvLQEo=;
 b=PDlY28UWCQPRjjBdlvqBScPpmi5Zni1C9WEEJKcqn9OnwmKlnf6RPxlxI+XRNVYOWX
 X5kWX+WgojC1zyx6sGZpsj50TGxgLy265V0e90RiUlsRv9/zsXW4SeubtS42kRocepQ1
 yvdiUICgKoLLtMdbuEEdztHRi/RR9ceQ5Zrf9SvQSDyvYtgXAH3G+VNOoeK1Hxn8Ybrp
 WGdp39MnAqYw5xtqD4DcqEXzhqjlYZjknmdG7yIDnaYgDI6xVsXVXwc76li2QaFS26TC
 ael5GIK7/xMktZ5Q5Fp8Kbj4ZuyGSYd3qiJ7ezuQINnEKMhdUKZJYw4NaSvrvmlI5cBV
 jiSg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=hFdGH19eIudgryTri2JuSQlCV0p8gtqht+dfABvLQEo=;
 b=qvtJ3UzX5fCYPfCnxFA174U5/3L7i+qVF5ulZiW8HvopdWUWNfIHSvzM2PpnjFfrLn
 pAxjt2VZuKBdNJFbyhYWXNz2LeK8VJ5g1u4i491Jv5bGKaNssVeJcUk6Jl7BcJbkoPS1
 XrmMM7eoQIuR2agp44Uf4UMApI8gmUUmEQ29tMssw6vdL8xK33qHZ2AXO6YatMJsS+qW
 J2z2MOwcpVA7vomyXWxQTXxM9GMkydws48qYgtgIEOYh6/Kh9ByY2TelQh+g3nRcVjs3
 Ew7L9NB7ex9va42Nq2S6LKvgCnIqrWZ2T1ldPWsrYP/nu30KnJmmbx/krZt2ao6lpub8
 sjzQ==
X-Gm-Message-State: APjAAAWSCXXGSw8e94DoQvtY8snLXXsigJ4OiaVWO9vFWDJJbOIy1d4a
 2M0TmgckZ2/wSp+eJl6mXlYKttn/
X-Google-Smtp-Source: APXvYqw3CCrg5DzWLOTfpZT2/yPIgVifqQNpzvGSWKhuorlEjala3huHRMDny+Wt7t0Z24JOd1+Wtg==
X-Received: by 2002:a05:6638:149:: with SMTP id
 y9mr3923350jao.76.1559782954414; 
 Wed, 05 Jun 2019 18:02:34 -0700 (PDT)
Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34])
 by smtp.gmail.com with ESMTPSA id
 a198sm271984ita.2.2019.06.05.18.02.33
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Wed, 05 Jun 2019 18:02:33 -0700 (PDT)
From: Noam Postavsky <npostavs@HIDDEN>
To: Enric =?utf-8?Q?Rodr=C3=ADguez?= Carbonell <erodri@HIDDEN>
Subject: Re: bug#36103: 24.5;
 Blank spaces around parentheses in history expansion in shell mode
References: <5fb3dec3-3c48-9a49-cc50-8f68981978af@HIDDEN>
Date: Wed, 05 Jun 2019 21:02:33 -0400
In-Reply-To: <5fb3dec3-3c48-9a49-cc50-8f68981978af@HIDDEN> ("Enric
 =?utf-8?Q?Rodr=C3=ADguez?= Carbonell"'s message of "Wed, 5 Jun 2019
 13:03:49 +0200")
Message-ID: <87lfyf34ra.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.6 (/)
X-Debbugs-Envelope-To: 36103
Cc: 36103 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.6 (-)

merge 36103 8027
quit

Enric Rodr=C3=ADguez Carbonell <erodri@HIDDEN> writes:

> $ for file in $(ls); do echo $file; done

> $ !for

> M-x comint-replace-by-expanded-history

> $ for file in $ ( ls ) ; do echo $file ; done
>
> The blank spaces around the parentheses should not be there.
> Because of these blank spaces, this command cannot be executed,
> as "$ (" should be "$(".

Yes, the problem is in comint-arguments which attempts to parse a shell
line into separate arguments, using just a bunch of regexps.  This is
doomed to failure I think.  But the alternative would be a full blown
shell parser, so I don't know how feasible it will be to fix this bug.
It's been with us a long time.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36103; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 5 Jun 2019 14:41:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 05 10:41:10 2019
Received: from localhost ([127.0.0.1]:47815 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hYX6C-0000Mv-ND
	for submit <at> debbugs.gnu.org; Wed, 05 Jun 2019 10:41:09 -0400
Received: from eggs.gnu.org ([209.51.188.92]:39875)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <erodri@HIDDEN>) id 1hYTi7-00034p-97
 for submit <at> debbugs.gnu.org; Wed, 05 Jun 2019 07:04:04 -0400
Received: from lists.gnu.org ([209.51.188.17]:55156)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <erodri@HIDDEN>) id 1hYTi2-0002ej-5y
 for submit <at> debbugs.gnu.org; Wed, 05 Jun 2019 07:03:58 -0400
Received: from eggs.gnu.org ([209.51.188.92]:54256)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <erodri@HIDDEN>) id 1hYTi0-0004LY-Ry
 for bug-gnu-emacs@HIDDEN; Wed, 05 Jun 2019 07:03:58 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_NONE,
 URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <erodri@HIDDEN>) id 1hYThz-0002Vv-Hg
 for bug-gnu-emacs@HIDDEN; Wed, 05 Jun 2019 07:03:56 -0400
Received: from mccarthy.ugdsi.upc.edu ([147.83.20.25]:36088)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <erodri@HIDDEN>) id 1hYThz-0002MS-6w
 for bug-gnu-emacs@HIDDEN; Wed, 05 Jun 2019 07:03:55 -0400
Received: from leon.ugdsi.upc.edu (leon.lsi.upc.edu [147.83.20.67])
 by mccarthy.ugdsi.upc.edu (8.15.1+Sun/8.15.1) with ESMTP id x55B3ntA022355
 for <bug-gnu-emacs@HIDDEN>; Wed, 5 Jun 2019 13:03:49 +0200 (CEST)
Received: from [10.192.137.157] (localhost [127.0.0.1]) (authenticated bits=0)
 by leon.ugdsi.upc.edu (8.13.6/8.13.6/MSA-SMTP-AUTH) with ESMTP id
 x55B3nYh020632
 for <bug-gnu-emacs@HIDDEN>; Wed, 5 Jun 2019 13:03:49 +0200 (CEST)
Subject: 24.5; Blank spaces around parentheses in history expansion in shell
 mode
To: bug-gnu-emacs@HIDDEN
From: =?UTF-8?Q?Enric_Rodr=c3=adguez_Carbonell?= <erodri@HIDDEN>
Message-ID: <5fb3dec3-3c48-9a49-cc50-8f68981978af@HIDDEN>
Date: Wed, 5 Jun 2019 13:03:49 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Solaris 10
X-Received-From: 147.83.20.25
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Wed, 05 Jun 2019 10:41:07 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Hi,

I would like to report what I think is a bug in the history expansion in 
shell mode.

This is the sequence of steps:

$ emacs -Q

Once in emacs:

M-x shell

Then I type in the command line of the shell window:

$ for file in $(ls); do echo $file; done

Then I type at the prompt:

$ !for

and then run command:

M-x comint-replace-by-expanded-history

which replaces the

$ !for

by

$ for file in $ ( ls ) ; do echo $file ; done

The blank spaces around the parentheses should not be there.
Because of these blank spaces, this command cannot be executed,
as "$ (" should be "$(".

Best regards,

Enric

****************************************************************

In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
  of 2017-09-20 on lcy01-07, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11804000
System Description:    Ubuntu 16.04.6 LTS

Configured using:
  `configure --build x86_64-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/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
  --build x86_64-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/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
  --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
  'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
  -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
  -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro''

Important settings:
   value of $LC_MONETARY: es_ES.UTF-8
   value of $LC_NUMERIC: es_ES.UTF-8
   value of $LC_TIME: es_ES.UTF-8
   value of $LANG: en_US.UTF-8
   value of $XMODIFIERS: @im=ibus
   locale-coding-system: utf-8-unix

Major mode: Shell

Minor modes in effect:
   shell-dirtrack-mode: t
   tooltip-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   line-number-mode: t
   transient-mark-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
History item: 1

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util help-fns mail-prsvr mail-utils shell pcomplete comint ansi-color
ring time-date tooltip electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
gfilenotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 75917 7030)
  (symbols 48 18019 0)
  (miscs 40 45 149)
  (strings 32 11232 4144)
  (string-bytes 1 311767)
  (vectors 16 9670)
  (vector-slots 8 389946 11489)
  (floats 8 63 219)
  (intervals 56 308 19)
  (buffers 960 12)
  (heap 1024 16912 853))
-- 
_______________________________________
Enric Rodriguez Carbonell
Technical University of Catalonia (UPC)
www.cs.upc.edu/~erodri
+34-93-4137815

Office 113 - Omega Building
Department of Computer Science (CS)
Jordi Girona 1, 08034 Barcelona, Spain
_______________________________________





Acknowledgement sent to Enric Rodríguez Carbonell <erodri@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#36103; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 6 Jun 2019 01:15:02 UTC

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