Is $HOME the Location of User’s Home Directory?

environment-variablesheadlesshomex11

I'm having trouble with a web application I'm writing: The web application, which runs as user nobody, needs to launch an inkscape process to manipulate some SVG files. Because this runs as user nobody, there is no home directory. What I am doing is creating a temporary directory under /tmp and trying to set that as the home directory via export HOME=/tmp/someUniqueId. I then set a few things in that "temporary" home directory, like a symlink .fonts to the folder for the font files to use.

I know this works for finding the ~/.fonts directory. But when I launch Inkscape, all I get is a message that Inkscape could not create the .inkscape directory:

Cannot create directory /.inkscape

Doesn't $HOME set the location of my home directory? Why is Inkscape still trying to access / as my home directory?

Best Answer

Inkscape, being a GTK application, uses the GLib g_get_home_dir function to find the user's home directory. As documented in that link, g_get_home_dir does not consult $HOME, but rather /etc/passwd. You'd have to patch Inkscape to check $HOME first (as shown in that link).

Related Question