Skip to content

Syntax of complete.sh is bash-only, breaks SSH connections #2899

@cpitclaudel

Description

@cpitclaudel

OPAM's complete.sh script uses bash-specific syntax, but runs even when the shell is sh. This breaks e.g. Tramp, which runs more or less ssh remote-server "/bin/sh -l -c 'echo $PATH'; echo exit_status: $?" and gets an exit code of 2.

And indeed, once one removes the many layer of redirection to /dev/null, one gets this:

sh: 42: ./complete.sh: Syntax error: "(" unexpected (expecting "}")

Shouldn't OPAM's scripts either be written in SH syntax, or only be sourced when the shell is bash?

$ opam config report
# OPAM config report
# opam-version    1.2.2 
# self-upgrade    no
# os              linux
# external-solver no
# criteria        -removed,-notuptodate,-changed
# jobs            4
# repositories    1* (http), 1 (version-controlled)
# pinned          1 (path)
# current-switch  4.02.3
# last-update     2016-11-13 06:32

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions