From: Jeff Hostetler <git@jeffhostetler.com>
To: Junio C Hamano <gitster@pobox.com>, Johannes Sixt <j6t@kdbg.org>
Cc: jeffhost@microsoft.com,
Jeff Hostetler via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH v2 2/2] mingw: fix mingw_open_append to work with named pipes
Date: Tue, 11 Sep 2018 10:25:20 -0400 [thread overview]
Message-ID: <26f3d84d-cfa4-bb03-a2f8-d2e0fe5ad12e@jeffhostetler.com> (raw)
In-Reply-To: <xmqqbm95rp27.fsf@gitster-ct.c.googlers.com>
On 9/10/2018 6:00 PM, Junio C Hamano wrote:
> 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.
>>> +/*
>>> + * 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.
>>> +{
>>> + 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
next prev parent reply other threads:[~2018-09-11 14:25 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-07 18:19 [PATCH 0/2] Fixup for js/mingw-o-append Jeff Hostetler via GitGitGadget
2018-09-07 18:19 ` [PATCH 1/2] t0051: test GIT_TRACE to a windows named pipe Jeff Hostetler via GitGitGadget
2018-09-09 7:28 ` Sebastian Schuberth
2018-09-10 13:21 ` Jeff Hostetler
2018-09-07 18:19 ` [PATCH 2/2] mingw: fix mingw_open_append to work with named pipes Jeff Hostetler via GitGitGadget
2018-09-08 9:26 ` Johannes Sixt
2018-09-08 18:31 ` Johannes Sixt
2018-09-10 15:44 ` Jeff Hostetler
2018-09-10 16:42 ` Junio C Hamano
2018-09-10 16:55 ` Jeff Hostetler
2018-09-07 18:36 ` [PATCH 0/2] Fixup for js/mingw-o-append Jeff Hostetler
2018-09-10 17:05 ` [PATCH v2 " Jeff Hostetler via GitGitGadget
2018-09-10 17:05 ` [PATCH v2 1/2] t0051: test GIT_TRACE to a windows named pipe Jeff Hostetler via GitGitGadget
2018-09-10 17:05 ` [PATCH v2 2/2] mingw: fix mingw_open_append to work with named pipes Jeff Hostetler via GitGitGadget
2018-09-10 19:45 ` Johannes Sixt
2018-09-10 20:07 ` Jeff Hostetler
2018-09-10 22:00 ` Junio C Hamano
2018-09-11 14:25 ` Jeff Hostetler [this message]
2018-09-11 20:05 ` [PATCH v3 0/2] Fixup for js/mingw-o-append Jeff Hostetler via GitGitGadget
2018-09-11 20:06 ` [PATCH v3 1/2] t0051: test GIT_TRACE to a windows named pipe Jeff Hostetler via GitGitGadget
2018-09-11 20:06 ` [PATCH v3 2/2] mingw: fix mingw_open_append to work with named pipes Jeff Hostetler via GitGitGadget
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=26f3d84d-cfa4-bb03-a2f8-d2e0fe5ad12e@jeffhostetler.com \
--to=git@jeffhostetler.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=j6t@kdbg.org \
--cc=jeffhost@microsoft.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.
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 NNTP newsgroup(s).