Re: [PATCH] daemon, path.c: fix a bug with ~ in repo paths
From: Junio C Hamano <hidden>
Date: 2016-10-21 15:59:01
Duy Nguyen [off-list ref] writes:
The amount of changes is unbelievable for fixing such a rare case though. I wonder if we can just detect this in daemon.c and pass "./~foo/bar" instead of "~foo/bar" to enter_repo() in non-strict mode to "disable" expand_user_path(). If it works, it's much simpler changes (even though a bit hacky)
Conceptually, it ought to be updating the code that says "Does it begin with a tilde? Then try to do user-path expansion and fail if that is not enabled and if it succeeds use the resulting directory" to "Is user-path enabled and does it begin with a tilde? Then try to do user-path expansion and if it succeeds use the resulting directory". Compared to that mental model we have with this codepath, I agree that the change does look quite invasive and large. It is OK for a change to be large, as long as the end result is easier to read and understand than the original. I am undecided if that is the case with this patch, though. Also I am a bit worried about the change in the semantics. While it is not the best way to achieve this, the server operators could use it as a way to add directories whose contents need to be hidden to give them names that begin with a tilde without enabling user-path expansion. This change may be a new and useful feature for Luke, but to these server operators this change can be a new bug---it is probably a minor new bug as they can work it around by using other means to hide these directories, though.