diff options
author | Christopher Haster <chaster@utexas.edu> | 2018-04-22 15:26:31 +0300 |
---|---|---|
committer | Christopher Haster <chaster@utexas.edu> | 2018-04-22 15:26:31 +0300 |
commit | 015b86bc51fddbd9d0e7c68e02015f8fd12c5839 (patch) | |
tree | 94d56c181b5e271b02ca8be8c6fb0fc6e6545334 /tests | |
parent | 9637b9606965d40692724e9a5a742e8e87d6c602 (diff) |
Fixed issue with trailing dots in file pathsfix-trailing-dots
Paths such as the following were causing issues:
/tea/hottea/.
/tea/hottea/..
Unfortunately the existing structure for path lookup didn't make it very
easy to introduce proper handling in this case without duplicating the
entire skip logic for paths. So the lfs_dir_find function had to be
restructured a bit.
One odd side-effect of this is that now lfs_dir_find includes the
initial fetch operation. This kinda breaks the fetch -> op pattern of
the dir functions, but does come with a nice code size reduction.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test_paths.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_paths.sh b/tests/test_paths.sh index f277e45..79c4e66 100755 --- a/tests/test_paths.sh +++ b/tests/test_paths.sh @@ -90,6 +90,22 @@ tests/test.py << TEST lfs_unmount(&lfs) => 0; TEST +echo "--- Trailing dot path tests ---" +tests/test.py << TEST + lfs_mount(&lfs, &cfg) => 0; + lfs_stat(&lfs, "tea/hottea/", &info) => 0; + strcmp(info.name, "hottea") => 0; + lfs_stat(&lfs, "tea/hottea/.", &info) => 0; + strcmp(info.name, "hottea") => 0; + lfs_stat(&lfs, "tea/hottea/./.", &info) => 0; + strcmp(info.name, "hottea") => 0; + lfs_stat(&lfs, "tea/hottea/..", &info) => 0; + strcmp(info.name, "tea") => 0; + lfs_stat(&lfs, "tea/hottea/../.", &info) => 0; + strcmp(info.name, "tea") => 0; + lfs_unmount(&lfs) => 0; +TEST + echo "--- Root dot dot path tests ---" tests/test.py << TEST lfs_mount(&lfs, &cfg) => 0; |