[GH-ISSUE #326] Vim has wrong CWD when run inside Firejail with the "tracelog" option #227

Closed
opened 2026-05-05 05:21:36 -06:00 by gitea-mirror · 7 comments
Owner

Originally created by @brunonova on GitHub (Feb 26, 2016).
Original GitHub issue: https://github.com/netblue30/firejail/issues/326

Strange issue. I'm running Ubuntu 14.04.

This runs perfectly:

cd ~
firejail --noprofile bash
vim .gitconfig

But if I add the --tracelog option to firejail, vim doesn't find the file and creates a new one instead.

Running :!pwd inside vim in normal mode, which should print the working directory, outputs a different path than the expected one.
And it's not always the same path. The last time I executed it, the result was /usr/share/vim/vim74/indent.

I noticed this in Vim, but other programs may be affected as well.

Originally created by @brunonova on GitHub (Feb 26, 2016). Original GitHub issue: https://github.com/netblue30/firejail/issues/326 Strange issue. I'm running Ubuntu 14.04. This runs perfectly: ``` cd ~ firejail --noprofile bash vim .gitconfig ``` But if I add the `--tracelog` option to firejail, vim doesn't find the file and creates a new one instead. Running `:!pwd` inside vim in normal mode, which should print the working directory, outputs a different path than the expected one. And it's not always the same path. The last time I executed it, the result was `/usr/share/vim/vim74/indent`. I noticed this in Vim, but other programs may be affected as well.
gitea-mirror 2026-05-05 05:21:36 -06:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@chiraag-nataraj commented on GitHub (Feb 27, 2016):

That's really odd...which version of Firejail are you running? I just tried what you suggested and it worked fine for me (:!pwd outputted /home/chiraag/ as expected even with the --tracelog option).

<!-- gh-comment-id:189573415 --> @chiraag-nataraj commented on GitHub (Feb 27, 2016): That's really odd...which version of Firejail are you running? I just tried what you suggested and it worked fine for me (`:!pwd` outputted `/home/chiraag/` as expected even with the `--tracelog` option).
Author
Owner

@brunonova commented on GitHub (Feb 27, 2016):

I'm running the latest version from git master.
What distro are you using?

I forgot to say that this issue doesn't occur in vim.tiny, which is the default version of vi in Ubuntu before installing the vim package.

If I execute vim -D inside firejail with --tracelog:

line 10: runtime! debian.vim
>pwd
/home/$USER
>s
line 3: set runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/
share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/a
fter
>pwd
/usr/share/vim
>cont

The working directory changed after "line 3 ...".
If I execute this without that option or outside Firejail, the working directory stays the same.

<!-- gh-comment-id:189615942 --> @brunonova commented on GitHub (Feb 27, 2016): I'm running the latest version from git `master`. What distro are you using? I forgot to say that this issue doesn't occur in `vim.tiny`, which is the default version of `vi` in Ubuntu before installing the `vim` package. If I execute `vim -D` inside firejail with `--tracelog`: ``` line 10: runtime! debian.vim >pwd /home/$USER >s line 3: set runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/ share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/a fter >pwd /usr/share/vim >cont ``` The working directory changed after "line 3 ...". If I execute this without that option or outside Firejail, the working directory stays the same.
Author
Owner

@chiraag-nataraj commented on GitHub (Feb 27, 2016):

I just tried this with vim (not vim.tiny) and I didn't get the issue with firejail 0.9.38 on Debian sid/experimental and Vim 7.4.

<!-- gh-comment-id:189653765 --> @chiraag-nataraj commented on GitHub (Feb 27, 2016): I just tried this with vim (not vim.tiny) and I didn't get the issue with firejail 0.9.38 on Debian sid/experimental and Vim 7.4.
Author
Owner

@brunonova commented on GitHub (Feb 28, 2016):

Hmm... I tested 0.9.38 (backported from Debian sid/Ubuntu Xenial) and I don't get the issue as well.

So this bug was introduced somewhere after 0.9.38 was released.

<!-- gh-comment-id:189935151 --> @brunonova commented on GitHub (Feb 28, 2016): Hmm... I tested 0.9.38 (backported from Debian sid/Ubuntu Xenial) and I don't get the issue as well. So this bug was introduced somewhere after 0.9.38 was released.
Author
Owner

@brunonova commented on GitHub (Mar 8, 2016):

It seems the bug was introduced in commit d4e6b2e. I tested that and the previous commit.
The bug still exists in the latest commit.

<!-- gh-comment-id:193956311 --> @brunonova commented on GitHub (Mar 8, 2016): It seems the bug was introduced in commit d4e6b2e. I tested that and the previous commit. The bug still exists in the latest commit.
Author
Owner

@netblue30 commented on GitHub (Mar 9, 2016):

I'll look into it, thanks!

<!-- gh-comment-id:194282625 --> @netblue30 commented on GitHub (Mar 9, 2016): I'll look into it, thanks!
Author
Owner

@manevich commented on GitHub (Jul 6, 2016):

I'm somehow overlooked this bug before.
@brunonova Thanks for reporting.

<!-- gh-comment-id:230672051 --> @manevich commented on GitHub (Jul 6, 2016): I'm somehow overlooked this bug before. @brunonova Thanks for reporting.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#227
No description provided.