-
Notifications
You must be signed in to change notification settings - Fork 710
cabal new-install silently fails if symlink target already exists #5491
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
Comments
I'd prefer error. overwrite is second best. Would be nice to make an |
@phadej what'ya say about making error default, and introducing a |
I would like to observe this behaviour as well. If nothing changes then the second command should ideally do nothing and say something like If versions are different and symlink already exist then I'm okay with having error by default and see message that @hvr suggested in this comment: #5491 (comment) |
Overwriting sounds like a better default: I sometimes reinstall to upgrade to a newer version. After all, we're talking aboit a symlink. We don't lose any data. It would be nice to print a warning and a path to the old symlink destination, so that the user could undo the overwrite easily. |
|
I'll chime in with my preferred bikeshed color. Symlinks should be checked during build-plan creation. If any symlinks would be modified, there should be an error (ergonomics of this error discussed below). A build-plan that involves creating or rewriting symlinks but having them point at the same thing they're already pointing at shouldn't trigger an error. There should be a flag that forces action, even if this would modify some symlinks. Anyway the goal here in to cause an error as quickly as possible -- it would be very painful to kick off a 20 minute build and go to do something else only to discover it failed 3 minutes in. It could happen that the filesystem is modified after build-plan creation time but before symlink-creation time. Each symlink modification/creation should make an effort to detect this situation. In case it happens, I think a fatal and unrecoverable error is simplest, and this situation should be exceptional enough that this is not objectionable. The user probably knows what they did to cause it, anyway. About the early error reporting. I expect by far the most common scenario is that each overwritten symlink is moving from one version or dependency hash of a package to another version or dependency hash of the same package. If this is the case for all the executables being overwritten, the error should list each package involved once, together with either the old/new version pair if that is different or the old/new dependency tree hash if the versions are the same. I think it's not necessary to list all the executables for each of these packages, but this is also my least strongly held opinion of this whole comment. In exceptional circumstances, some executable is going to be provided by a different package than it used to be; then the error should list each executable that will be overwritten, together with the old/new package pair (if packages differ), the old/new version pair (if packages are the same but versions differ), or the old/new hash pair (if packages and versions are the same). |
I've been asked to add my opinion, so I will. From the perspective of configuring machines and/or docker images, I'd much rather have a default error condition on overwrite (even if it would converge to an identical state on overwrite). Usually when this happens, it's the sign of something wrong in automation or an operator error. I agree that a force-overwrite would be nice, and it would be excellent as a short option since the most likely case for such a flag would be human intervention (manually upgrading a dev environment or quickly producing a prototype docker image with updated deps for testing). Notification of error is a lot easier than having a flag to require an error, because it's easier to search documentation (or I guess, all the of the internet) for a present event with a fixed error string rather than the alternative. |
I'd prefer an error, with a flag to allow overwrite. It would also be good if the error message mentioned the flag. Maximum bikeshedding: |
@gwils btw, |
I didn't read properly, but
So I'd prefer a quick error by default (and no error if exactly same link), and a I had following sequence way to often:
OTOH: this is more rare, but I need a manual step now
To bikeshed ever further, I'd like to have |
(marking high prio as users are reporting this and being confused) |
Does not warn if the existing symlink already points to the correct location Partial solution to haskell#5491
Does not warn if the existing symlink already points to the correct location Partial solution to haskell#5491
Does not warn if the existing symlink already points to the correct location Partial solution to haskell#5491
Warn when failing to symlink an exe in new-install This provides a partial fix/improvement to #5491
Does not warn if the existing symlink already points to the correct location Partial solution to haskell#5491
It still makes it very difficult to upgrade cabal-install itself. |
I'm thinking the reason why opinions on the "replace silently" vs. "error out" matter clash here is because of conflicting use cases. One use case is installing things for production use; in this case, you don't want to casually replace symlinks, so an error (with an The other use case is a development loop: change code - build - install - run & test. In this scenario, we do want to silently overwrite the symlink, because the effect we are after is that whatever binary is on the |
#5638 adds the error and the flag. I'm lowering the priority of this issue since it only remains to check for error/no-op as early as possible. |
Closing in favor of #6832 since this issue is actually resolved and keeping it open is misleading. |
Uh oh!
There was an error while loading. Please reload this page.
Currently, when you e.g.
cabal new-install hsc2hs --symlink-bindir=/tmp/bin
, and something exists already in/tmp/bin
,new-install
will claim toeven though it failed to update the symlink.
E.g.
that's ok so far, as the end-result was in fact having a symlink pointing to
hsc2hs-0.68.3
; however, when I request tonew-install
again which is expected to results in a different symlink,new-install
silently fails to:Consequently,
new-install
ought to at very least warn if not even error (or even better yet overwrite), when it cannot produce the desired final state of the symlink; specifically,I'd expect two subsequent invocations of e.g.
to be idempotent and the 2nd invocation not warn if the first one succeded, as the resulting end-state of the symlink would be unchanged.
As to whether we ought to
I'm not totally sure (I'd prefer the overwrite variant); I merely claim that the current situation is definitely bad/wrong, and any of the options above would be an improvement.
See also #5408 where old-build appears to have a warning
The text was updated successfully, but these errors were encountered: