aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e/vdb_unmerger.cc
diff options
context:
space:
mode:
authorAvatar Ingmar Vanhassel <ingmar@exherbo.org> 2009-01-05 20:05:50 +0100
committerAvatar Ingmar Vanhassel <ingmar@exherbo.org> 2009-01-09 22:59:13 +0100
commita8ff499710868d8cdb83618acb2670ad737d3582 (patch)
treebef46394455866614ebd9d8ed268e060840d5ae1 /paludis/repositories/e/vdb_unmerger.cc
parent43294985769794d6959d1f9ac565d63cf9a8f8e8 (diff)
downloadpaludis-a8ff499710868d8cdb83618acb2670ad737d3582.tar.gz
paludis-a8ff499710868d8cdb83618acb2670ad737d3582.tar.xz
Fix an unmerger cornercase.
When unmerging a file whose parent directory got replaced by a file, paludis would throw an unhandled exception. * When calling stat() on '/var/lib/games/emacs/tetris-scores/.keep_app-editors_emacs-22': * Error running stat() on '/var/lib/games/emacs/tetris-scores/.keep_app-editors_emacs-22': Not a directory (paludis::FSError) Patch by Ferdy, testcases by me.
Diffstat (limited to 'paludis/repositories/e/vdb_unmerger.cc')
-rw-r--r--paludis/repositories/e/vdb_unmerger.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/paludis/repositories/e/vdb_unmerger.cc b/paludis/repositories/e/vdb_unmerger.cc
index cfb7dcda2..f05a7eeb6 100644
--- a/paludis/repositories/e/vdb_unmerger.cc
+++ b/paludis/repositories/e/vdb_unmerger.cc
@@ -255,7 +255,9 @@ VDBUnmerger::check_file(const FSEntry & f, const std::tr1::shared_ptr<ExtraInfo>
{
std::tr1::shared_ptr<FileExtraInfo> fie(std::tr1::static_pointer_cast<FileExtraInfo>(ei));
- if (! (_imp->options.root() / f).is_regular_file())
+ if (! (_imp->options.root() / f).exists())
+ display("--- [gone ] " + stringify(f));
+ else if (! (_imp->options.root() / f).is_regular_file())
display("--- [!type] " + stringify(f));
else if ((_imp->options.root() / f).mtime() != fie->_mtime)
display("--- [!time] " + stringify(f));
@@ -284,7 +286,9 @@ VDBUnmerger::check_sym(const FSEntry & f, const std::tr1::shared_ptr<ExtraInfo>
{
std::tr1::shared_ptr<SymlinkExtraInfo> sie(std::tr1::static_pointer_cast<SymlinkExtraInfo>(ei));
- if (! (_imp->options.root() / f).is_symbolic_link())
+ if (! (_imp->options.root() / f).exists())
+ display("--- [gone ] " + stringify(f));
+ else if (! (_imp->options.root() / f).is_symbolic_link())
display("--- [!type] " + stringify(f));
else if ((_imp->options.root() / f).mtime() != sie->_mtime)
display("--- [!time] " + stringify(f));
@@ -301,7 +305,9 @@ VDBUnmerger::check_misc(const FSEntry & f, const std::tr1::shared_ptr<ExtraInfo>
{
std::tr1::shared_ptr<MiscExtraInfo> mie(std::tr1::static_pointer_cast<MiscExtraInfo>(ei));
- if ("fif" == mie->_type && ! (_imp->options.root() / f).is_fifo())
+ if (! (_imp->options.root() / f).exists())
+ display("--- [gone ] " + stringify(f));
+ else if ("fif" == mie->_type && ! (_imp->options.root() / f).is_fifo())
display("--- [!type] " + stringify(f));
else if ("dev" == mie->_type && ! (_imp->options.root() / f).is_device())
display("--- [!type] " + stringify(f));
@@ -314,7 +320,9 @@ VDBUnmerger::check_misc(const FSEntry & f, const std::tr1::shared_ptr<ExtraInfo>
bool
VDBUnmerger::check_dir(const FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> &) const
{
- if (! (_imp->options.root() / f).is_directory())
+ if (! (_imp->options.root() / f).exists())
+ display("--- [gone ] " + stringify(f));
+ else if (! (_imp->options.root() / f).is_directory())
display("--- [!type] " + stringify(f));
else if (DirIterator(_imp->options.root() / f, DirIteratorOptions() + dio_include_dotfiles + dio_first_only) != DirIterator())
display("--- [!empt] " + stringify(f));