Re: [PATCH] fix crash in path.c on Windows
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 4, 2009, 23:51 UTC
- Message-ID
- <7vbpthlq0w.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <498A1E1E.8010901@lsrfire.ath.cx>
René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:
Show 9 quoted lines
> @@ -387,7 +387,7 @@ int normalize_absolute_path(char *buf, const char *path)
> assert(path);
>
> while (*comp_start) {
> - assert(*comp_start == '/');
> + assert(is_absolute_path(comp_start));
> while (*++comp_end && *comp_end != '/')
> ; /* nothing */
> comp_len = comp_end - comp_start;This change does not make sense to me. The assert is about the initial iteration beginning at the "root" level, and at the same time previous iteration ended at dir_sep. On mingw you would probably need these two as separate tests. In other words, I would understand if the fix were like this:
if (it begins with dos_prefix) {
/* this is never true outside windows */
copy the dos prefix out and advance comp_start as
necessary;
}
while (*comp_start) {
assert(is_dir_sep(*comp_start));
while (*++comp_end && !is_dir_sep(*comp_end))
; /* nothing */
...
}