question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`checkout`: cwd needs upper case drive letter on Windows

See original GitHub issue

Bug Report

Description

The VS Code extension creates child processes to run the CLI. We use the root directory of each DVC project as the cwd for these processes. When running checkout from one of these processes we run into unexpected errors on Windows. E.g

dvc checkout foo.txt 
ERROR: Did you mean `git checkout foo.txt`?: 'foo.txt' does not exist as an output or a stage name in 'dvc.yaml': 'dvc.yaml' does not exist

From debugging it appears that the error is caused by passing the CLI a lower case drive letter in the cwd. @efiop has told me that DVC uses os.getcwd() which returns an upper case drive letter.

As reported by a user on Discord, who provided an example repository: https://github.com/HaddocktheHorrible/dvc-test

Reproduce

  1. Use the VS Code extension on a Windows machine.
  2. Have changes in the workspace.
  3. Attempt to checkout a file from the SCM view.
  4. Error will be thrown.

Expected

DVC can handle case differences in the cwd path on Windows.

Environment information

Output of dvc doctor:

$ dvc doctor

DVC version: 2.11.0 (exe)
---------------------------------
Platform: Python 3.8.10 on Windows-10-10.0.19043-SP0
Supports:
    azure (adlfs = 2022.4.0, knack = 0.9.0, azure-identity = 1.10.0),
    gdrive (pydrive2 = 1.10.1),
    gs (gcsfs = 2022.5.0),
    hdfs (fsspec = 2022.5.0, pyarrow = 8.0.0),
    webhdfs (fsspec = 2022.5.0),
    http (aiohttp = 3.8.1, aiohttp-retry = 2.4.6),
    https (aiohttp = 3.8.1, aiohttp-retry = 2.4.6),
    s3 (s3fs = 2022.5.0, boto3 = 1.21.21),
    ssh (sshfs = 2022.6.0),
    oss (ossfs = 2021.8.0),
    webdav (webdav4 = 0.9.7),
    webdavs (webdav4 = 0.9.7)
Cache types: hardlink
Cache directory: NTFS on C:\
Caches: local
Remotes: local
Workspace directory: NTFS on C:\
Repo: dvc, git

Additional Information (if any):

I will provide more information as I get it. Getting access to a Windows box shortly (debugging up to this point was done with @sroy3 on her Windows machine).

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
pmrowlacommented, Jun 23, 2022

Windows paths are supposed to be case-insensitive (including drive letters), we are probably just missing an os.path.normcase() call somewhere before we do path (string) comparisons

2reactions
efiopcommented, Jun 17, 2022

Need to double check if windows drives are really case-insensitive. Just in case there is a more complex problem here (or even intended behavior).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Drive letters on Windows must be Upper case - Bug
The thing is that using lower case drive letters on windows when setting the MGEAR_SHIFTER_CUSTOMSTEP_PATH variable breaks the paths.
Read more >
How do I commit case-sensitive only filename changes in Git?
For example, renaming a file in a way that only changes letter case will cause git to report ... git -c core.ignorecase=true checkout...
Read more >
Inconsistent behavior of git with absolute paths and --work-tree, --git ...
> letter-case of drives on windows. There is a strcmp() in setup_explicit_git_dir() in setup.c. Does it help if that is changed to strcasecmp?...
Read more >
TortoiseSVN's Settings
However, a file with the svn:needs-lock property needs this action every time it is edited, so in that case it is very useful...
Read more >
User and Workspace Settings - Visual Studio Code
Later we'll cover Workspace settings, which will be specific to the project you're ... are shared between multiple workspaces and windows (needs `editor....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found