All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Ben Peart <Ben.Peart@microsoft.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
	"gitster@pobox.com" <gitster@pobox.com>
Subject: Re: [PATCH v1] handle lower case drive letters on Windows
Date: Thu, 12 Jul 2018 15:59:30 +0200 (DST)	[thread overview]
Message-ID: <nycvar.QRO.7.76.6.1807121556030.75@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <20180711175420.16940-1-benpeart@microsoft.com>

Hi Ben,

On Wed, 11 Jul 2018, Ben Peart wrote:

> Teach test-drop-caches to handle lower case drive letters on Windows.

Maybe mention that you can trigger this by using a lower case drive letter
in Powershell (CMD normalizes your path, Powershell does not).

> diff --git a/t/helper/test-drop-caches.c b/t/helper/test-drop-caches.c
> index d6bcfddf13..37047189c3 100644
> --- a/t/helper/test-drop-caches.c
> +++ b/t/helper/test-drop-caches.c
> @@ -16,7 +16,7 @@ static int cmd_sync(void)
>  	if ((0 == dwRet) || (dwRet > MAX_PATH))
>  		return error("Error getting current directory");
>  
> -	if ((Buffer[0] < 'A') || (Buffer[0] > 'Z'))
> +	if ((toupper(Buffer[0]) < 'A') || (toupper(Buffer[0]) > 'Z'))
>  		return error("Invalid drive letter '%c'", Buffer[0]);

This is a rather incomplete test, as it does not even test for the colon
after the drive letter.

But I guess the more common case where this code path triggers the error
is when your current directory is a UNC path to a file share (again, only
possible in Powershell, CMD does not let you do that unless you play
serious tricks).

So maybe a much better idea is to use our `has_dos_drive_prefix()`
function:

	if (!has_dos_drive_prefix(Buffer))
		return error("'%s': invalid drive letter", Buffer);

Ciao,
Johannes

  parent reply	other threads:[~2018-07-12 13:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-11 17:54 [PATCH v1] handle lower case drive letters on Windows Ben Peart
2018-07-11 17:59 ` Stefan Beller
2018-07-11 19:07   ` Ben Peart
2018-07-11 20:11     ` Junio C Hamano
2018-07-11 21:30       ` Ben Peart
2018-07-11 21:41 ` [PATCH v2] " Ben Peart
2018-07-12 13:59 ` Johannes Schindelin [this message]
2018-07-12 16:33   ` [PATCH v1] " Junio C Hamano
2018-07-12 15:44 ` [PATCH v3] " Ben Peart
2018-07-12 19:12   ` Junio C Hamano
2018-07-12 19:23     ` Ben Peart
2018-07-12 19:53       ` Junio C Hamano
2018-07-12 20:09         ` Ben Peart
2018-07-12 20:34           ` Junio C Hamano
2018-07-14 22:15             ` Johannes Schindelin

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=nycvar.QRO.7.76.6.1807121556030.75@tvgsbejvaqbjf.bet \
    --to=johannes.schindelin@gmx.de \
    --cc=Ben.Peart@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.