git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric DeCosta <edecosta@mathworks.com>
To: Jeff Hostetler <git@jeffhostetler.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Eric DeCosta via GitGitGadget <gitgitgadget@gmail.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: RE: [PATCH] fsmonitor: handle differences between Windows named pipe functions
Date: Thu, 6 Apr 2023 19:08:50 +0000	[thread overview]
Message-ID: <BL0PR05MB55713A00DEB97375BDC6D1DAD9919@BL0PR05MB5571.namprd05.prod.outlook.com> (raw)
In-Reply-To: <b9cf67e4-22a7-2ff0-8310-9223bea10d6d@jeffhostetler.com>



> -----Original Message-----
> From: Jeff Hostetler <git@jeffhostetler.com>
> Sent: Monday, March 27, 2023 11:02 AM
> To: Johannes Schindelin <Johannes.Schindelin@gmx.de>; Eric DeCosta via
> GitGitGadget <gitgitgadget@gmail.com>
> Cc: git@vger.kernel.org; Eric DeCosta <edecosta@mathworks.com>
> Subject: Re: [PATCH] fsmonitor: handle differences between Windows
> named pipe functions
> 
> 
> 
> On 3/27/23 7:37 AM, Johannes Schindelin wrote:
> > Hi Eric,
> >
> > On Fri, 24 Mar 2023, Eric DeCosta via GitGitGadget wrote:
> >
> >> From: Eric DeCosta <edecosta@mathworks.com>
> >>
> >> CreateNamedPipeW is perfectly happy accepting pipe names with
> >> seemingly embedded escape charcters (e.g. \b), WaitNamedPipeW is not
> >> and incorrectly returns ERROR_FILE_NOT_FOUND when clearly a named
> >> pipe, succesfully created with CreateNamedPipeW, exists.
> >>
> >> For example, this network path is problemmatic:
> >> \\batfs-sb29-cifs\vmgr\sbs29\my_git_repo
> >>
> >> In order to work around this issue, rather than using the path to the
> >> worktree directly as the name of the pipe, instead use the hash of
> >> the worktree path.
> >
> > This is a rather large deviation from the other platforms, and it has
> > an unwanted side effect: Git for Windows' installer currently
> > enumerates the named pipes to figure out which FSMonitor instances
> > need to be stopped before upgrading. It has to do that because it
> > would otherwise be unable to overwrite the Git executable. And it
> > needs to know the paths [*1*] so that it can stop the FSMonitors
> > gracefully (as opposed to terminating them and risk interrupting them
> while they serve a reply to a Git client).
> >
> > A much less intrusive change (that would not break Git for Windows'
> > installer) would be to replace backslashes by forward slashes in the path.
> >
> > Please do that instead.
> >
> > Ciao,
> > Johannes
> >
> > Footnote *1*: If you think that the Git for Windows installer could
> > simply enumerate the process IDs of the FSMonitor instances and then
> > look for their working directories: That is not a viable option. Not
> > only does the Windows-based FSMonitor specifically switch to the
> > parent directory (to avoid blocking the removal of a Git directory
> > merely by running the process in said directory), even worse: there is
> > no officially-sanctioned way to query a running process' current
> > working directory (the only way I know of involves injecting a remote
> > thread! Which will of course risk being labeled as malware by current anti-
> malware solutions).
> 
> Agreed. Please use forward slashes.
> 
> Thanks,
> Jeff
> 

I have misdiagnosed the problem. Here are my most recent findings:

The problem is the leading double-slashes for repos that resolve to remote filesystems. i.e. if S:\myrepo resolves to \\some-server\some-dir\myrepo then the path passed to initialize_pipe_name is //some-server/some-dir/myrepo

Regardless of what type or how many slashes appear after \\.\pipe\ the pipe name, as reported from PowerShell, is always \\.\\pipe\\some-server\some-dir\myrepo and WaitNamedPipeW returns ERROR_FILE_NOT_FOUND

If I skip over the first leading slash an use /some-server/some-dir/myrepo I get the same pipe name as before, WaitNamedPipeW is happy and commands like git fsmonitor--daemon status correctly report that the daemon is watching the repo.

-Eric

  parent reply	other threads:[~2023-04-06 19:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24 17:14 [PATCH] fsmonitor: handle differences between Windows named pipe functions Eric DeCosta via GitGitGadget
2023-03-27 11:37 ` Johannes Schindelin
2023-03-27 15:02   ` Jeff Hostetler
2023-03-27 16:08     ` Junio C Hamano
2023-04-06 19:08     ` Eric DeCosta [this message]
2023-04-07 20:55       ` Jeff Hostetler
2023-04-10 19:46 ` [PATCH v2] " Eric DeCosta via GitGitGadget
2023-04-22 20:00   ` Eric DeCosta
2023-04-26 20:33     ` Jeff Hostetler
2023-04-27 13:45       ` Jeff Hostetler
2023-05-08 20:30       ` Eric DeCosta
2023-05-15 21:50         ` Jeff Hostetler

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: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=BL0PR05MB55713A00DEB97375BDC6D1DAD9919@BL0PR05MB5571.namprd05.prod.outlook.com \
    --to=edecosta@mathworks.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@jeffhostetler.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    /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://80x24.org/mirrors/git.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).