unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Sam Steingold <sds@gnu.org>
Cc: 70012@debbugs.gnu.org
Subject: bug#70012: shell-resync-dirs broken on windows
Date: Fri, 29 Mar 2024 16:14:43 +0300	[thread overview]
Message-ID: <86ttkpdvss.fsf@gnu.org> (raw)
In-Reply-To: <CAFsbZ7axc=c7eovza+ypgS4vKLtTzCcv+bBnc4d-4Pb=jG-+nw@mail.gmail.com> (message from Sam Steingold on Fri, 29 Mar 2024 08:17:26 -0400)

> From: Sam Steingold <sds@gnu.org>
> Date: Fri, 29 Mar 2024 08:17:26 -0400
> Cc: 70012@debbugs.gnu.org
> 
> On Thu, Mar 28, 2024, 02:59 Eli Zaretskii <eliz@gnu.org> wrote:
> > > From: Sam Steingold <sds@gnu.org>
> > > 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.

<Bows>

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?





  reply	other threads:[~2024-03-29 13:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26 16:25 bug#70012: shell-resync-dirs broken on windows Sam Steingold
2024-03-26 16:52 ` Eli Zaretskii
2024-03-27 23:37   ` Sam Steingold
2024-03-28  6:59     ` Eli Zaretskii
2024-03-29 12:17       ` Sam Steingold
2024-03-29 13:14         ` Eli Zaretskii [this message]
2024-03-29 14:54           ` Sam Steingold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86ttkpdvss.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=70012@debbugs.gnu.org \
    --cc=sds@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).