Skip to content

exec is essentially hardcoded to /bin/sh by _PATH_BSHELL #6456

@dotmpe

Description

@dotmpe

Welcome

  • Yes, I'm using the latest major release or the current development version. These are the only supported versions.
  • Yes, I've searched similar issues and discussions on GitHub and didn't find any.

Current Behavior

This has been so ever since 2013, so I am hesitant to raise the issue (see original commit
f691a55)

The issue is that I cannot "shell out" using my own preferred shell, unless:

  • I change the system /bin/sh symlink (e.g. from dash to bash), affecting everything system-wide from cron to systemd
  • Compile my own i3.

In my use case, /bin/sh aka /bin/dash is clearing my env from Bash's function exports. Preventing doing more advanced scripting efficiently. I would guess other shells that use non-standard env (ie. zshell functions) are similarly affected.

dotmpe@bce2544

Above commit is my change, and in my perception that is the right way. I do no see any issue with using env SHELL, except trying to protect users. So that depends on i3 project vision and policy. Also I get that shells can be a difficult and complex subject, and that non-standard env could be a contentious subject. But I just want to use the full power of my shell environment, and it makes sense to start with that at the profile and rc scripts.

Expected Behavior

Unless there is good reason to do so, I expect i3 to shell out using the same env as it received on startup.

Reproduction Instructions

Bash:

foo () { :; }
export -f foo

In subprocess this should work if env was unchanged by other intermediate processes:

env | grep BASH_FUNC_foo
< BASH_FUNC_foo%%=() { :; }
declare -F foo
declare -f foo

i3 version

Binary i3 version:  4.24+ © 2009 Michael Stapelberg and contributors
Running i3 version: 4.24+ (pid 15750)
Loaded i3 config:
  /home/hari/.config/i3/config (main) (last modified: Sat 28 Jun 2025 07:10:06 AM CEST, 53385 seconds ago)

The i3 binary you just called: /usr/local/bin/i3
The i3 binary you are running: i3

Config file

exec --no-startup-id ">&2 declare -f foo"
exec --no-startup-id "env | >&2 grep BASH_FUNC_"

Linux distribution & Version

Debian 13 trixie

Are you using a compositor?

Other

Logfile

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    4.24bugmissing-logRead the CONTRIBUTING.md file for instructions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions