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

Bash completion triggers execution #3271

Closed
Tuplanolla opened this issue Apr 2, 2016 · 0 comments
Closed

Bash completion triggers execution #3271

Tuplanolla opened this issue Apr 2, 2016 · 0 comments

Comments

@Tuplanolla
Copy link

There is a bug in the file cabal-install/bash-completion/cabal that
causes incomplete and potentially dangerous commands to be executed when
the shell is requested to complete them.
Typing in cabal run --, adding an argument to the end and
trying to complete it by hitting Tab twice triggers the bug.
The behavior is as follows.

$ cat > Main.hs
module Main where

import System.Environment

main :: IO ()
main = getArgs >>= putStrLn . ("(" ++) . (++ ")") . unwords
$ cabal init --is-executable --non-interactive

Guessing dependencies...

Generating LICENSE...
Warning: unknown license type, you must put a copy in LICENSE yourself.
Generating Setup.hs...
Generating bug.cabal...

Warning: no synopsis given. You should edit the .cabal file and add one.
You may want to edit the .cabal file and add a Description field.
$ touch LICENSE
$ cabal run -- bug with arguments
(with            Running          bug-0.1.0.0...   for
--list-options)  arguments        bug...
Preprocessing    bug              executable
$ cabal run -v0 -- bug with arguments
(with            --list-options)  arguments
@dcoutts dcoutts closed this as completed in c2ca6e4 Apr 2, 2016
dcoutts added a commit that referenced this issue Apr 2, 2016
Respect "--" in bash-completion, fixes #3271
23Skidoo pushed a commit that referenced this issue Apr 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant