On Windows untracked files from a previous builds are not cleaned up if the path length is too long
Summary
On Windows untracked files from a previous builds are not cleaned up if the path length is too long
Steps to reproduce
Run a build job that creates a long path. Use anything that uses \\?
paths or has opted into the new long path support on newer Windows 10 builds to create some long paths. Something like:
job:
script:
- cmake -E touch short_path
- cmake -E make_directory loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnggggggggggggggggggggggggggggggggggggggggggggggggggggg_path
- cmake -E touch
loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnggggggggggggggggggggggggggggggggggggggggggggggggggggg_path/file
Actual behavior
The next build to run fails to remove the long paths. Not only that, but it ignores the failures and tries to run the build script:
...
Removing short_path
warning: Could not stat path 'loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnggggggggggggggggggggggggggggggggggggggggggggggggggggg_path': Filename too long
warning: Could not stat path 'loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnggggggggggggggggggggggggggggggggggggggggggggggggggggg_path/file': Filename too long
HEAD is now at 49e89488 ...
From http://gitlab/xx/xxx
Checking out 49e89488 as branch_name...
Skipping Git submodules setup
$ cmake -E touch short_path
...
Expected behavior
GitLab Runner should be able to delete long paths by both:
- Using
\\?
prefixed paths - Opting in to the new long path support in Windows 10
See: https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file
Environment description
Are you using shared Runners on GitLab.com? Or is it a custom installation?
Custom installation
Which executors are used? Please also provide the versions of related tools
Shell executor on Windows 10 version 1703
Used GitLab Runner version
10.5.0