site  contact  subhomenews

Fix client app passed param with space

September 12, 2024 — BarryK

Forum member Caramel reported a failure if firefox is passed a file on the commandline that has a space character.

Firefox is installed to run as user "firefox", and there are three steps. There is script /usr/bin/firefox, script /usr/bin/firefox.bin, and finally /usr/bin/firefox.bin0 runs the actual Fireox. Same situation with Chromium. having three steps seems complicated, but you can get an idea what they do by viewing the two scripts in a text editor.

Where the problem occurs is that firefox.bin calls firefox.bin0 passing $@, which means that firefox.bin0 will receive parameters thinking that each space delineates a parameter. We need to pass any parameter that has a space character enclosed in double-quotes. Here is the fix:

https://github.com/bkauler/woofq/commit/2e31744d92fc4bec4b7fc753cdc991d87fe6040d

Note this is not an isolated problem. It comes up all over the place, and it is preferable in Linux to not have paths and filenames with spaces.   

Tags: easy