Skip to content

Bash: ambiguous redirect on eval "$(devbox global shellenv)" #2814

@proedie

Description

@proedie

What happened?

eval "$(devbox global shellenv)" causes the error message "bash: 1__bp_interactive_mode: ambiguous redirect" to appear at every new prompt. (And by "new prompt" I don't mean when I open a new instance of Bash, but whenever a command finishes execution!)

This is a fresh installation of Devbox on a system that had Devbox installed previously. I deleted all Devbox and Nix configuration files I am aware of. I followed the uninstallation guide and re-installed both Devbox and Nix to rule out a configuration error as best as I could.

I found that the culprit is the following export generated by devbox global shellenv:

export PROMPT_COMMAND="__bp_precmd_invoke_cmd\
dbus-send --type=method_call --session --dest=io.elementary.terminal /io/elementary/terminal io.elementary.terminal.ProcessFinished string:\$PANTHEON_TERMINAL_ID string:\"\$(fc -nl -1 | cut -c 3-)\" int32:\$__bp_last_ret_value >/dev/null 2>&1\
__bp_interactive_mode";

If I move the __bp_interactive_mode"; to the end of the line above it, it works fine!

Therefore, as a workaround one could write the output of devbox global shellenv to a file, edit it accordingly, and add eval "$(cat workaround_file_name)" to the Bash config.

Steps to reproduce

  1. Find a system that has the same problem or download error_snip.txt. (Note: the file is shortened to the problematic lines, it's not the entire output of the command.)
  2. Execute eval "$(cat error_snip)"
  3. The output will be: "bash: 1__bp_interactive_mode: ambiguous redirect"
  4. Open a new shell and try eval "$(fixed_snip.txt)" instead.
  5. There will be no output.

Command

global

devbox.json

{
  "$schema":  "https://raw.githubusercontent.com/jetify-com/devbox/0.17.1/.schema/devbox.schema.json",
  "packages": ["git@latest"],
  "shell": {
    "init_hook": [
      "echo 'Welcome to devbox!' > /dev/null"
    ],
    "scripts": {
      "test": [
        "echo \"Error: no test specified\" && exit 1"
      ]
    }
  }
}

Devbox version

0.17.1

Nix version

2.34.5

What system does this bug occur on?

Linux (x86-64)

Debug logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIssue needs triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions