From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#47678: 27.1; `completion-boundaries` assertion failure for file Date: Mon, 12 Apr 2021 19:28:00 -0400 Message-ID: References: <8d537117-d036-ad84-e013-d98efb3ae0c4@daniel-mendler.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19186"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 47678@debbugs.gnu.org To: Daniel Mendler Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 13 01:29:10 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lW5zS-0004rj-3J for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 13 Apr 2021 01:29:10 +0200 Original-Received: from localhost ([::1]:60092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lW5zR-00015n-1Z for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 12 Apr 2021 19:29:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lW5zK-00015g-Iu for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2021 19:29:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46775) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lW5zK-0005qV-C0 for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2021 19:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lW5zK-0005pe-7H for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2021 19:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Apr 2021 23:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47678 X-GNU-PR-Package: emacs Original-Received: via spool by 47678-submit@debbugs.gnu.org id=B47678.161827009122360 (code B ref 47678); Mon, 12 Apr 2021 23:29:02 +0000 Original-Received: (at 47678) by debbugs.gnu.org; 12 Apr 2021 23:28:11 +0000 Original-Received: from localhost ([127.0.0.1]:58321 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lW5yV-0005oZ-7u for submit@debbugs.gnu.org; Mon, 12 Apr 2021 19:28:11 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:43315) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lW5yT-0005oM-T0 for 47678@debbugs.gnu.org; Mon, 12 Apr 2021 19:28:10 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 549034416F9; Mon, 12 Apr 2021 19:28:04 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 5C683440FB4; Mon, 12 Apr 2021 19:28:02 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1618270082; bh=TKY6x0CwFJwUMINFda4dBIpgMcS8ZUJbuBNJAmiaP9k=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=j2zX4vsHBdSu5VBQvfEtr6jFrBDj04WJScV6FHVMyDP3tFYryOw4ASSGbwqXtv9B1 6Xlpk4GVxxxTONm8WmjL5eXHdhuIc2T4Wu93lBVirZldeoI/JVc+KnZunoOZ+xuH5b 0XgC86I4S0It9WAfNdN0mGDm5Qcn3kP9spAotjmCZRroDruLIXUYiNm9wJ8iW/UGDW cHkM9tFXG03dTqSAuFRMIxL4Z9/qESRa5Z9fjvbhyg+GvJSkzdOs3amU+S1BHVgtf6 YoUOJstvD3ZU9ZJIzw2/RdYcnifJ0SNxFV3OkCuO4UqAEVJQtvBtJYvQKriwST3o1Z XheJwJ/2MEUYw== Original-Received: from alfajor (104-222-126-84.cpe.teksavvy.com [104.222.126.84]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 194CD120434; Mon, 12 Apr 2021 19:28:02 -0400 (EDT) In-Reply-To: <8d537117-d036-ad84-e013-d98efb3ae0c4@daniel-mendler.de> (Daniel Mendler's message of "Fri, 9 Apr 2021 22:35:28 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:203939 Archived-At: > 2. Press "C-x C-f" > 3. Enter the path "~//" > 4. Move the point between the slashes, "~/|/" > 5. Press "C-." Thanks! [ It would have helped to say what happens for you there. ] > The function `test-boundaries' should determine the completion > boundaries correctly. I assume that the function `completion-boundaries' > should never fail with an error. [ From this I can guess that you maybe got some kind of error? Including a backtrace or the text of the error or some description of the error would have been helpful. ] I installed the patch below, which seems to fix the immediate problem I managed to reproduce, but it might lead to further problems down the road. Stefan diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 5f594679ca..c900b0d7ce 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -488,8 +488,17 @@ completion-table-with-quoting (qsuffix (cdr action)) (ufull (if (zerop (length qsuffix)) ustring (funcall unquote (concat string qsuffix)))) - (_ (cl-assert (string-prefix-p ustring ufull))) - (usuffix (substring ufull (length ustring))) + ;; If (not (string-prefix-p ustring ufull)) we have a problem: + ;; the unquoting the qfull gives something "unrelated" to ustring. + ;; E.g. "~/" and "/" where "~//" gets unquoted to just "/" (see + ;; bug#47678). + ;; In that case we can't even tell if we're right before the + ;; "/" or right after it (aka if this "/" is from qstring or + ;; from qsuffix), which which usuffix to use is very unclear. + (usuffix (if (string-prefix-p ustring ufull) + (substring ufull (length ustring)) + ;; FIXME: Maybe "" is preferable/safer? + qsuffix)) (boundaries (completion-boundaries ustring table pred usuffix)) (qlboundary (car (funcall requote (car boundaries) string))) (qrboundary (if (zerop (cdr boundaries)) 0 ;Common case.