On 2021-09-21, Gary Johnson wrote: > On 2021-09-20, Bram Moolenaar wrote: > > > > > On 2021-09-19, John Little wrote: > > > > There are cases where the resolution of symbolic names causes problems. > > > > > > Agreed. > > > > > > I have a plugin that needs to search for parent directories and for > > > files in those parent directories. I used to use finddir() and > > > findfile() for this, but then discovered that they, too, resolve > > > symbolic links. This was no good when running the plugin in > > > a subdirectory of one of the /usr/src/linux-headers-* directories. > > > Many of those subdirectories are symbolic links to some other > > > /usr/src/linux-headers-* subdirectory, so my plugin would find the > > > wrong parent directory. I wound up writing my own FindDir() and > > > FindFile() that textually traverse $PWD/<relative path>. > > > > Can you give a reproducible example of the problem you encountered? > > When I found the problem, I made notes on it that I thought would be > enough to reproduce it. But now I can't. And I fixed the problem > before I put the plugin in version control, so I can't just revert > to that earlier version, although I can probably reconstruct it. > > I'll take another stab at it tomorrow or Wednesday.
... or in a week and a half. > > I would think that findfile() and finddir() could return the file or > > directory as-is, but when editing a file, then the symbolic link resolve > > would apply. > > That's what I'm seeing now, too, although it contradicts my notes on > the problem. I may have misinterpreted my findings at the time. > > I'll let you know what I find. I reconstructed the older version of my plugin from old copies and commented-out pieces. I reproduced the problem, but the causes are getcwd() and fnamemodify(file, ":p:h"), which happen before the calls to findfile() and finddir(). Fixing those first calls fixes the problem even when leaving the old calls to findfile() and finddir(). So I was wrong in my initial analysis of the problem and in my initial comments above. Thanks for setting me straight. Regards, Gary -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20211002204332.GA30016%40phoenix.
