cabal icon indicating copy to clipboard operation
cabal copied to clipboard

external commands need to explicitly handle their own name being passed to the executable

Open MangoIV opened this issue 1 year ago • 10 comments

Describe the bug

#9412 passes name to the external executable. The use case is a symlink to an executable that handles multiple commands.

I think this use-case doesn't justify the complication this causes for the average case and it isn't strictly necessary to support the use-case.

To Reproduce

  1. have a command cabal-bla in your environment that doesn't allow to take the argument "bla"
  2. run cabal bla
  3. should fail with "doesn't expect "bla""

Expected behavior

cabal bla should be equivalent to cabal-bla

To support the intended use case

If you want to have a singular exe handle multiple plugin arguments, just write a wrapper that invokes the particular exe with the argument and symlink the bash wrapper. This behavior should not go at the cost of the average case behavior.

Additional context The fix should be easy, just don't pass name to the executable here: https://github.com/haskell/cabal/blob/9b3ce92dc6ce0188066ee5f76f249025cdc9df91/cabal-install/src/Distribution/Client/Main.hs#L383

(@mpickering)

MangoIV avatar Aug 25 '24 11:08 MangoIV