Bug#712040: libreoffice dot dir lacks dot
Rene Engelhard wrote:
>On Wed, Jun 12, 2013 at 01:20:05PM +0100, Zefram wrote:
>> libreoffice by default creates some files in a directory ~/libreoffice.
>
>No.
Well, that's what it empirically did for me. Installed via apt-get,
no manual intervention or configuration, no environment variables set
specially for libreoffice.
>UserInstallation=$SYSUSERCONFIG/libreoffice/4
/usr/lib/libreoffice/program/bootstraprc contains the line
UserInstallation=$SYSUSERCONFIG/libreoffice/3
>where SYSUSERCONFIG *is* /home/rene/.config here.
I do not have an environment variable by that name. Trying out setting
it, using just a pathname (of an existing dir) yields failure at startup:
$ SYSUSERCONFIG=/home/zefram/t1 libreoffice test-document.doc
Xlib: extension "XINERAMA" missing on display ":0.2".
[Java framework] Error in function createSettingsDocument (elements.cxx).
javaldx failed!
Warning: failed to read path from javaldx
I18N: Operating system doesn't support locale "en_US"
terminate called after throwing an instance of 'com::sun::star::uno::RuntimeException'
If that sort of setting works for you, maybe that's a v3 vs v4 difference.
Some parts of the source suggest that it's meant to be a URL, and
that works:
$ SYSUSERCONFIG=file:///home/zefram/t1 libreoffice test-document.doc
Xlib: extension "XINERAMA" missing on display ":0.2".
I18N: Operating system doesn't support locale "en_US"
Files appear under /home/zefram/t1/libreoffice/3.
Chasing down that "Error in function createSettingsDocument", to see where
SYSUSERCONFIG gets defaulted, leads eventually to osl_psz_getConfigDir()
in sal/osl/unx/security.c. This has some logic to use XDG_CONFIG_HOME
if it's set, otherwise:
// a default equal to $HOME/.config should be used.
if (!osl_psz_getHomeDir(Security, pszDirectory, nMax))
return sal_False;
n = strlen(pszDirectory);
if (n + sizeof(DOT_CONFIG) < nMax)
{
strncpy(pszDirectory+n, DOT_CONFIG, sizeof(DOT_CONFIG));
if (access(pszDirectory, 0) != 0)
{
// resort to HOME
pszDirectory[n] = '\0';
}
}
That is, it uses ~/.config *if it already exists*, and otherwise just
uses ~. So its ultimate default is, as I found, to create files under
~/libreoffice. Creating ~/.config for test purposes, empirically it does
then get used: ~/.config/libreoffice is created rather than ~/libreoffice.
Aside from putting configuration files in the wrong place by default,
this logic will also lose configuration if ~/.config gets created
(perhaps by a different program) after configuration has already been
saved in ~/libreoffice.
-zefram
Reply to: