Skip to content

new-install: error on existing symlink, overwrite option - #5638

Merged
23Skidoo merged 4 commits into
haskell:masterfrom
fgaz:new-install/error-symlink
Oct 30, 2018
Merged

23Skidoo merged 4 commits into
haskell:masterfrom
fgaz:new-install/error-symlink

Conversation

@fgaz

@fgaz fgaz commented Oct 25, 2018

Copy link
Copy Markdown
Member

Phase 2 of the fix for #5491. Followup to #5602.

Erroring out is safer and more explicit.

Next, we'll have to check for error/no-op as early as possible (currently we build everything first).

/cc @hvr

@fgaz fgaz added the cabal-install: v2-build system Affecting v2-build and related commands that use v2-architecture (aka "nix local builds"). label Oct 25, 2018
@fgaz fgaz added this to the 2.4.0.1 milestone Oct 25, 2018
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 25, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "10f5a983ce727e9e745cbcf154e80c6817301b13",
"tag":"linux-8.0.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 25, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "10f5a983ce727e9e745cbcf154e80c6817301b13",
"tag":"linux-7.8.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 25, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "10f5a983ce727e9e745cbcf154e80c6817301b13",
"tag":"linux-7.10.3"
}
@fgaz
fgaz force-pushed the new-install/error-symlink branch from 10f5a98 to 446be82 Compare October 25, 2018 12:52
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 25, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "446be82f50735871092e9f7434c24aa782227f01",
"tag":"linux-7.10.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 25, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "446be82f50735871092e9f7434c24aa782227f01",
"tag":"linux-8.0.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 25, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "446be82f50735871092e9f7434c24aa782227f01",
"tag":"linux-7.8.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 25, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "446be82f50735871092e9f7434c24aa782227f01",
"tag":"linux-8.2.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 25, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "446be82f50735871092e9f7434c24aa782227f01",
"tag":"linux-7.6.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 25, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "446be82f50735871092e9f7434c24aa782227f01",
"tag":"linux-8.4.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 25, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "446be82f50735871092e9f7434c24aa782227f01",
"tag":"linux-8.4.4-fdebug-expensive-assertions"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 25, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "446be82f50735871092e9f7434c24aa782227f01",
"tag":"osx-7.8.4"
}
@fgaz
fgaz force-pushed the new-install/error-symlink branch from 446be82 to 7f13951 Compare October 25, 2018 14:18
fgaz added 2 commits October 25, 2018 16:37
Before, new-install could exit successfully while actually _not_ symlinking
anything.
Moreover, without an overwrite option, upgrading cabal was impossible
without moving links around.

* Error out on overwrite
* Overwrite if --force-overwrite is passed
@fgaz
fgaz force-pushed the new-install/error-symlink branch from 7f13951 to a3d222d Compare October 25, 2018 14:37
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 25, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "a3d222d2a7581465b902ba1962d7c56f45a66e7c",
"tag":"linux-7.10.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 25, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "a3d222d2a7581465b902ba1962d7c56f45a66e7c",
"tag":"linux-7.8.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 25, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "a3d222d2a7581465b902ba1962d7c56f45a66e7c",
"tag":"linux-8.2.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 25, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "a3d222d2a7581465b902ba1962d7c56f45a66e7c",
"tag":"linux-8.0.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 25, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "a3d222d2a7581465b902ba1962d7c56f45a66e7c",
"tag":"linux-7.6.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 25, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "a3d222d2a7581465b902ba1962d7c56f45a66e7c",
"tag":"linux-8.4.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 25, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "a3d222d2a7581465b902ba1962d7c56f45a66e7c",
"tag":"linux-8.4.4-fdebug-expensive-assertions"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 25, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "a3d222d2a7581465b902ba1962d7c56f45a66e7c",
"tag":"osx-7.8.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 26, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "a3d222d2a7581465b902ba1962d7c56f45a66e7c",
"tag":"osx-8.0.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 26, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "bf4b9c949a50a55bf91ee30df07437c9d956b9a8",
"tag":"linux-7.10.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 26, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "bf4b9c949a50a55bf91ee30df07437c9d956b9a8",
"tag":"linux-8.0.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 26, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "bf4b9c949a50a55bf91ee30df07437c9d956b9a8",
"tag":"linux-7.8.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 26, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "bf4b9c949a50a55bf91ee30df07437c9d956b9a8",
"tag":"linux-8.2.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 26, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "bf4b9c949a50a55bf91ee30df07437c9d956b9a8",
"tag":"linux-7.6.3"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 26, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "bf4b9c949a50a55bf91ee30df07437c9d956b9a8",
"tag":"linux-8.4.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 26, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "bf4b9c949a50a55bf91ee30df07437c9d956b9a8",
"tag":"linux-8.4.4-fdebug-expensive-assertions"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 26, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "bf4b9c949a50a55bf91ee30df07437c9d956b9a8",
"tag":"osx-7.8.4"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 26, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "bf4b9c949a50a55bf91ee30df07437c9d956b9a8",
"tag":"osx-8.0.2"
}
haskell-pushbot pushed a commit to haskell-pushbot/cabal-binaries that referenced this pull request Oct 28, 2018
"url":"pull/5638",
"account":"haskell",
"repo":"cabal",
"commit": "bf4b9c949a50a55bf91ee30df07437c9d956b9a8",
"tag":"osx-7.10.3"
}
@hvr

hvr commented Oct 28, 2018

Copy link
Copy Markdown
Member

I gave this PR a test-run, and it appears to work reasonably.

There's some minor aesthetic issues with some messages which e.g. claim that a "Symlink" already exists even though it's not a symlink but a regular file... but there's a few more (not high prio) UI details we might want to improve/fix there that this can be addressed by a future PR

@23Skidoo 23Skidoo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

"Overwrite an existing symlink."
ninstForceOverwrite (\v flags -> flags { ninstForceOverwrite = v })
trueArg
, option [] ["overwrite-policy"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We can also make it work similarly to --allow-newer, i.e. make --overwrite-symlink w/o arguments be a shortcut for --overwrite-symlink=always.

@hvr hvr Oct 29, 2018 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@23Skidoo btw, didn't we want to deprecate the option-less --allow-newer variant? :)

also, are you implying a suggestion of renaming --overwrite-policy=... to --overwrite-symlink=...?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oh and btw, I'd like to point out that during dogfooding I started using an abbrev, like e.g.

cabal v2-install alex --overwrite=always

or even

cabal v2-install alex --over=always

@hvr hvr Oct 29, 2018 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@23Skidoo after thinking about this, the decision whether to support an argument less --overwrite-... hinges on what default we want to pick. I.e. if we default to always it'd be confusing to have a seemingly no-op alias which just reaffirms the default setting; thus I'd suggest to postpone adding a shortcut to this PR, and put it up for vote together with the decision for which default we want to pick for the benefit of interactive shell users

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thus I'd suggest to postpone adding a shortcut to this PR

Sure. Let's merge.

@23Skidoo
23Skidoo merged commit a0684df into haskell:master Oct 30, 2018
@23Skidoo

Copy link
Copy Markdown
Member

Merged, thanks!

23Skidoo added a commit that referenced this pull request Oct 30, 2018
new-install: error on existing symlink, overwrite option
(cherry picked from commit a0684df)
@23Skidoo

Copy link
Copy Markdown
Member

Also cherry-picked to 2.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cabal-install: v2-build system Affecting v2-build and related commands that use v2-architecture (aka "nix local builds"). priority: high 🔥

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants