git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 2/2] mingw: fix mingw_open_append to work with named pipes

From
JHJeff Hostetler <git@jeffhostetler.com>
Date
Sep 11, 2018, 14:25 UTC
Message-ID
<26f3d84d-cfa4-bb03-a2f8-d2e0fe5ad12e@jeffhostetler.com>
In-Reply-To
<xmqqbm95rp27.fsf@gitster-ct.c.googlers.com>
On 9/10/2018 6:00 PM, Junio C Hamano wrote:
Show 6 quoted lines
> Johannes Sixt <j6t@kdbg.org> writes:
> 
>>>    +#define IS_SBS(ch) (((ch) == '/') || ((ch) == '\\'))
> 
> I think you already have mingw_is_dir_sep() and its shorter alias
> is_dir_sep() available to you.
good catch. thanks.
Show 9 quoted lines
>>> +/*
>>> + * Does the pathname map to the local named pipe filesystem?
>>> + * That is, does it have a "//./pipe/" prefix?
>>> + */
>>> +static int mingw_is_local_named_pipe_path(const char *filename)
> 
> There is no need to prefix mingw_ to this function that is file
> local static.  Isn't is_local_named_pipe() descriptive and unique
> enough?
right. will do.
Show 23 quoted lines
>>> +{
>>> +	return (IS_SBS(filename[0]) &&
>>> +		IS_SBS(filename[1]) &&
>>> +		filename[2] == '.'  &&
>>> +		IS_SBS(filename[3]) &&
>>> +		!strncasecmp(filename+4, "pipe", 4) &&
>>> +		IS_SBS(filename[8]) &&
>>> +		filename[9]);
>>> +}
>>> +#undef IS_SBS
> 
> It is kind-of surprising that there hasn't been any existing need
> for a helper function that would allow us to write this function
> like so:
> 
> 	static int is_local_named_pipe(const char *path)
> 	{
> 		return path_is_in_directory(path, "//./pipe/");
> 	}
> 
> Not a suggestion to add such a thing; as long as we know there is no
> other codepath that would benefit from having one, a generalization
> like that can and should wait.

Yeah, I don't think we need something that general just yet. Named pipes exist in a special namespace using the UNC/network-share syntax (rather than the DOS drive-letter syntax), and we don't do much with UNC paths yet.

Perhaps, later we could have something to try splitting a UNC path into <server>, <volume>, and <relative-path> and then have is_local_named_pipe() verify the first 2 are as expected. Or have a function like is_path_in_volume(path, server, volume) that does the tests without cutting up strings and allocating. We could do either, but I don't think we need to be that general yet.

Thanks,
Jeff
		
Previous: Junio C HamanoNext: Jeff Hostetler via GitGitGadget
Message 18 of 21 in “Fixup for js/mingw-o-append”
  1. 0/2 Fixup for js/mingw-o-appendJeff Hostetler via GitGitGadget, Sep 7, 2018
  2. 1/2 t0051: test GIT_TRACE to a windows named pipeJeff Hostetler via GitGitGadget, Sep 7, 2018
  3. Sebastian SchuberthSep 9, 2018
  4. Jeff HostetlerSep 10, 2018
  5. 2/2 mingw: fix mingw_open_append to work with named pipesJeff Hostetler via GitGitGadget, Sep 7, 2018
  6. Johannes SixtSep 8, 2018
  7. Johannes SixtSep 8, 2018
  8. Jeff HostetlerSep 10, 2018
  9. Junio C HamanoSep 10, 2018
  10. Jeff HostetlerSep 10, 2018
  11. Jeff HostetlerSep 7, 2018
  12. 0/2 Fixup for js/mingw-o-appendJeff Hostetler via GitGitGadget, Sep 10, 2018
  13. 1/2 t0051: test GIT_TRACE to a windows named pipeJeff Hostetler via GitGitGadget, Sep 10, 2018
  14. 2/2 mingw: fix mingw_open_append to work with named pipesJeff Hostetler via GitGitGadget, Sep 10, 2018
  15. Johannes SixtSep 10, 2018
  16. Jeff HostetlerSep 10, 2018
  17. Junio C HamanoSep 10, 2018
  18. Jeff HostetlerSep 11, 2018
  19. 0/2 Fixup for js/mingw-o-appendJeff Hostetler via GitGitGadget, Sep 11, 2018
  20. 1/2 t0051: test GIT_TRACE to a windows named pipeJeff Hostetler via GitGitGadget, Sep 11, 2018
  21. 2/2 mingw: fix mingw_open_append to work with named pipesJeff Hostetler via GitGitGadget, Sep 11, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.