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

Comments

3 participants
@efiop
Copy link
Member

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Member Author

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member Author

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).

efiop added a commit to efiop/dvc that referenced this issue Dec 12, 2018

remote: local: support relative cache dir location
Fixes iterative#1421

Signed-off-by: Ruslan Kuprieiev <ruslan@iterative.ai>

@efiop efiop added this to To do in Weekly tasks Dec 14, 2018

efiop added a commit to efiop/dvc that referenced this issue Jan 4, 2019

remote: local: support relative paths
Fixes iterative#1421

Signed-off-by: Ruslan Kuprieiev <ruslan@iterative.ai>

efiop added a commit to efiop/dvc that referenced this issue Jan 4, 2019

remote: local: support relative paths
Fixes iterative#1421

Signed-off-by: Ruslan Kuprieiev <ruslan@iterative.ai>

@efiop efiop closed this in 484f318 Jan 4, 2019

Weekly tasks automation moved this from To do to Done Jan 4, 2019

efiop added a commit to efiop/dvc that referenced this issue Jan 8, 2019

remote: local: support relative paths
Fixes iterative#1421

Signed-off-by: Ruslan Kuprieiev <ruslan@iterative.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.