Re: [issue?]'git branch -D' case sensitive issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 14, 2016 at 09:21:46AM -0800, Junio C Hamano wrote:

> Torsten Bögershausen <tboegi@xxxxxx> writes:
> 
> > No, this is typically what we observe on a case insensitive FS.
> 
> There is an interesting bit in delete_branches::builtin/branch.c
> 
> 	if (kinds == FILTER_REFS_BRANCHES && !strcmp(head, bname.buf)) {
> 		error(_("Cannot delete the branch '%s' "
> 		      "which you are currently on."), bname.buf);
> 		ret = 1;
> 		continue;
> 	}
> 
> The strcmp() does not protect you from attempting to remove "FrOtZ"
> branch when you are on (and more importantly, Git thinks you are on)
> "frotz" branch.  A case-insensitive system then can tell Git that
> the request to remove "refs/heads/FrOtZ" succeeded, even though in
> reality it didn't have such file, and silently "refs/heads/frotz"
> gets removed instead.  You can end up removing your current branch
> that way.

This seemed eerily familiar. And indeed, there's some discussion in:

  http://article.gmane.org/gmane.comp.version-control.git/276506

Changing that strcmp to strcmp_icase() is still wrong, though I suspect
it's less wrong in practice (and errs on the side of caution). But I
think there are probably a lot of similar problems lurking.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]