aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-24 06:40:49 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-24 06:40:49 +0000
commit3cb728757c97f47691a57fadf6523c8ba648e3fc (patch)
tree656e57687a71ef41fe85e724ecd191793c87a4e1
parent9602abd172259d2f8cbf24070f4f0ba2ce70d7ee (diff)
downloadpaludis-3cb728757c97f47691a57fadf6523c8ba648e3fc.tar.gz
paludis-3cb728757c97f47691a57fadf6523c8ba648e3fc.tar.xz
Add further symlink behaviour checks. Allow symlinks to files for ebuilds, hooks etc
-rw-r--r--paludis/util/fs_entry_TEST.cc10
-rwxr-xr-xpaludis/util/fs_entry_TEST_setup.sh2
-rw-r--r--paludis/util/is_file_with_extension.cc3
3 files changed, 10 insertions, 5 deletions
diff --git a/paludis/util/fs_entry_TEST.cc b/paludis/util/fs_entry_TEST.cc
index 1d1c630..5a26709 100644
--- a/paludis/util/fs_entry_TEST.cc
+++ b/paludis/util/fs_entry_TEST.cc
@@ -66,13 +66,13 @@ namespace test_cases
} test_fs_entry_manipulation;
/**
- * \test Test FSEntry realpath.
+ * \test Test FSEntry behavior.
*
* \ingroup grpfilesystem
*/
struct FSEntryRealpathTest : TestCase
{
- FSEntryRealpathTest() : TestCase("realpath") { }
+ FSEntryRealpathTest() : TestCase("behavior") { }
void run()
{
@@ -105,8 +105,12 @@ namespace test_cases
TEST_CHECK(r.is_regular_file());
std::string g("fs_entry_TEST_dir/dir_a/file_in_a");
TEST_CHECK_EQUAL(stringify(r).substr(stringify(r).length() - g.length()), g);
+
+ FSEntry h("fs_entry_TEST_dir/symlink_to_file_in_a");
+ TEST_CHECK(h.is_symbolic_link());
+ TEST_CHECK(! h.is_regular_file());
}
- } test_fs_entry_realpath;
+ } test_fs_entry_behaviour;
/**
* \test Test FSEntry has_permission methods.
diff --git a/paludis/util/fs_entry_TEST_setup.sh b/paludis/util/fs_entry_TEST_setup.sh
index 6945a78..33ce73b 100755
--- a/paludis/util/fs_entry_TEST_setup.sh
+++ b/paludis/util/fs_entry_TEST_setup.sh
@@ -11,4 +11,4 @@ chmod 777 all_perms || exit 8
touch no_perms || exit 9
chmod 000 no_perms || exit 10
echo -n '0123456789' > ten_bytes || exit 11
-
+ln -s dir_a/file_in_a symlink_to_file_in_a || exit 12
diff --git a/paludis/util/is_file_with_extension.cc b/paludis/util/is_file_with_extension.cc
index 77c3c12..1310782 100644
--- a/paludis/util/is_file_with_extension.cc
+++ b/paludis/util/is_file_with_extension.cc
@@ -39,5 +39,6 @@ IsFileWithExtension::operator() (const FSEntry & f) const
return false;
if (0 != filename.compare(0, _prefix.length(), _prefix))
return false;
- return f.is_regular_file();
+ return f.is_regular_file() || (f.exists() && f.realpath().is_regular_file());
}
+