author | Jonathan Nieder <jrnieder@gmail.com> | |
Thu, 13 Jan 2011 02:28:09 +0000 (20:28 -0600) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 13 Jan 2011 19:26:09 +0000 (11:26 -0800) | ||
commit | a93e530184b3f7ae9d9bfb0e569734687f8d1c0b | |
tree | 21ebaba78fd780dabd8bcc2357499d40bd11adfb | tree | snapshot |
parent | 92fda79ed048d2d37e760e7a1b6055b2fc801ee3 | commit | diff |
unpack-trees: handle lstat failure for existing file
When check_leading_path notices a file in the way of a new entry to be
checked out, verify_absent uses (1) the mode to determine whether it
is a directory (2) the rest of the stat information to check if this
is actually an old entry, disguised by a change in filename (e.g.,
README -> Readme) that is significant to git but insignificant to the
underlying filesystem. If lstat fails, these checks are performed
with an uninitialied stat structure, producing essentially random
results.
Better to just error out when lstat fails.
The easiest way to reproduce this is to remove a file after the
check_leading_path call and before the lstat in verify_absent. An
lstat failure other than ENOENT in check_leading_path would also
trigger the same code path.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When check_leading_path notices a file in the way of a new entry to be
checked out, verify_absent uses (1) the mode to determine whether it
is a directory (2) the rest of the stat information to check if this
is actually an old entry, disguised by a change in filename (e.g.,
README -> Readme) that is significant to git but insignificant to the
underlying filesystem. If lstat fails, these checks are performed
with an uninitialied stat structure, producing essentially random
results.
Better to just error out when lstat fails.
The easiest way to reproduce this is to remove a file after the
check_leading_path call and before the lstat in verify_absent. An
lstat failure other than ENOENT in check_leading_path would also
trigger the same code path.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
unpack-trees.c | diff | blob | history |