GNU bug report logs - #15385
[Eshell] Directory completion overwrites preceding characters

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: Joost Kremers <joostkremers@HIDDEN>; dated Sun, 15 Sep 2013 14:13:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 15385) by debbugs.gnu.org; 22 Sep 2013 19:00:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 22 15:00:50 2013
Received: from localhost ([127.0.0.1]:56193 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VNotm-00018W-0s
	for submit <at> debbugs.gnu.org; Sun, 22 Sep 2013 15:00:50 -0400
Received: from goat.amuri.net ([203.99.132.195]:48646)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <aidalgol@HIDDEN>) id 1VNoth-00018M-Vk
 for 15385 <at> debbugs.gnu.org; Sun, 22 Sep 2013 15:00:47 -0400
Received: from dimension8.tehua.net (unknown [49.143.231.163])
 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
 (No client certificate requested)
 (Authenticated sender: aidalgol@HIDDEN)
 by goat.amuri.net (Postfix) with ESMTPSA id 28073FF842;
 Mon, 23 Sep 2013 07:02:33 +1200 (NZST)
From: Aidan Gauland <aidalgol@HIDDEN>
To: 15385 <at> debbugs.gnu.org
Subject: Re: bug#15385: [Eshell] Directory completion overwrites preceding
 characters
References: <mailman.2172.1379254394.10748.bug-gnu-emacs@HIDDEN>
 <87d2o2ddjh.fsf@HIDDEN>
 <mailman.2651.1379774595.10748.bug-gnu-emacs@HIDDEN>
Date: Mon, 23 Sep 2013 07:00:37 +1200
In-Reply-To: <mailman.2651.1379774595.10748.bug-gnu-emacs@HIDDEN> (Joost
 Kremers's message of "Sat, 21 Sep 2013 16:42:46 +0200")
Message-ID: <87vc1sbs16.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 15385
Cc: Joost Kremers <joostkremers@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://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: <http://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.0 (+)

Joost Kremers <joostkremers@HIDDEN> writes:

> But that still does not explain why the problem only occurs with the
> second argument on the command line. The first argument is completed
> without any problem, and *without* expanding ~ to /home/joost.

You're right, it doesn't.  I forgot to mention this in my last post.
I'm not even sure whether this is pcomplete or the way eshell uses
pcomplete.




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

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


Received: (at 15385) by debbugs.gnu.org; 22 Sep 2013 18:55:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 22 14:55:59 2013
Received: from localhost ([127.0.0.1]:56185 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VNop5-00010U-3w
	for submit <at> debbugs.gnu.org; Sun, 22 Sep 2013 14:55:59 -0400
Received: from goat.amuri.net ([203.99.132.195]:48622)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <aidalgol@HIDDEN>) id 1VNop2-00010K-Ng
 for 15385 <at> debbugs.gnu.org; Sun, 22 Sep 2013 14:55:57 -0400
Received: from dimension8.tehua.net (unknown [49.143.231.163])
 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
 (No client certificate requested)
 (Authenticated sender: aidalgol@HIDDEN)
 by goat.amuri.net (Postfix) with ESMTPSA id 6BB67FF842;
 Mon, 23 Sep 2013 06:57:46 +1200 (NZST)
From: Aidan Gauland <aidalgol@HIDDEN>
To: 15385 <at> debbugs.gnu.org
Subject: Re: bug#15385: [Eshell] Directory completion overwrites preceding
 characters
References: <mailman.2172.1379254394.10748.bug-gnu-emacs@HIDDEN>
 <87d2o2ddjh.fsf@HIDDEN>
 <mailman.2634.1379763074.10748.bug-gnu-emacs@HIDDEN>
Date: Mon, 23 Sep 2013 06:55:51 +1200
In-Reply-To: <mailman.2634.1379763074.10748.bug-gnu-emacs@HIDDEN> (Thierry
 Volpiatto's message of "Sat, 21 Sep 2013 13:29:38 +0200")
Message-ID: <87zjr4bs94.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 15385
Cc: Thierry Volpiatto <thierry.volpiatto@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://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: <http://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.0 (+)

Thierry Volpiatto <thierry.volpiatto@HIDDEN> writes:

> Aidan Gauland <aidalgol@HIDDEN> writes:
>
>> The bug seems to be in pcomplete, line 1140 of pcomplete.el, to be
>> exact:
>>
>>   (delete-char (- (length (comint-quote-filename stub))))
>
> With helm completion enabled, this bug is not reproductible, if that
> help you can look at the code here:
> https://github.com/emacs-helm/helm/blob/master/helm-eshell.el
>
> How to enable helm completion in eshell:
> https://github.com/emacs-helm/helm/wiki#wiki-helmeshellcompletion

Oh great, this gets even weirder.  Thanks for the info!




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

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


Received: (at 15385) by debbugs.gnu.org; 21 Sep 2013 14:42:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 21 10:42:59 2013
Received: from localhost ([127.0.0.1]:53681 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VNOOh-0002Y0-2a
	for submit <at> debbugs.gnu.org; Sat, 21 Sep 2013 10:42:59 -0400
Received: from out3-smtp.messagingengine.com ([66.111.4.27]:41402)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <joostkremers@HIDDEN>) id 1VNOOc-0002Xm-8g
 for 15385 <at> debbugs.gnu.org; Sat, 21 Sep 2013 10:42:55 -0400
Received: from compute5.internal (compute5.nyi.mail.srv.osa [10.202.2.45])
 by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 4AA9C21913;
 Sat, 21 Sep 2013 10:42:51 -0400 (EDT)
Received: from frontend2 ([10.202.2.161])
 by compute5.internal (MEProxy); Sat, 21 Sep 2013 10:42:52 -0400
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.fm; h=
 references:from:to:cc:subject:in-reply-to:date:message-id
 :mime-version:content-type; s=mesmtp; bh=95Iwr2lxRfjuFf99ygyBBXW
 xsu4=; b=MhYamiP+ZqM6u51PW92F+ITCpAaJWGF6IH2QVYcat2IxUCJDnKjRYca
 pFg4p9ivzM5G56HmJbRepi89B4SFaJs9eMFU/3H+Syj+qy6mgPGhWSF7Y8qnX1ZN
 1TMzHqaXfdXFSG9Vv5bkuihpiFXC0/fvnETqQD4/Z2GgczDHciNI=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=
 messagingengine.com; h=references:from:to:cc:subject:in-reply-to
 :date:message-id:mime-version:content-type; s=smtpout; bh=95Iwr2
 lxRfjuFf99ygyBBXWxsu4=; b=Kj4X1/ghynK9NNcYUZtjtQK434DxiVTWDugF5w
 YhUbUxyxummYPRevtGzJaEWyWzvdCdXLcroKudDof5f4xeRTEo93uKXw8w9XoFUD
 /8Z+SJ3+LxrPCskIBsKV64uMaKgoAeUWoybO5hYDkEYFPvOg3rUaJp4sSteP63FO
 S2IQs=
X-Sasl-enc: Qmxx1LJqX2AlaEtwedqQri/MypOx3DwFg1k+we5wDuQk 1379774570
Received: from eeenterprise.messagingengine.com (unknown [93.130.87.139])
 by mail.messagingengine.com (Postfix) with ESMTPA id A34A4680198;
 Sat, 21 Sep 2013 10:42:50 -0400 (EDT)
References: <mailman.2172.1379254394.10748.bug-gnu-emacs@HIDDEN>
 <87d2o2ddjh.fsf@HIDDEN>
User-agent: mu4e 0.9.9.5; emacs 24.3.1
From: Joost Kremers <joostkremers@HIDDEN>
To: Aidan Gauland <aidalgol@HIDDEN>
Subject: Re: bug#15385: [Eshell] Directory completion overwrites preceding
 characters
In-reply-to: <87d2o2ddjh.fsf@HIDDEN>
Date: Sat, 21 Sep 2013 16:42:46 +0200
Message-ID: <87pps29qxl.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 15385
Cc: 15385 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://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: <http://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: -0.7 (/)

But that still does not explain why the problem only occurs with the
second argument on the command line. The first argument is completed
without any problem, and *without* expanding ~ to /home/joost.

Joost


On Sat, Sep 21 2013, aidalgol@HIDDEN wrote:
> The bug seems to be in pcomplete, line 1140 of pcomplete.el, to be
> exact:
>
>   (delete-char (- (length (comint-quote-filename stub))))
>
> `comint-quote-filename' is given a relative path, "~/Dro", and returning
> an absolute path, "/home/joost/Dropbox/".  The length of this is then
> passed to `delete-char' to clear the argument being completed, but the
> length is wrong when it's a relative path, because
> `comint-quote-filename' seems to always return an absolute path.
>
> I'm not sure how to fix this without breaking something else or leaving
> out other special cases, such as ${FOO}tm[TAB], because I still don't
> really understand how pcomplete works.  I still want to sit down with
> pcomplete for a while and document it (it was left undocumented along
> with Eshell, of which it was originally a component), so unless someone
> else can come up with a good fix, this bug will have to remain
> outstanding for a while, unfortunately.
>
> --Aidan
>
> Joost Kremers <joostkremers@HIDDEN> writes:
>
>> Starting from `emacs -Q', if I do
>>
>>    (setq eshell-cmpl-ignore-case t)
>>
>> and then start up a shell, TAB completion behaves incorrectly under some
>> conditions.
>>
>> Specifically, I type a command such as:
>>
>>     $ cp ~/Dropbox/Work/Reading/Wilbur_Martinez2002.pdf ~/Dro
>>
>> At this point, I hit TAB to complete `~/Dro' and get:
>>
>>     $ cp ~/Dropbox/Work/Reading/Wilbur_Martine/home/joost/Dropbox/
>>
>> Note that the problem does *not* occur with the first file path. If I
>> hit TAB to complete
>>
>>     $ cp ~/Dro
>>
>> then completion produces the correct result:
>>
>>     $ cp ~/Dropbox/
>>
>> It seems the problem occurs when the file path is the second argument on
>> the command line, because if I type:
>>
>>     $ ls ~/Dropbox/Work/Literature/k/kim2002.pdf ~/dro
>>
>> and hit TAB to complete, the result is also:
>>
>>     $ ls ~/Dropbox/Work/Literature/k/ki/home/joost/Dropbox/
>>
>> It does not occur when there is a switch preceding the file path:
>>
>>     $ ls -l ~/dro
>>
>> completes fine.
>>
>> Thanks,
>>
>> Joost Kremers


-- 
Joost Kremers
Life has its moments




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

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


Received: (at submit) by debbugs.gnu.org; 21 Sep 2013 11:30:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 21 07:30:18 2013
Received: from localhost ([127.0.0.1]:53008 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VNLOD-0005g3-Qv
	for submit <at> debbugs.gnu.org; Sat, 21 Sep 2013 07:30:18 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42279)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1VNLOC-0005Wz-1V
 for submit <at> debbugs.gnu.org; Sat, 21 Sep 2013 07:30:16 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1VNLO1-0000wf-6S
 for submit <at> debbugs.gnu.org; Sat, 21 Sep 2013 07:30:10 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: *
X-Spam-Status: No, score=1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
 FSL_HELO_BARE_IP_2,RCVD_NUMERIC_HELO autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:50531)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1VNLO1-0000wW-3w
 for submit <at> debbugs.gnu.org; Sat, 21 Sep 2013 07:30:05 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:43967)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1VNLNv-000631-Nx
 for bug-gnu-emacs@HIDDEN; Sat, 21 Sep 2013 07:30:05 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1VNLNq-0000dc-D7
 for bug-gnu-emacs@HIDDEN; Sat, 21 Sep 2013 07:29:59 -0400
Received: from plane.gmane.org ([80.91.229.3]:46085)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1VNLNq-0000dP-6S
 for bug-gnu-emacs@HIDDEN; Sat, 21 Sep 2013 07:29:54 -0400
Received: from list by plane.gmane.org with local (Exim 4.69)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1VNLNp-0001YT-2L
 for bug-gnu-emacs@HIDDEN; Sat, 21 Sep 2013 13:29:53 +0200
Received: from 37.160.103.179 ([37.160.103.179])
 by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
 id 1AlnuQ-0007hv-00
 for <bug-gnu-emacs@HIDDEN>; Sat, 21 Sep 2013 13:29:53 +0200
Received: from thierry.volpiatto by 37.160.103.179 with local (Gmexim 0.1
 (Debian)) id 1AlnuQ-0007hv-00
 for <bug-gnu-emacs@HIDDEN>; Sat, 21 Sep 2013 13:29:53 +0200
X-Injected-Via-Gmane: http://gmane.org/
To: bug-gnu-emacs@HIDDEN
From: Thierry Volpiatto <thierry.volpiatto@HIDDEN>
Subject: Re: bug#15385: [Eshell] Directory completion overwrites preceding
 characters
Date: Sat, 21 Sep 2013 13:29:38 +0200
Organization: Emacs Helm
Lines: 18
Message-ID: <8761tu5s65.fsf@HIDDEN>
References: <mailman.2172.1379254394.10748.bug-gnu-emacs@HIDDEN>
 <87d2o2ddjh.fsf@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain
X-Complaints-To: usenet@HIDDEN
X-Gmane-NNTP-Posting-Host: 37.160.103.179
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
Cancel-Lock: sha1:QRzpvrD2Cree48tfHg+e7ivV6HQ=
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -1.0 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://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: <http://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.0 (-)

Aidan Gauland <aidalgol@HIDDEN> writes:

> The bug seems to be in pcomplete, line 1140 of pcomplete.el, to be
> exact:
>
>   (delete-char (- (length (comint-quote-filename stub))))

With helm completion enabled, this bug is not reproductible, if that
help you can look at the code here:
https://github.com/emacs-helm/helm/blob/master/helm-eshell.el

How to enable helm completion in eshell:
https://github.com/emacs-helm/helm/wiki#wiki-helmeshellcompletion

-- 
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 





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

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


Received: (at 15385) by debbugs.gnu.org; 21 Sep 2013 04:06:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 21 00:06:25 2013
Received: from localhost ([127.0.0.1]:52413 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VNESe-00037q-OX
	for submit <at> debbugs.gnu.org; Sat, 21 Sep 2013 00:06:25 -0400
Received: from goat.amuri.net ([203.99.132.195]:59707)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <aidalgol@HIDDEN>) id 1VNESb-00037e-2w
 for 15385 <at> debbugs.gnu.org; Sat, 21 Sep 2013 00:06:22 -0400
Received: from dimension8.tehua.net (unknown [49.143.231.163])
 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
 (No client certificate requested)
 (Authenticated sender: aidalgol@HIDDEN)
 by goat.amuri.net (Postfix) with ESMTPSA id 2ABE0FF389;
 Sat, 21 Sep 2013 16:08:07 +1200 (NZST)
From: Aidan Gauland <aidalgol@HIDDEN>
To: 15385 <at> debbugs.gnu.org
Subject: Re: bug#15385: [Eshell] Directory completion overwrites preceding
 characters
References: <mailman.2172.1379254394.10748.bug-gnu-emacs@HIDDEN>
Date: Sat, 21 Sep 2013 16:06:10 +1200
In-Reply-To: <mailman.2172.1379254394.10748.bug-gnu-emacs@HIDDEN> (Joost
 Kremers's message of "Sun, 15 Sep 2013 16:11:44 +0200")
Message-ID: <87d2o2ddjh.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 15385
Cc: Joost Kremers <joostkremers@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://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: <http://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.0 (+)

The bug seems to be in pcomplete, line 1140 of pcomplete.el, to be
exact:

  (delete-char (- (length (comint-quote-filename stub))))

`comint-quote-filename' is given a relative path, "~/Dro", and returning
an absolute path, "/home/joost/Dropbox/".  The length of this is then
passed to `delete-char' to clear the argument being completed, but the
length is wrong when it's a relative path, because
`comint-quote-filename' seems to always return an absolute path.

I'm not sure how to fix this without breaking something else or leaving
out other special cases, such as ${FOO}tm[TAB], because I still don't
really understand how pcomplete works.  I still want to sit down with
pcomplete for a while and document it (it was left undocumented along
with Eshell, of which it was originally a component), so unless someone
else can come up with a good fix, this bug will have to remain
outstanding for a while, unfortunately.

--Aidan

Joost Kremers <joostkremers@HIDDEN> writes:

> Starting from `emacs -Q', if I do
>
>    (setq eshell-cmpl-ignore-case t)
>
> and then start up a shell, TAB completion behaves incorrectly under some
> conditions.
>
> Specifically, I type a command such as:
>
>     $ cp ~/Dropbox/Work/Reading/Wilbur_Martinez2002.pdf ~/Dro
>
> At this point, I hit TAB to complete `~/Dro' and get:
>
>     $ cp ~/Dropbox/Work/Reading/Wilbur_Martine/home/joost/Dropbox/
>
> Note that the problem does *not* occur with the first file path. If I
> hit TAB to complete
>
>     $ cp ~/Dro
>
> then completion produces the correct result:
>
>     $ cp ~/Dropbox/
>
> It seems the problem occurs when the file path is the second argument on
> the command line, because if I type:
>
>     $ ls ~/Dropbox/Work/Literature/k/kim2002.pdf ~/dro
>
> and hit TAB to complete, the result is also:
>
>     $ ls ~/Dropbox/Work/Literature/k/ki/home/joost/Dropbox/
>
> It does not occur when there is a switch preceding the file path:
>
>     $ ls -l ~/dro
>
> completes fine.
>
> Thanks,
>
> Joost Kremers




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

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


Received: (at submit) by debbugs.gnu.org; 15 Sep 2013 14:12:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 15 10:12:25 2013
Received: from localhost ([127.0.0.1]:38609 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VLD3o-00027l-Bn
	for submit <at> debbugs.gnu.org; Sun, 15 Sep 2013 10:12:24 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48782)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <joostkremers@HIDDEN>) id 1VLD3l-00027T-B3
 for submit <at> debbugs.gnu.org; Sun, 15 Sep 2013 10:12:22 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <joostkremers@HIDDEN>) id 1VLD3b-0001GN-2D
 for submit <at> debbugs.gnu.org; Sun, 15 Sep 2013 10:12:16 -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,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:50724)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <joostkremers@HIDDEN>) id 1VLD3a-0001GF-UK
 for submit <at> debbugs.gnu.org; Sun, 15 Sep 2013 10:12:10 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:50488)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <joostkremers@HIDDEN>) id 1VLD3W-000416-0s
 for bug-gnu-emacs@HIDDEN; Sun, 15 Sep 2013 10:12:10 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <joostkremers@HIDDEN>) id 1VLD3O-0001Ee-Tj
 for bug-gnu-emacs@HIDDEN; Sun, 15 Sep 2013 10:12:05 -0400
Received: from out3-smtp.messagingengine.com ([66.111.4.27]:38711)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <joostkremers@HIDDEN>) id 1VLD3O-0001EJ-IB
 for bug-gnu-emacs@HIDDEN; Sun, 15 Sep 2013 10:11:58 -0400
Received: from compute6.internal (compute6.nyi.mail.srv.osa [10.202.2.46])
 by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id AB22220929
 for <bug-gnu-emacs@HIDDEN>; Sun, 15 Sep 2013 10:11:56 -0400 (EDT)
Received: from frontend2 ([10.202.2.161])
 by compute6.internal (MEProxy); Sun, 15 Sep 2013 10:11:56 -0400
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.fm; h=
 from:to:subject:date:message-id:mime-version:content-type; s=
 mesmtp; bh=ghlLbfUp1Uvjs3ZwkCKCIS1/TVI=; b=LTCa9mg9kWr676/+U7OCa
 BBQNEv7buQjRaNsp7of6F2bTSA0QR9RilS9CzL1HyqVFy0jJQfwYIhhKE/PeCro6
 q/QlhbBVg2b3iQTvRKHKRsDTgSUmTiqH4uQiSWk0oGomxolhNXGV6yFd3knDsz3K
 sUdbzAy8JyrY4WgQ9rWf4A=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=
 messagingengine.com; h=from:to:subject:date:message-id
 :mime-version:content-type; s=smtpout; bh=ghlLbfUp1Uvjs3ZwkCKCIS
 1/TVI=; b=RPTo88LTlD3JWB2Rj5DViLQeqniR0fpeqF6yFMx02NzSAr4vuhddLT
 5vB+Mlr+cB/99R3Ppu/1QcA9DL8eWO9f6aNcs6xqGhCjrQdErx+l2D3QX+nmN459
 muCVsCT8W7VpHY4yl/fQJeJCU3gaLK8XIxv7OAZj4K9sX0+hQ5ABQ=
X-Sasl-enc: VFedhv8FfkNPmIKGJ6s7WNV+LiL+6I0Xw5SLL+R1RAED 1379254315
Received: from eeenterprise.messagingengine.com (unknown [77.8.31.156])
 by mail.messagingengine.com (Postfix) with ESMTPA id 6391E6800C0
 for <bug-gnu-emacs@HIDDEN>; Sun, 15 Sep 2013 10:11:55 -0400 (EDT)
User-agent: mu4e 0.9.9.5; emacs 24.3.1
From: Joost Kremers <joostkremers@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [Eshell] Directory completion overwrites preceding characters
Date: Sun, 15 Sep 2013 16:11:44 +0200
Message-ID: <87fvt6p42n.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.3 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://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: <http://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: -4.3 (----)

This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgment at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from `emacs -Q':

==============================

Starting from `emacs -Q', if I do

   (setq eshell-cmpl-ignore-case t)

and then start up a shell, TAB completion behaves incorrectly under some
conditions.

Specifically, I type a command such as:

    $ cp ~/Dropbox/Work/Reading/Wilbur_Martinez2002.pdf ~/Dro

At this point, I hit TAB to complete `~/Dro' and get:

    $ cp ~/Dropbox/Work/Reading/Wilbur_Martine/home/joost/Dropbox/

Note that the problem does *not* occur with the first file path. If I
hit TAB to complete

    $ cp ~/Dro

then completion produces the correct result:

    $ cp ~/Dropbox/

It seems the problem occurs when the file path is the second argument on
the command line, because if I type:

    $ ls ~/Dropbox/Work/Literature/k/kim2002.pdf ~/dro

and hit TAB to complete, the result is also:

    $ ls ~/Dropbox/Work/Literature/k/ki/home/joost/Dropbox/

It does not occur when there is a switch preceding the file path:

    $ ls -l ~/dro

completes fine.

Thanks,

Joost Kremers

==============================



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'.
For information about debugging Emacs, please read the file
/usr/share/emacs/24.3/etc/DEBUG.


In GNU Emacs 24.3.1 (i686-pc-linux-gnu, GTK+ Version 3.4.2)
 of 2013-08-22 on chindi02, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11103000
System Description:	elementary OS Luna

Configured using:
 `configure '--build' 'i686-linux-gnu' '--build' 'i686-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.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3/site-lisp:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/i386-linux-gnu' '--with-x=yes'
 '--with-x-toolkit=gtk3' '--with-toolkit-scroll-bars'
 'build_alias=i686-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
 --param=ssp-buffer-size=4 -Wformat -Wformat-security
 -Werror=format-security -Wall' 'LDFLAGS=-Wl,-Bsymbolic-functions
 -Wl,-z,relro' 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: EShell

Minor modes in effect:
  tooltip-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 input:
( s e t q SPC c m <backspace> <backspace> e s h e l 
l - c m p l - i g n o r e - c a s e SPC t ) M-x e s 
h e l l <return> c d SPC d r o <tab> <backspace> <backspace> 
<backspace> D r o <tab> W o r <tab> R e <tab> <return> 
c d SPC . . / R e a <tab> <return> c p SPC W i l <tab> 
<tab> SPC ~ / D r o <tab> <M-backspace> D r o <C-tab> 
C-x b <return> C-x C-e C-x b <return> <tab> <M-backspace> 
d r o <tab> <M-backspace> <M-backspace> <M-backspace> 
<M-backspace> <M-backspace> e x i t <return> M-x e 
s h e l l <return> c d SPC d r o <tab> r e a <tab> 
<backspace> <backspace> <backspace> w o r <tab> r e 
a <tab> <return> c p SPC w i l b <tab> ~ / r <backspace> 
d r o <tab> <M-backspace> <M-backspace> <M-backspace> 
<M-backspace> <M-backspace> <M-backspace> c d <return> 
c d SPC ~ / d r o <tab> w o <tab> M-x r e p o r <tab> 
<return>

Recent messages:
Loading em-hist...done
Loading em-ls...done
Loading em-prompt...done
Loading em-script...done
Loading em-term...done
Loading em-unix...done
No completions of dro
t
No completions of /home/joost/dro
No completions of Dropbox/rea

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils pcmpl-unix em-unix pcomplete comint ansi-color
em-term term disp-table easymenu ehelp electric em-script em-prompt
em-ls em-hist em-pred em-glob em-dirs em-cmpl em-basic em-banner
em-alias ring esh-var esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg
eldoc help-fns esh-groups eshell esh-module esh-mode esh-util time-date
tooltip 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
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 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
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty emacs)

-- 
Joost Kremers
Life has its moments




Acknowledgement sent to Joost Kremers <joostkremers@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#15385; 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: Fri, 31 Oct 2014 17:00:04 UTC

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