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

Fallback when OCaml says symlinks not supported #4962

Merged
merged 2 commits into from
Dec 14, 2021

Conversation

jonahbeckford
Copy link
Contributor

  • Please update master_changes.md file with your changes.

Without this PR, as a Windows user without "Run as Administrator" permission:

opam install `
  --root C:\Users\beckf\AppData\Local\opam `
  --switch C:\Users\beckf\AppData\Local\Programs\DiskuvOCaml\0\host-tools `
  Z:\source\diskuv-communicator-kernel\vendor\diskuv-ocaml\opam-dkml.opam `
  --yes --verbose --debug-level 2
...
00:19.866  SYSTEM                          install C:\Users\beckf\AppData\Local\Programs\DiskuvOCaml\0\host-tools\_opam\.opam-switch\build\opam-dkml.~dev\_build\install\default\doc\opam-dkml\README.md -> C:\Users\beckf\AppData\Local\Programs\DiskuvOCaml\0\host-tools\_opam\doc\opam-dkml\README.md (644)
00:19.866  SYSTEM                          rm C:\Users\beckf\AppData\Local\Programs\DiskuvOCaml\0\host-tools\_opam\doc\opam-dkml\README.md
00:19.868  TRACK                           after install: 7 elements, 0 added, scanned in 0.000s
00:19.868  FILE(changes)                   Wrote C:\Users\beckf\AppData\Local\Programs\DiskuvOCaml\0\host-tools\_opam\.opam-switch\install\opam-dkml.changes in 0.000s
-> installed opam-dkml.~dev
00:19.869  SYSTEM                          ln -s C:\Users\beckf\AppData\Local\Programs\DiskuvOCaml\0\host-tools\_opam\bin\opam-dkml.exe C:\Users\beckf\AppData\Local\opam\plugins\bin\opam-dkml.exe
00:19.869  PARALLEL                        Exception while computing job 788192587: install opam-dkml.~dev

#=== ERROR while installing opam-dkml.~dev ====================================#
C:\Users\beckf\AppData\Local\Programs\DiskuvOCaml\0\bin\opam.exe: "symlink" failed on C:\Users\beckf\AppData\Local\opam\plugins\bin\opam-dkml.exe: Operation not permitted

Now it succeeds:

...
00:14.605  SYSTEM                          install C:\Users\beckf\AppData\Local\Programs\DiskuvOCaml\2\host-tools\_opam\.opam-switch\build\opam-dkml.~dev\_build\install\default\doc\opam-dkml\README.md -> C:\Users\beckf\AppData\Local\Programs\DiskuvOCaml\2\host-tools\_opam\doc\opam-dkml\README.md (644)                                              ]
00:14.606  TRACK                           after install: 9 elements, 9 added, scanned in 0.001s                                ]
00:14.606  FILE(changes)                   Wrote C:\Users\beckf\AppData\Local\Programs\DiskuvOCaml\2\host-tools\_opam\.opam-switch\install\opam-dkml.changes in 0.000s
-> installed opam-dkml.~dev                                                                                                     ]
00:14.607  SYSTEM                          copy C:\Users\beckf\AppData\Local\Programs\DiskuvOCaml\2\host-tools\_opam\bin\opam-dkml.exe -> C:\Users\beckf\AppData\Local\opam\plugins\bin\opam-dkml.exe
00:14.608  SYSTEM                          copy C:\Users\beckf\AppData\Local\Programs\DiskuvOCaml\2\host-tools\_opam\bin\opam-dkml.exe -> C:\Users\beckf\AppData\Local\opam\plugins\bin\opam-dkml.exe
00:14.621  FILE(switch-state)              Wrote C:\Users\beckf\AppData\Local\Programs\DiskuvOCaml\2\host-tools\_opam\.opam-switch\switch-state in 0.010s

One loose end is that the if Sys.win32 then Unix.chmod dst 0o640 else (); code before the symlink is deleted (remove_file dst) was not lifted into remove_file. I wanted this PR to focus just one issue (a functioning symlink creation function).

Copy link
Member

@kit-ty-kate kit-ty-kate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@kit-ty-kate kit-ty-kate added this to PR in progress in Opam 2.2.0 via automation Dec 14, 2021
@kit-ty-kate kit-ty-kate added this to the 2.2.0~alpha milestone Dec 14, 2021
src/core/opamSystem.ml Outdated Show resolved Hide resolved
@dra27 dra27 merged commit 3bdd060 into ocaml:master Dec 14, 2021
Opam 2.2.0 automation moved this from PR in progress to Done Dec 14, 2021
@dra27
Copy link
Member

dra27 commented Dec 14, 2021

LGTM too, thanks!

@jonahbeckford jonahbeckford deleted the bugfix-symlink-check branch May 3, 2022 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Opam 2.2.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants