On Fri, 24 Jan 2020 11:32:01 +0500 Mike Kazantsev <[email protected]> wrote:
> One way to fix it can be to use: > > (substring symlink 0 > (min (string-width dir) (string-width symlink))) > > But them what if it's a symlink to "music-dir-something-something" and > such (min ...) will cut it to "music-dir", resulting in t for > string-equal check, while symlink does not actually refer to same dir? > > So this fix doesn't look right. > > And I'm not entirely sure I'm understanding the problem correctly in > the first place, as it looks like there was a bug anyway, given that > any width can be longer than other, yet string was cut using only one > of them. At the risk of biasing any potential info/solution some more, feel like proper (tm) way to check for any kind of loops would be getting (file-truename ...) for both paths and then checking if one is subdir of another. But it doesn't look like (file-truename ...) uses realpath(3) under the hood, so not entirely sure if it works same as libc's realpath() and can be used here. -- Mike Kazantsev // fraggod.net
