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

Symlink for README creating problems on Windows #27

Open
jonahbeckford opened this issue Jan 4, 2023 · 1 comment
Open

Symlink for README creating problems on Windows #27

jonahbeckford opened this issue Jan 4, 2023 · 1 comment

Comments

@jonahbeckford
Copy link

I am trying to resolve diskuv/dkml-installer-ocaml#12 (get pyml into the Diskuv/Windows OCaml distribution).

One thing I am running into is:

PS Z:\source\test2> opam install stdcompat
...
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] Failed to get sources of stdcompat.19: "C:\\Users\\beckf\\AppData\\Local\\Programs\\DISKUV~1\\tools\\MSYS2\\usr\\bin\\tar.exe xfz
        /c/Users/beckf/AppData/Local/opam/download-cache/sha512/25/25582731170f2f80eed281c48af4904d1d00ef88a38d1b17853395c19a326d7b11e42c17b69f639402c467ff6f9b83a2e9d4dbab7255ac25d466b85a55674bd0 -C
        /c/Users/beckf/AppData/Local/Temp/opam-32848-5a7b45" exited with code 2

#=== ERROR while fetching sources for stdcompat.19 ============================#
OpamSolution.Fetch_fail("\027[33m#\027[0m \027[33mpath\027[0m        Z:\\source\\test2\n\027[33m#\027[0m \027[33mcommand\027[0m     C:\\Users\\beckf\\AppData\\Local\\Programs\\DISKUV~1\\tools\\MSYS2\\usr\\bin\\tar.exe xfz /c/Users/beckf/AppData/Local/opam/download-cache/sha512/25/25582731170f2f80eed281c48af4904d1d00ef88a38d1b17853395c19a326d7b11e42c17b69f639402c467ff6f9b83a2e9d4dbab7255ac25d466b85a55674bd0 -C /c/Users/beckf/AppData/Local/Temp/opam-32848-5a7b45\n\027[33m#\027[0m \027[33mexit-code\027[0m   2\n\027[33m#\027[0m \027[33menv-file\027[0m    C:\\Users\\beckf\\AppData\\Local\\opam\\log\\log-32848-498a6e.env\n\027[33m#\027[0m \027[33moutput-file\027[0m C:\\Users\\beckf\\AppData\\Local\\opam\\log\\log-32848-498a6e.out\n\027[33m### output ###\n\027[0m\027[33m# \027[0m/c/Users/beckf/AppData/Local/Programs/DISKUV~1/tools/MSYS2/usr/bin/tar: stdcompat-19/README: Cannot create symlink to \226\128\152README.md\226\128\153: No such file or directory\n\027[33m# \027[0m/c/Users/beckf/AppData/Local/Programs/DISKUV~1/tools/MSYS2/usr/bin/tar: Exiting with failure status due to previous errors\n")
...

PS Z:\source\test2> with-dkml bash
$ tar tvfz /c/Users/beckf/AppData/Local/opam/download-cache/sha512/25/25582731170f2f80eed281c48af4904d1d00ef88a38d1b17853395c19a326d7b11e42c17b69f639402c467ff6f9b83a2e9d4dbab7255ac25d466b85a55674bd0 | grep RE
lrwxrwxrwx root/root         0 2022-07-15 09:48 stdcompat-19/README -> README.md
-rw-rw-r-- root/root      4477 2022-07-15 09:48 stdcompat-19/README.md

That log is hard to read, so what is happening here is that:

  1. stdcompat-19/README -> README.md entry comes before the stdcompat-19/README.md in the tar archive members, so the tar xfz process launched by opam on Windows will read the stdcompat-19/README -> README.md first.
  2. tar xfz will try to create the symlink to README.md ... which doesn't exist yet. Dangling symlinks do not work in MSYS2 (and sometimes don't in Cygwin). Failure!

This needs a better answer in opam itself, or perhaps in the opam publish and dune-release tools.

Ways to mitigate in the short-term:

  1. Remove the symlink (it doesn't look necessary at all) and cut a new release stdcompat-20.
  2. Upload a patched https://github.com/thierry-martinez/stdcompat/releases/download/v19_patch1/stdcompat-19.tar.gz with either a) the symlink removed or b) the symlink added last. And resubmit stdcompat-19 to the opam repository.
@jonahbeckford
Copy link
Author

Link to opam master ticket: ocaml/opam#5406

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant