Skip to content

Bad escaping of --test-options #6248

Open

Description

@sjakobi

dhall has a tasty test-suite which I would like to execute with the arguments -p /type-inference\/failure/.

The arguments that cabal ends up passing to the tasty executable are -p ''\''/type-inference\/failure/'\''':

$ cabal test dhall:tasty --test-options "-p '/type-inference\/failure/'" -v
...
Test suite tasty: RUNNING...
/home/simon/src/dhall-haskell/dist-newstyle/build/x86_64-linux/ghc-8.6.5/dhall-1.26.0/t/tasty/noopt/build/tasty/tasty -p ''\''/type-inference\/failure/'\'''
option -p: Could not parse pattern

Activity

  1. UnkindPartition commented on Sep 19, 2019

    @UnkindPartition
    Contributor

    Normally '' would be interpreted and stripped by the shell. It looks like cabal is not doing that (i.e. it tries to pass the single quotes verbatim to the test suite). That's not necessarily a bug, though it would be nice if the precise semantics of --test-options was documented somewhere (is it?).

    In this particular case I think you can simply drop the single quotes, as the outer double quotes would prevent the shell from interpreting the \/, but if the agument contained a white space, I wouldn't know how to pass it.

  2. sjakobi commented on Sep 19, 2019

    @sjakobi
    MemberAuthor

    In this particular case I think you can simply drop the single quotes, as the outer double quotes would prevent the shell from interpreting the \/

    Yes! --test-options "-p /type-inference\/failure/" works. How had I not tried this before?!

  3. ulysses4ever commented on Jun 10, 2022

    @ulysses4ever
    Collaborator

    I wonder if #8093 improved/resolves this.

  4. Mikolaj commented on Jun 11, 2022

    @Mikolaj
    Member

    Or breaks. Let's add the example above as a test for #8093.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions