Dvc: Wrong relative path upon remote list

Created on 15 Jan 2020  路  7Comments  路  Source: iterative/dvc

dvc version: 0.81.3

#!/bin/bash

rm -rf repo storage
mkdir repo storage

pushd repo
git init --quiet
dvc init -q

dvc remote add -q --default str ../storage

dvc remote list

shows that str url is ../../storage, which is relpath relative to .dvc/config while cwd is project root, so it should be actually ../storage

discussion enhancement p3-nice-to-have ui

Most helpful comment

@pared good points! In general I tend to agree that higher level commands like dvc remote list, dvc remote add, dvc cache dir can be built to be user-friendly and have a bit of logic to present information at its most expected way.

All 7 comments

Also, while we are at it, I think we should discuss whether storing the relative path to remote is a good thing.

@pared I think this is a documented and expected behavior - https://dvc.org/doc/command-reference/remote/add#description . I think the motivation was to make it similar to git - in config relative path are saved relative to the config file location (in case you decide to edit them manually you won't need to do a mental exercise).

Also, while we are at it, I think we should discuss whether storing the relative path to remote is a good thing.

good question. I would not limit user when they edit file manually. But should we transform the path into absolute when we do dvc remote add?

Check also https://dvc.org/doc/command-reference/cache/dir - it is similar and we had a few discussions around it - here https://github.com/iterative/dvc/issues/1421 and here https://github.com/iterative/dvc/issues/1284

Removing bug for now.

@shcheklein ahh, right, had a little eclipse of my mind, but well, then shouldn't dvc remote list show path relative to curdir if its relpath? That's what caused me to create this issue.

As to mentioned discussions: they were mostly about using relpath in commands, and I have nothing against that. Having said so, I think that when writing to config we should transform it into full path. Because cloning repo with relpath will point to proper cache only when relative path to given remote/cache is the same, while abspath will be proper wherever you clone on the same machine.

Because cloning repo with relpath will point to proper cache only when relative path to given remote/cache is the same, while abspath will be proper wherever you clone on the same machine.

@pared That actually goes both ways. Abspath might not be compatible (e.g. I'm working in ~/git/dvc and you in ~/prjects/dvc) and relpath might be, as it is following a convention (e.g. that your cache is one level up). Though I might be stretching it 馃檪

ahh, right, had a little eclipse of my mind, but well, then shouldn't dvc remote list show path relative to curdir if its relpath? That's what caused me to create this issue.

That is a good point, I've never thought of that. Felt like it should show whatever is there, but it does make sense to show a relpath if there is a relpath configured (should show abs for abs, obviously). So repurposing this issue? 馃檪

@efiop changed description

@pared good points! In general I tend to agree that higher level commands like dvc remote list, dvc remote add, dvc cache dir can be built to be user-friendly and have a bit of logic to present information at its most expected way.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nik123 picture nik123  路  3Comments

anotherbugmaster picture anotherbugmaster  路  3Comments

robguinness picture robguinness  路  3Comments

dmpetrov picture dmpetrov  路  3Comments

TezRomacH picture TezRomacH  路  3Comments