[GH-ISSUE #312] name2pid does not handle spaces #219

Closed
opened 2026-05-05 05:20:34 -06:00 by gitea-mirror · 5 comments
Owner

Originally created by @Sidnioulz on GitHub (Feb 21, 2016).
Original GitHub issue: https://github.com/netblue30/firejail/issues/312

name2pid will automatically cut at the first space it encounters in a name, even though names are not checked for absence of spaces when the sandbox is launched.

I partially got around the issue by detecting if there is another option after the name, but there is no safe way to detect the name in situations like this: firejail --name=some name firefox. See 77428367aa

Some additional solutions to make it more robust:

  • A more elaborate check could abort stating that the sandbox name is ambiguous when not followed by an option
  • An empty -- option could be used to delineate the firejail options and command
  • Some additional strstr's could be used to detect short options (-h) if any is supported in the future
Originally created by @Sidnioulz on GitHub (Feb 21, 2016). Original GitHub issue: https://github.com/netblue30/firejail/issues/312 name2pid will automatically cut at the first space it encounters in a name, even though names are not checked for absence of spaces when the sandbox is launched. I partially got around the issue by detecting if there is another option after the name, but there is no safe way to detect the name in situations like this: `firejail --name=some name firefox`. See https://github.com/Sidnioulz/firejail/commit/77428367aa413b706e5dac743417e3de8b6ba309 Some additional solutions to make it more robust: - A more elaborate check could abort stating that the sandbox name is ambiguous when not followed by an option - An empty `--` option could be used to delineate the firejail options and command - Some additional strstr's could be used to detect short options (-h) if any is supported in the future
gitea-mirror 2026-05-05 05:20:34 -06:00
Author
Owner

@netblue30 commented on GitHub (Feb 21, 2016):

Bug! Thanks.

<!-- gh-comment-id:186820464 --> @netblue30 commented on GitHub (Feb 21, 2016): Bug! Thanks.
Author
Owner

@netblue30 commented on GitHub (Feb 21, 2016):

You need to put it in quotes:

$ firejail --name="some name"
$ firejail --join="some name"

or you can escape the blank space:

$ firejail  --name=some\ name
$ firejail --join=some\ name
<!-- gh-comment-id:186823427 --> @netblue30 commented on GitHub (Feb 21, 2016): You need to put it in quotes: ``` $ firejail --name="some name" $ firejail --join="some name" ``` or you can escape the blank space: ``` $ firejail --name=some\ name $ firejail --join=some\ name ```
Author
Owner

@Sidnioulz commented on GitHub (Feb 21, 2016):

There are a few situations where it's difficult to call Firejail that way, namely when using APIs like GDesktopAppInfo or GSpawn from the GLib, or when using any sort of desktop launchers that expect a full command line. In those situations, if you quote the name then Firejail will literally process the name as being "Some name" rather than Some name. Automatically unquoting arguments likely to have spaces would be another way to solve this issue.

<!-- gh-comment-id:186862420 --> @Sidnioulz commented on GitHub (Feb 21, 2016): There are a few situations where it's difficult to call Firejail that way, namely when using APIs like GDesktopAppInfo or GSpawn from the GLib, or when using any sort of desktop launchers that expect a full command line. In those situations, if you quote the name then Firejail will literally process the name as being `"Some name"` rather than `Some name`. Automatically unquoting arguments likely to have spaces would be another way to solve this issue.
Author
Owner

@ivan commented on GitHub (Feb 21, 2016):

FWIW --name="some name" in a shell is the same as passing "--name=some name", maybe try that from GLib?

<!-- gh-comment-id:186870695 --> @ivan commented on GitHub (Feb 21, 2016): FWIW `--name="some name"` in a shell is the same as passing `"--name=some name"`, maybe try that from GLib?
Author
Owner

@Sidnioulz commented on GitHub (Feb 21, 2016):

Brilliant, this syntax does the job. Nothing to fix then :-)

On 21 February 2016 at 17:44, Ivan Kozik notifications@github.com wrote:

FWIW --name="some name" in a shell is the same as passing "--name=some
name", maybe try that from GLib?


Reply to this email directly or view it on GitHub
https://github.com/netblue30/firejail/issues/312#issuecomment-186870695.

Steve Dodier-Lazaro
PhD Student
University College London
Free Software Developer

<!-- gh-comment-id:186878655 --> @Sidnioulz commented on GitHub (Feb 21, 2016): Brilliant, this syntax does the job. Nothing to fix then :-) On 21 February 2016 at 17:44, Ivan Kozik notifications@github.com wrote: > FWIW --name="some name" in a shell is the same as passing "--name=some > name", maybe try that from GLib? > > — > Reply to this email directly or view it on GitHub > https://github.com/netblue30/firejail/issues/312#issuecomment-186870695. ## Steve Dodier-Lazaro PhD Student University College London Free Software Developer
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#219
No description provided.