From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#54776: 28.1; shell-resync-dirs hangs Date: Sat, 09 Apr 2022 12:11:50 +0200 Message-ID: <87r1664lcp.fsf@gnus.org> References: <875ynj90hx.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20926"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: "Kevin K. Lin" , 54776@debbugs.gnu.org To: Glenn Morris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 09 12:13:23 2022 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 1nd85r-0005G8-0o for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Apr 2022 12:13:23 +0200 Original-Received: from localhost ([::1]:39996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nd85o-0003eK-2Y for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Apr 2022 06:13:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nd85X-0003dv-00 for bug-gnu-emacs@gnu.org; Sat, 09 Apr 2022 06:13:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42872) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nd85W-0003RT-H9 for bug-gnu-emacs@gnu.org; Sat, 09 Apr 2022 06:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nd85W-0005nd-B3 for bug-gnu-emacs@gnu.org; Sat, 09 Apr 2022 06:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Apr 2022 10:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54776 X-GNU-PR-Package: emacs Original-Received: via spool by 54776-submit@debbugs.gnu.org id=B54776.164949912422225 (code B ref 54776); Sat, 09 Apr 2022 10:13:02 +0000 Original-Received: (at 54776) by debbugs.gnu.org; 9 Apr 2022 10:12:04 +0000 Original-Received: from localhost ([127.0.0.1]:36769 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nd84Z-0005mP-Un for submit@debbugs.gnu.org; Sat, 09 Apr 2022 06:12:04 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:40832) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nd84X-0005lt-M4 for 54776@debbugs.gnu.org; Sat, 09 Apr 2022 06:12:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Qk1MowgTJvfLav7ZDfN8qBrGfLyMYkuq+kp4Cj6e7Uo=; b=V6He9hbeuWtQvqUiqzpKuMFcSH q61kDfh2Fp1FBbHbrIYabpYPUZhqnzWsQWweodKQfSAyz/Roc33Vg8e9qM0OhijX/yX9nb8q/Psbw TqXBgygCszxP6MU1b/GnCR1lh5YL0hqdnv7UnboIhH3pCDBQ+jStZ7uNnmCMaPM6UfAo=; Original-Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nd84O-0000YT-16; Sat, 09 Apr 2022 12:11:54 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAIVBMVEXh3dz7+vnU0dC0 r62BfHlsZ2OZlJLDwL7BvbuFgH3///+rjTqgAAAAAWJLR0QKaND0VgAAAAd0SU1FB+YECQksEkEY mhwAAAGZSURBVDjLfZRNS8QwEIYzXRCPMxHUY5JK9djdaFhvotSz6Pa+bd3gURG8iyAeBRd/r7Xd dqeSmh768WQy7zudRAjaDiEAQUD7rICDZhDVVLDvfIDQY6CPgBGwB2hECCg9yRbLHqgux1HhNYmX qpsnNkAcFdPf++4cekvtkoe6ICTEDzsAtV95S6gxW+TtapvkMqX9fEo76zxbCq7qYPKdXVi7yrPb oVyc7udFHRivXv/4SPTqbmC/NxjHDwYAQ7WipEyAMI04kGrWqqb4eDZI7lzZvE4qGxcM2LfrVUki iivnK83Aif9c37i59Ul57su2Jg14Py39BUSyTLyfEQMU2XVq1F690qwrb1t2aUs0T8Z5758GzSDt 3D/rOHJdADGDh5UKt0/i0mD7UOUs6x8WcXnvIATw6+xdB4HzLgyer9w0CMz3VxoCJN18a4T7kB+G BTCAZuCcSY+4jbGtpsa2GgOIBBACApud/BfAbzbo/w8o8drNeDSg024iA0ohqEh2KsWYqn+Aas+V gc/6DNK1SMCNzFYXQXP9AEtfa7vhEYvpAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTA0LTA5VDA5 OjQ0OjE4KzAwOjAw1z07pwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0wNC0wOVQwOTo0NDoxOCsw MDowMKZggxsAAAAASUVORK5CYII= X-Now-Playing: Laura Jean's _Eden Land_: "Adam" In-Reply-To: (Glenn Morris's message of "Fri, 08 Apr 2022 11:24:44 -0400") 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:229607 Archived-At: --=-=-= Content-Type: text/plain Glenn Morris writes: > Are you sure this issue isn't due to the changes from > https://debbugs.gnu.org/23324, which were applied in Emacs 28.1 (which > would make it a regression from Emacs 27, no)? Good catch. Kevin, could you try reverting 90e65c826fa (or applying (in reverse) the attached patch) and see whether that fixes the problem? If so, we could revert the patch for Emacs 28.2. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=resync.patch commit 90e65c826fab2092ad2099d7763538194c93e021 Author: Noah Friedman AuthorDate: Wed Aug 19 15:59:59 2020 +0200 Commit: Lars Ingebrigtsen CommitDate: Wed Aug 19 15:59:59 2020 +0200 Make shell-resync-dirs handle whitespace in directory names * lisp/shell.el (shell-resync-dirs): Correctly handle whitespace in directory names (bug#23324). diff --git a/lisp/shell.el b/lisp/shell.el index 301a8cb083..9667dab2af 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -1035,25 +1035,41 @@ shell-resync-dirs (accept-process-output proc) (goto-char pt))) (goto-char pmark) (delete-char 1) ; remove the extra newline - ;; That's the dirlist. grab it & parse it. - (let* ((dl (buffer-substring (match-beginning 2) (1- (match-end 2)))) - (dl-len (length dl)) - (ds '()) ; new dir stack - (i 0)) - (while (< i dl-len) - ;; regexp = optional whitespace, (non-whitespace), optional whitespace - (string-match "\\s *\\(\\S +\\)\\s *" dl i) ; pick off next dir - (setq ds (cons (concat comint-file-name-prefix - (substring dl (match-beginning 1) - (match-end 1))) - ds)) - (setq i (match-end 0))) - (let ((ds (nreverse ds))) - (with-demoted-errors "Couldn't cd: %s" - (shell-cd (car ds)) - (setq shell-dirstack (cdr ds) - shell-last-dir (car shell-dirstack)) - (shell-dirstack-message))))) + ;; That's the dirlist. Grab it & parse it. + (let* ((dls (buffer-substring-no-properties + (match-beginning 0) (1- (match-end 0)))) + (dlsl nil) + (pos 0) + (ds nil)) + ;; Split the dirlist into whitespace and non-whitespace chunks. + ;; dlsl will be a reversed list of tokens. + (while (string-match "\\(\\S-+\\|\\s-+\\)" dls pos) + (push (match-string 1 dls) dlsl) + (setq pos (match-end 1))) + + ;; Prepend trailing entries until they form an existing directory, + ;; whitespace and all. Discard the next whitespace and repeat. + (while dlsl + (let ((newelt "") + tem1 tem2) + (while newelt + ;; We need tem1 because we don't want to prepend + ;; `comint-file-name-prefix' repeatedly into newelt via tem2. + (setq tem1 (pop dlsl) + tem2 (concat comint-file-name-prefix tem1 newelt)) + (cond ((file-directory-p tem2) + (push tem2 ds) + (when (string= " " (car dlsl)) + (pop dlsl)) + (setq newelt nil)) + (t + (setq newelt (concat tem1 newelt))))))) + + (with-demoted-errors "Couldn't cd: %s" + (shell-cd (car ds)) + (setq shell-dirstack (cdr ds) + shell-last-dir (car shell-dirstack)) + (shell-dirstack-message)))) (if started-at-pmark (goto-char (marker-position pmark))))) ;; For your typing convenience: --=-=-=--