Skip to content

Instantly share code, notes, and snippets.

@micahyoung
Last active May 13, 2020 18:53
Show Gist options
  • Save micahyoung/e5ab28c8ae14c504a54a428a29f37d73 to your computer and use it in GitHub Desktop.
Save micahyoung/e5ab28c8ae14c504a54a428a29f37d73 to your computer and use it in GitHub Desktop.
Notes about windows directory symlinks

Summary

Docker (and other tools) appear to not properly convert directory symlinks on either docker build+COPY . . or docker cp to a running container

Tests

git clone, by default, for file symlinks it copies the data to both source and target files and for directory symlinks it creates empty files instead of a directory

git clone -c core.symlinks=true recreates file and directory symlinks correctly but is not the default

tar.exe creates tar but when extracted, the symlink is an empty file (same for ustar, pax formats)

mkdir foo 

mklink /d foo\bar .. 
# Symbolic link created for foo\bar <<===>> .. 

dir foo\
# ...
# 05/13/2020  02:08 PM    <SYMLINKD>     bar [..]
# ...


dir foo\bar\
# <shows output>

tar cf foo.tar foo

rmdir /s /q foo

tar xf foo.tar

dir foo\
# ...
# 05/13/2020  02:03 PM                 0 bar
# ...

dir foo\bar\
# File Not Found

git clone -c core.symlinks=true https://github.com/greenhouse-org/buildpacks-lifecycle.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment