From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#70012: shell-resync-dirs broken on windows Date: Fri, 29 Mar 2024 16:14:43 +0300 Message-ID: <86ttkpdvss.fsf@gnu.org> References: <86v859hr60.fsf@gnu.org> <86plvehmea.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13003"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70012@debbugs.gnu.org To: Sam Steingold Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 29 14:15:25 2024 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 1rqC4q-00037s-Mj for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 29 Mar 2024 14:15:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rqC4V-0001Tj-HF; Fri, 29 Mar 2024 09:15:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rqC4T-0001Sz-D2 for bug-gnu-emacs@gnu.org; Fri, 29 Mar 2024 09:15:01 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rqC4T-0006kx-3t for bug-gnu-emacs@gnu.org; Fri, 29 Mar 2024 09:15:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rqC4T-0000kG-S5 for bug-gnu-emacs@gnu.org; Fri, 29 Mar 2024 09:15:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Mar 2024 13:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70012 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug wontfix Original-Received: via spool by 70012-submit@debbugs.gnu.org id=B70012.17117180972835 (code B ref 70012); Fri, 29 Mar 2024 13:15:01 +0000 Original-Received: (at 70012) by debbugs.gnu.org; 29 Mar 2024 13:14:57 +0000 Original-Received: from localhost ([127.0.0.1]:41931 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rqC4O-0000jd-N3 for submit@debbugs.gnu.org; Fri, 29 Mar 2024 09:14:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59554) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rqC4K-0000jL-T6 for 70012@debbugs.gnu.org; Fri, 29 Mar 2024 09:14:54 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rqC4E-0006k6-3Q; Fri, 29 Mar 2024 09:14:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=YgvjDAUT3ekh7wyLanSY1c7BtWOhmRtqZbsRWWvdQTU=; b=TekCIi7oVgP/ Rh6PSlD5q0ko0KhUw4WLSViQ+f91J0PP09hbYje/fSptdo0U/EZ8LCa7MmlTpBbUXTjZS6S52RZhI Osb6qxBa/+C37YTg0udG/5zIRG2sgjdztWTiHYQfS5cNu8IKp58tJ+uTqN2CHO3c1Rk0jxOIioRXG Cub93sLwqsgYJwhlCp0LKBvV4RB4ZSfnj75Hk/KS4UA2ox4IgB6xOIa0bElN8Vfonuowbn9DO9UVk a6r9L2fF7NkNO0WCl40StjKDvygLZ3rTjCgIVFFflWLGCuSBV+zOpqdfOEgGo4lvOY+3BgyRnUKfV Cxl8uTa1DEtbD0iM0OaFnA==; In-Reply-To: (message from Sam Steingold on Fri, 29 Mar 2024 08:17:26 -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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:282293 Archived-At: > From: Sam Steingold > Date: Fri, 29 Mar 2024 08:17:26 -0400 > Cc: 70012@debbugs.gnu.org > > On Thu, Mar 28, 2024, 02:59 Eli Zaretskii wrote: > > > From: Sam Steingold > > > which bash builds are supported on windows? > > > > Any native build of Bash would be supported. Except that I'm not > > aware of any such port of Bash, unfortunately. > > I admire your sense of humor. Btw, I do have a (very old) native build of Bash on my system, but I don't use it as it is quite buggy, and cannot reliably run complicated shell scripts. IOW, it isn't like no one tried to produce a native port, they just didn't do well enough... > > Maybe the MSYS or Cygwin Bash can be told to output Windows-format > > file names with drive letters? I know that "pwd -W", for example, > > shows the current directory in Windows format, so maybe there are > > other similar tricks? > > Please upvote https://github.com/msys2/MSYS2-packages/issues/4472 Done. > finally, the following patch fixes the bug for me: > > --- shell.el~ 2024-03-06 12:13:15.134281800 -0500 > +++ shell.el 2024-03-28 11:50:32.920026000 -0400 > @@ -711,6 +711,7 @@ > ((string-equal shell "ksh") "echo $PWD ~-") > ;; Bypass any aliases. TODO all shells could use this. > ((string-equal shell "bash") "command dirs") > + ((string-equal shell "bash.exe") "command pwd -W") > ((string-equal shell "zsh") "dirs -l") > (t "dirs"))) > ;; Bypass a bug in certain versions of bash. > > may I push it? That's not really TRT, because it assumes every bash.exe is an MSYS program (which might not be true: there's a Cygwin Bash, for example). And we don't need to make such assumptions: (w32-application-type (executable-find "bash.exe")) => msys I'm okay with installing the fix after you change it to use w32-application-type (and verifying that it works in your case, of course: I don't have MSYS2 Bash installed). > Incidentally, why do you use `dirs` instead of `pwd` there? > you use only the last dir anyway. I don't know, I'm not familiar with shell.el well enough. Just by looking at the code, shell-resync-dirs does need to know all the stack, so it could refresh the value of shell-dirstack, no?