Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remote: local: support relative paths #1421

Closed
efiop opened this issue Dec 7, 2018 · 4 comments
Closed

remote: local: support relative paths #1421

efiop opened this issue Dec 7, 2018 · 4 comments
Assignees
Labels
enhancement Enhances DVC

Comments

@efiop
Copy link
Member

efiop commented Dec 7, 2018

E.g. dvc remote add mylocal ../../mydir. Note that same as with cache.dir, path should be resolved relative to config file location, which is .dvc.

@efiop efiop added the enhancement Enhances DVC label Dec 7, 2018
@efiop efiop self-assigned this Dec 7, 2018
@efiop efiop added this to the 0.22.1 milestone Dec 7, 2018
@dlazerka
Copy link

dlazerka commented Dec 8, 2018

Great, I would take a caution about going ../ from the root dir (i.e. outside project), might be a security issue. Although I heard that it might be hard to really determine if you're "outside" (symlinks and whatnot).

@efiop
Copy link
Member Author

efiop commented Dec 8, 2018

@dlazerka DVC doesn't have any additional privileges, so it can't do much harm :) Unless I'm missing something.

@dmpetrov
Copy link
Member

dmpetrov commented Dec 8, 2018

@dlazerka thank you for your feedback!

A relative path should not base on .dvc. However, we can resolve the path and save it as a relative to .dvc.

#1284 is not a relevant explanation for this case since dvc remote is not a direct interface for config file manipulation. We should support "principle of least surprise" for high-level commands such as dvc remote.

@efiop
Copy link
Member Author

efiop commented Dec 8, 2018

@dmpetrov Turns out git remote add myremote ../somedir writes ../somedir as is to the config file and then resolves it relative to the project's root. So following that logic and considering that cache.dir from #1284 is a shorthand for an implicit remote, we should indeed resolve cache.dir relative to the project's root, as you've mentioned in #1284 Funny enough, when you specify a remote with a relative path in your global(or system) config, git still resolves its path relative to the current project's root, which is extremely odd. That is why I think that resolving based on a config location is much more logical and with the "least surprise", since it provides a unified experience across all commands(config/remote) and all levels of config(local, project, global, system).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhances DVC
Projects
None yet
Development

No branches or pull requests

3 participants