xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit 631b3cb6950e3c56d5a23449bb43b330fa55e912

Fix abs paths comparing equal to similar rel paths
Regression in 0.14-beta introduced by 7f32f8a45b:

Handle relative paths better in paths_are_equal()

"a" and "./a" were canonicalized to themselves. Fixing this in
canonicalize_path() to always add "./" breaks its uses for things
like patterns in auto-commands. Always stripping leading "./" can
potentially result in running a command with "-path" instead of
"./-path". Although not sure the latter is possible, decided not to
risk.
Author: xaizek
Author date (UTC): 2025-01-27 17:15
Committer name: xaizek
Committer date (UTC): 2025-02-01 11:36
Parent(s): 2934bd458ed6fcffe471cc5afd7cda215f2847ec
Signing key: 99DC5E4DB05F6BE2
Tree: e2aeefb6a756825786dba932b1b3ad51eed8a457
File Lines added Lines deleted
ChangeLog 3 0
src/utils/path.c 2 2
tests/utils/paths_are_equal.c 9 0
File ChangeLog changed (mode: 100644) (index 9c496297e..b17314176)
5 5 Corrected documentation on how the use of different preview macros affects Corrected documentation on how the use of different preview macros affects
6 6 classification of a previewer. classification of a previewer.
7 7
8 Fixed absolute paths comparing equal to similar relative paths (regression
9 in 0.14-beta).
10
8 11 0.13 to 0.14-beta (2025-01-19) 0.13 to 0.14-beta (2025-01-19)
9 12
10 13 Changed --with-gtk flag to --with-glib (old name is still available). GTK Changed --with-gtk flag to --with-glib (old name is still available). GTK
File src/utils/path.c changed (mode: 100644) (index cbe5ca11c..9f67e89b1)
... ... make_canonic_path(const char directory[], char buf[], size_t buf_size,
148 148 } }
149 149 else /* note this else */ else /* note this else */
150 150 #endif #endif
151 if(strict_rel_paths)
151 if(strict_rel_paths && !is_path_absolute(directory))
152 152 { {
153 153 strcpy(buf, "./"); strcpy(buf, "./");
154 q += 2;;
154 q += 2;
155 155 } }
156 156
157 157 while(*p != '\0' && (size_t)((q + 1) - buf) < buf_size - 1U) while(*p != '\0' && (size_t)((q + 1) - buf) < buf_size - 1U)
File tests/utils/paths_are_equal.c changed (mode: 100644) (index 450ef3f9c..c15bb8cae)
4 4
5 5 TEST(dotdirs_in_relative_paths_normalized) TEST(dotdirs_in_relative_paths_normalized)
6 6 { {
7 assert_false(paths_are_equal("/a", "./a"));
8 assert_false(paths_are_equal("/a", "a"));
9
10 assert_false(paths_are_equal("/a/b/c", "./a/b/c"));
11 assert_false(paths_are_equal("/a/b/c", "a/b/c"));
12
13 assert_true(paths_are_equal("/a", "////a"));
14 assert_true(paths_are_equal("/a/b/./c", "/a//b/c/d/.."));
15
7 16 assert_true(paths_are_equal("a", "./a")); assert_true(paths_are_equal("a", "./a"));
8 17 assert_true(paths_are_equal("./a", "././a")); assert_true(paths_are_equal("./a", "././a"));
9 18 assert_true(paths_are_equal("a", "./././a")); assert_true(paths_are_equal("a", "./././a"));
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master