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 0ef00f8a8144ea792609bf6f87688826eae0b2e3

Fix :. incorrectly checking paths relation
When it checked for one path being parent of another.
"/pa" was considered parent of "/path", with "th" being the result.

Thanks to Dennis Preiser (a.k.a. 0xDP).

Fixes #773 on GitHub.
Author: xaizek
Author date (UTC): 2022-03-08 18:14
Committer name: xaizek
Committer date (UTC): 2022-03-08 18:30
Parent(s): 34f8c8b5636a5d16026eb3fcea39e151c70cb494
Signing key: 99DC5E4DB05F6BE2
Tree: 536df33882dd2c8943925d8568c1a4aea6059010
File Lines added Lines deleted
ChangeLog 4 0
src/filename_modifiers.c 5 4
tests/misc/fname_modif.c 12 0
File ChangeLog changed (mode: 100644) (index b22c3feeb..33bd3ad6c)
100 100 Fixed write to a pipe of a closed process in Lua causing SIGPIPE and Fixed write to a pipe of a closed process in Lua causing SIGPIPE and
101 101 termination of the application. termination of the application.
102 102
103 Fixed :. incorrectly checking for one path being parent of another and
104 producing weird results ("/pa" was considered parent of "/path", with "th"
105 being the result). Thanks to Dennis Preiser (a.k.a. 0xDP).
106
103 107 0.12-beta to 0.12 (2021-09-29) 0.12-beta to 0.12 (2021-09-29)
104 108
105 109 Made :VifmCs of the plugin handle 24-bit colors. Made :VifmCs of the plugin handle 24-bit colors.
File src/filename_modifiers.c changed (mode: 100644) (index 049295276..104333727)
32 32 #include "utils/path.h" #include "utils/path.h"
33 33 #include "utils/regexp.h" #include "utils/regexp.h"
34 34 #include "utils/str.h" #include "utils/str.h"
35 #include "filelist.h"
35 36 #include "status.h" #include "status.h"
36 37
37 38 static const char * apply_mod(const char *path, const char *parent, static const char * apply_mod(const char *path, const char *parent,
 
... ... apply_tilde_mod(const char *path, char *buf, size_t buf_len)
168 169 static int static int
169 170 apply_dot_mod(const char *path, char *buf, size_t buf_len) apply_dot_mod(const char *path, char *buf, size_t buf_len)
170 171 { {
171 size_t len = strlen(curr_view->curr_dir);
172 if(strnoscmp(path, curr_view->curr_dir, len) != 0 || path[len] == '\0')
173 copy_str(buf, buf_len, path);
172 const char *curr_dir = flist_get_dir(curr_view);
173 if(path_starts_with(path, curr_dir) && !paths_are_equal(path, curr_dir))
174 copy_str(buf, buf_len, make_rel_path(path, curr_dir));
174 175 else else
175 copy_str(buf, buf_len, path + len + 1);
176 copy_str(buf, buf_len, path);
176 177 return 0; return 0;
177 178 } }
178 179
File tests/misc/fname_modif.c changed (mode: 100644) (index 79770d62a..a39636262)
... ... TEST(colon_dot)
318 318 free(expanded); free(expanded);
319 319 } }
320 320
321 TEST(colon_dot_compares_paths_correctly)
322 {
323 MacroFlags flags;
324 char *expanded;
325
326 strcpy(rwin.curr_dir, "/lwin_rwin");
327
328 expanded = ma_expand("echo %C:.", "", &flags, MER_SHELL);
329 assert_string_equal("echo " SL "lwin_rwin" SL "rfile5", expanded);
330 free(expanded);
331 }
332
321 333 TEST(colon_h) TEST(colon_h)
322 334 { {
323 335 MacroFlags flags; MacroFlags flags;
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