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

doing cabal install --program-suffix=blah produces a confusing message #10476

Open
ulysses4ever opened this issue Oct 25, 2024 · 0 comments
Open
Labels
cabal-install: cmd/install re: --program-suffix Concerning option `--program-suffix` re: user experience User experience (UX) issue type: bug

Comments

@ulysses4ever
Copy link
Collaborator

ulysses4ever commented Oct 25, 2024

Describe the bug

On the second run of the command you expect a failure because the target already exists. But the issue is that the "already exists" message cites a path without the suffix!

To Reproduce

[nix-shell:~]$ cabal --version
cabal-install version 3.10.3.0
compiled using version 3.10.3.0 of the Cabal library 

[nix-shell:~]$ cabal install hello --program-suffix=-new-5
Resolving dependencies...
Build profile: -w ghc-9.6.5 -O1
In order, the following will be built (use -v for more details):
 - hello-1.0.0.2 (exe:hello) (requires build)
Starting     hello-1.0.0.2 (all, legacy fallback)
Building     hello-1.0.0.2 (all, legacy fallback)
Installing   hello-1.0.0.2 (all, legacy fallback)
Completed    hello-1.0.0.2 (all, legacy fallback)
Symlinking 'hello' to '/home/artem/.local/bin/hello-new-5'

[nix-shell:~]$ cabal install hello --program-suffix=-new-5
Resolving dependencies...
Symlinking 'hello' to '/home/artem/.local/bin/hello-new-5'
Error: cabal: Path '/home/artem/.local/bin/hello' already exists. Use
--overwrite-policy=always to overwrite.

[nix-shell:~]$ ls /home/artem/.local/bin/hello
ls: cannot access '/home/artem/.local/bin/hello': No such file or directory

Expected behavior
The error message should cite the path with the suffix. The non-suffixed path may not even exist at all, as shown above.

System information

  • Operating system: NixOS
  • cabal 3.10.3, ghc 9.6.5

Additional context
Discovered when looking into #10290

@ulysses4ever ulysses4ever added type: bug cabal-install: cmd/install re: user experience User experience (UX) issue re: --program-suffix Concerning option `--program-suffix` labels Oct 25, 2024
ulysses4ever added a commit that referenced this issue Oct 28, 2024
When checking for existing installations, cabal would not account for
an affix (suffix or prefix). So, if you had a `hello` binary installed, installing a
second one with a non-empty affix (a perfectly legal operation) would
fail.

The reason seemed to be a typo in
09c04e9, which passed the arguments to
the Symlink structure in a wrong order.

When failing to install a binary because of an existing one, cabal would
report suffix-less existing target even if a suffix was set.

fixup
ulysses4ever added a commit that referenced this issue Oct 28, 2024
When checking for existing installations, cabal would not account for
an affix (suffix or prefix). So, if you had a `hello` binary installed, installing a
second one with a non-empty affix (a perfectly legal operation) would
fail.

The reason seemed to be a typo in
09c04e9, which passed the arguments to
the Symlink structure in a wrong order.

When failing to install a binary because of an existing one, cabal would
report suffix-less existing target even if a suffix was set.
geekosaur pushed a commit that referenced this issue Nov 2, 2024
When checking for existing installations, cabal would not account for
an affix (suffix or prefix). So, if you had a `hello` binary installed, installing a
second one with a non-empty affix (a perfectly legal operation) would
fail.

The reason seemed to be a typo in
09c04e9, which passed the arguments to
the Symlink structure in a wrong order.

When failing to install a binary because of an existing one, cabal would
report suffix-less existing target even if a suffix was set.
mergify bot pushed a commit that referenced this issue Nov 2, 2024
…10483)

* fix cabal install --program-suffix/prefix (fix #10290 and #10476)

When checking for existing installations, cabal would not account for
an affix (suffix or prefix). So, if you had a `hello` binary installed, installing a
second one with a non-empty affix (a perfectly legal operation) would
fail.

The reason seemed to be a typo in
09c04e9, which passed the arguments to
the Symlink structure in a wrong order.

When failing to install a binary because of an existing one, cabal would
report suffix-less existing target even if a suffix was set.

* Add regression tests for overwrite policies and porgram-affixes

Add regression tests for the `program-prefix` and `program-suffix` flags
combined with the overwrite-policy.
In short, the overwrite-policy needs to take potential program affixes
into account when deciding whether it will need to overwrite a program
path during installation.

---------

Co-authored-by: Fendor <[email protected]>
mergify bot pushed a commit that referenced this issue Nov 3, 2024
…10483)

* fix cabal install --program-suffix/prefix (fix #10290 and #10476)

When checking for existing installations, cabal would not account for
an affix (suffix or prefix). So, if you had a `hello` binary installed, installing a
second one with a non-empty affix (a perfectly legal operation) would
fail.

The reason seemed to be a typo in
09c04e9, which passed the arguments to
the Symlink structure in a wrong order.

When failing to install a binary because of an existing one, cabal would
report suffix-less existing target even if a suffix was set.

* Add regression tests for overwrite policies and porgram-affixes

Add regression tests for the `program-prefix` and `program-suffix` flags
combined with the overwrite-policy.
In short, the overwrite-policy needs to take potential program affixes
into account when deciding whether it will need to overwrite a program
path during installation.

---------

Co-authored-by: Fendor <[email protected]>
(cherry picked from commit ee3c313)
mergify bot pushed a commit that referenced this issue Nov 3, 2024
…10483)

* fix cabal install --program-suffix/prefix (fix #10290 and #10476)

When checking for existing installations, cabal would not account for
an affix (suffix or prefix). So, if you had a `hello` binary installed, installing a
second one with a non-empty affix (a perfectly legal operation) would
fail.

The reason seemed to be a typo in
09c04e9, which passed the arguments to
the Symlink structure in a wrong order.

When failing to install a binary because of an existing one, cabal would
report suffix-less existing target even if a suffix was set.

* Add regression tests for overwrite policies and porgram-affixes

Add regression tests for the `program-prefix` and `program-suffix` flags
combined with the overwrite-policy.
In short, the overwrite-policy needs to take potential program affixes
into account when deciding whether it will need to overwrite a program
path during installation.

---------

Co-authored-by: Fendor <[email protected]>
(cherry picked from commit ee3c313)
geekosaur pushed a commit that referenced this issue Nov 3, 2024
…10483)

* fix cabal install --program-suffix/prefix (fix #10290 and #10476)

When checking for existing installations, cabal would not account for
an affix (suffix or prefix). So, if you had a `hello` binary installed, installing a
second one with a non-empty affix (a perfectly legal operation) would
fail.

The reason seemed to be a typo in
09c04e9, which passed the arguments to
the Symlink structure in a wrong order.

When failing to install a binary because of an existing one, cabal would
report suffix-less existing target even if a suffix was set.

* Add regression tests for overwrite policies and porgram-affixes

Add regression tests for the `program-prefix` and `program-suffix` flags
combined with the overwrite-policy.
In short, the overwrite-policy needs to take potential program affixes
into account when deciding whether it will need to overwrite a program
path during installation.

---------

Co-authored-by: Fendor <[email protected]>
(cherry picked from commit ee3c313)
geekosaur pushed a commit that referenced this issue Nov 3, 2024
…10483)

* fix cabal install --program-suffix/prefix (fix #10290 and #10476)

When checking for existing installations, cabal would not account for
an affix (suffix or prefix). So, if you had a `hello` binary installed, installing a
second one with a non-empty affix (a perfectly legal operation) would
fail.

The reason seemed to be a typo in
09c04e9, which passed the arguments to
the Symlink structure in a wrong order.

When failing to install a binary because of an existing one, cabal would
report suffix-less existing target even if a suffix was set.

* Add regression tests for overwrite policies and porgram-affixes

Add regression tests for the `program-prefix` and `program-suffix` flags
combined with the overwrite-policy.
In short, the overwrite-policy needs to take potential program affixes
into account when deciding whether it will need to overwrite a program
path during installation.

---------

Co-authored-by: Fendor <[email protected]>
(cherry picked from commit ee3c313)
geekosaur pushed a commit that referenced this issue Nov 3, 2024
…10483)

* fix cabal install --program-suffix/prefix (fix #10290 and #10476)

When checking for existing installations, cabal would not account for
an affix (suffix or prefix). So, if you had a `hello` binary installed, installing a
second one with a non-empty affix (a perfectly legal operation) would
fail.

The reason seemed to be a typo in
09c04e9, which passed the arguments to
the Symlink structure in a wrong order.

When failing to install a binary because of an existing one, cabal would
report suffix-less existing target even if a suffix was set.

* Add regression tests for overwrite policies and porgram-affixes

Add regression tests for the `program-prefix` and `program-suffix` flags
combined with the overwrite-policy.
In short, the overwrite-policy needs to take potential program affixes
into account when deciding whether it will need to overwrite a program
path during installation.

---------

Co-authored-by: Fendor <[email protected]>
(cherry picked from commit ee3c313)
mergify bot added a commit that referenced this issue Nov 5, 2024
…10483) (#10510)

* fix cabal install --program-suffix/prefix (fix #10290 and #10476)

When checking for existing installations, cabal would not account for
an affix (suffix or prefix). So, if you had a `hello` binary installed, installing a
second one with a non-empty affix (a perfectly legal operation) would
fail.

The reason seemed to be a typo in
09c04e9, which passed the arguments to
the Symlink structure in a wrong order.

When failing to install a binary because of an existing one, cabal would
report suffix-less existing target even if a suffix was set.

* Add regression tests for overwrite policies and porgram-affixes

Add regression tests for the `program-prefix` and `program-suffix` flags
combined with the overwrite-policy.
In short, the overwrite-policy needs to take potential program affixes
into account when deciding whether it will need to overwrite a program
path during installation.

---------

Co-authored-by: Fendor <[email protected]>
(cherry picked from commit ee3c313)

Co-authored-by: Artem Pelenitsyn <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cabal-install: cmd/install re: --program-suffix Concerning option `--program-suffix` re: user experience User experience (UX) issue type: bug
Projects
None yet
Development

No branches or pull requests

1 participant