Re: [PATCH] fix crash in path.c on Windows
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:46:06
René Scharfe [off-list ref] writes:
quoted hunk
@@ -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 */
...
}