Hello Stephen! Sadly I don't fully remember if we had a reason to use file-truename in dvc-uniquify-file-name. But I guess it had something to do with tla.
After reading your report I would suggest to remove file-truename from dvc-uniquify-file-name. Please add a comment that file-truename was used here before (and the date when you removed it). If we ever find a problem with the removed file-truename then we can add an optional parameter to use file-truename or use it in the caller. Stefan. > dvc-uniquify-file-name uses 'file-truename'; this is causing problems > for one of my workspaces. > > Here's my workspace setup: > > work_stephe > build > code_1 > code_2 > runtime -> <lynx box>/root/runtime > > 'build' contains makefiles and related files for compiling code. The > compiler is a cross-compiler (from x86 Linux to x86 Lynx OS). > > 'code_n' contain source code that gets compiled. > > 'runtime' is a symbolic link to a directory on an NFS-mounted drive on > the Lynx box. For example, suppose lynx:/home/stephe/work_stephe is NFS > mounted to linux:/home/stephe/lynx; then linux:/home/stephe/root/runtime > is linked to linux:/home/stephe/lynx/work_stephe/runtime. > > The makefiles compile an executable and copy it to the corresponding > directory on the Lynx drive. When the executable runs on the Lynx box > CPU, it uses files in the 'runtime' directory; those files need to be > under DVC control. I'm using the monotone backend, but these issues > apply to all backends. > > The problem comes when I try to run dvc-file-ediff on a file in > 'runtime'; say work_stephe/runtime/script.gds'. It executes (dvc-tree-root > file t); in this case > > (dvc-tree-root "runtime/script.gds" t) > > dvc-tree-root calls xmtn-tree-root, which calls dvc-tree-root-helper, > which calls (dvc-uniquify-file-name "runtime/script.gds"), with > `default-directory' set to /home/stephe/work_stephe/runtime. > > dvc-uniquify-file-name calls file-truename, which returns > "/home/stephe/lynx/work_stephe/runtime". This is not under the monotone > workspace root "/home/stephe/work_stephe", so dvc-tree-root returns nil, > and dvc-file-ediff fails. > > If I delete 'file-truename' from dvc-uniquify-file-name, then it works > as I want. > > I'm wondering what the use case is that requires file-truename. One that > I thought of is using symlinks to make one file appear in several places > in a workspace, but only once in the backend, but that seems unlikely. > > There is another case, where there is a symlink in the path to the > workspace root. `call-process' spawns the subprocess with a working > directory with all symlinks expanded. So if a DVC function passes an > unexpanded workspace path to the backend, and the backend also uses the > process working directory to get the workspace root, there could be a > problem. This could be handled either by not passing the workspace root > to the backend (I fixed this a while ago in xmtn), or by using > file-truename more locally. > > There are several other places that call file-truename; one is in > dvc-get-matching-buffers, two in tla, and several in xmtn. > dvc-get-matching-buffers should be using dvc-uniquify-file-name instead. > I didn't look at tla. The xmtn uses I can eliminate easily. On the other > hand, there are _lots_ of places that call dvc-uniquify-file-name. > > So I'd like to delete file-truename from dvc-uniquify-file-name, or at > least add a workspace-specific option that says whether to use it or not > for paths within the workspace. > > Any other ideas? _______________________________________________ Dvc-dev mailing list [email protected] https://mail.gna.org/listinfo/dvc-dev
