Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

private-cwd not expanding macros (e.g. ${HOME}) #4910

Closed
reinerh opened this issue Feb 7, 2022 · 7 comments
Closed

private-cwd not expanding macros (e.g. ${HOME}) #4910

reinerh opened this issue Feb 7, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@reinerh
Copy link
Collaborator

reinerh commented Feb 7, 2022

hyperrogue.profile currently contains the following line:

private-cwd ${HOME}

(it's currently the only profile using private-cwd.)

When trying to run firejail with this profile it fails with the following error:

$ firejail hyperrogue
Reading profile /etc/firejail/hyperrogue.profile
Reading profile /etc/firejail/disable-common.inc
Reading profile /etc/firejail/disable-devel.inc
Reading profile /etc/firejail/disable-exec.inc
Reading profile /etc/firejail/disable-interpreters.inc
Reading profile /etc/firejail/disable-programs.inc
Reading profile /etc/firejail/disable-shell.inc
Reading profile /etc/firejail/disable-xdg.inc
Reading profile /etc/firejail/whitelist-common.inc
Reading profile /etc/firejail/whitelist-usr-share-common.inc
Reading profile /etc/firejail/whitelist-var-common.inc
Error: invalid private working directory

Removing ${HOME} from the private-cwd line fixes it. According to the manpage the home directory is also the default directory when no other directory is specified.

Was the ${HOME} added by accident? Or should this be supported?

(Problem was found by Ubuntu CI btw: https://autopkgtest.ubuntu.com/results/autopkgtest-jammy/jammy/arm64/f/firejail/20220207_124108_3cf17@/log.gz
This will currently prevent the package from entering 22.04 until it is fixed, if I understand their CI correctly.)

@rusty-snake
Copy link
Collaborator

hyperrogue saves it's game state at ./hyperrogue.ini. Which works badly with (no)blacklist/whitelist. That's why I added the private-cwd.

@rusty-snake
Copy link
Collaborator

  • firejail --private-cwd="${HOME}" --noprofile ls: Works
  • firejail --private-cwd='${HOME}' --noprofile ls: Broken

The fix for #4780 seems to check for relative/absolute path before expanding macros (${HOME}).

@reinerh
Copy link
Collaborator Author

reinerh commented Feb 7, 2022

hyperrogue saves it's game state at ./hyperrogue.ini. Which works badly with (no)blacklist/whitelist. That's why I added the private-cwd.

Ah, I remember that hyperrogue bug. If you use Debian, I fixed that in 12.0f-1 (#985797), otherwise just build with -DFHS, then it will store the config in ~/.hyperrogue.ini. (In my opinion building without -DFHS is a bug in the distribution package; so we could use a black/whitelist approach in the profile)

@reinerh reinerh added the bug Something isn't working label Feb 7, 2022
@reinerh reinerh changed the title private-cwd ${HOME} in profile not working private-cwd not expanding macros (e.g. ${HOME}) Feb 7, 2022
@netblue30
Copy link
Owner

Got the same on Debian stable, removed ${HOME} from the profile. This fixes it for the game.

"private-cwd" and "private-cwd ${HOME}" should be equivalent. I'll look to see what's going on in the code. Same problem with "firejail --private-cwd='${HOME}' --noprofile ls"

@netblue30
Copy link
Owner

5753400

netblue30 added a commit that referenced this issue Feb 8, 2022
@kmk3
Copy link
Collaborator

kmk3 commented Feb 8, 2022

fix --private-cwd, issue #4910

Nice, it works for me with --private-cwd='${HOME}'.

Can this be closed then?

@kmk3 kmk3 added this to To do in Release 0.9.70 via automation Feb 8, 2022
@netblue30
Copy link
Owner

Yes, closed! Will reopen again if necessary.

@kmk3 kmk3 moved this from To do to Done (on RELNOTES) in Release 0.9.70 Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Release 0.9.70
  
Done (on RELNOTES)
Development

No branches or pull requests

4 participants