! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
xfce fails on automounted (NFS) home-directories.
Status:
CLOSED: FIXED
Priority:
Very High
Severity:
blocker
Product:
Libxfce4util
Component:
General

Comments

Description Joel Fredrikson 2005-01-19 16:15:06 CET
When a user:s home-directory is nfs-mounted using indirect maps in automount,
xfce4 will not start.

The user will get a lot of errors like this ...

(xfce4-session:494): libxfce4util-WARNING **: Invalid XDG_CACHE_HOME directory
`/home/ittest1/.cache', program may behave incorrectly.

The problem lies in xfce_mkdirhier() located in
libxfce4util-4.2.0/libxfce4util/xfce-fileutils.c

In the above warning xfce_mkdirhier() tries to create the entire hierarchy of
the directory /home/ittest1/.cache, the first (/home) fails with EEXIST and is
ignored, the second (/home/ittest1) also fails but it returns ENOSYS since /home
is a indirect automount map. xfce_mkdirhier() therefor fails to create any
directories under $HOME.

The fix is either to ignore ENOSYS or only to call mkdir() if the directory does
not already exist.

Output from truss (the relevant lines).
695:    umask(0)                                        = 022
695:    umask(022)                                      = 0
695:    mkdir("/home", 0777)                            Err#17 EEXIST
695:    xstat(2, "/home", 0x08047200)                   = 0
695:    mkdir("/home/ittest1", 0777)                    Err#89 ENOSYS
695:    umask(022)                                      = 022
695:    getpid()                                        = 695 [672]
695:    write(2, "\n ( x f c e 4 - s e s s".., 141)     = 141

 

Reproducible: Always
Steps to Reproduce:
1. 
2. 
3.
Comment 1 Joel Fredrikson 2005-01-19 16:17:44 CET
Created attachment 158 
Suggested patch
Comment 2 Brian J. Tarricone (not reading bugmail) 2005-01-19 19:31:19 CET
is this the normal way of doing this?  it seems to me that you should be
explicitly mounting the user's homedir when they log in.  your patch also
ignores ENOSYS, which probably isn't a very good idea: it'll work in your case,
but if there's actually an error, weird behavior might result.

at any rate, i don't think it's an incorrect assumption to make that the parent
dir of $XDG_CONFIG_HOME should already exist when we start xfce.

FYI: for future reference, please use unified diff format (-u).  it's much
easier to read and provides better context.
Comment 3 Joel Fredrikson 2005-01-19 19:56:09 CET
If we did explicit mounting of home-directories, we would have approximatly
10000 nfs-mounts on every machine. Resulting in very heavy nfs-traffic.

They way we mount home-directories is the normal (default even) way when you
deal with nfs-mounted home-directories under Solaris (or probably any large
NFS-installation).


A better fix would probably be to do a stat() and see if a mkdir() is really
necessary for every part of the path given to xfce_mkdirhier().

 > at any rate, i don't think it's an incorrect assumption to make that the
 > parent dir of $XDG_CONFIG_HOME should already exist when we start xfce.

I totaly agree, but this is *not* what you do in the code.
The code assumes that no directories at all exist on the filesystem.


Comment 4 Brian J. Tarricone (not reading bugmail) 2005-01-19 20:09:14 CET
(In reply to comment #3)
> If we did explicit mounting of home-directories, we would have approximatly
> 10000 nfs-mounts on every machine. Resulting in very heavy nfs-traffic.

er...  there isn't a way to unmount the homedir after the user logs out?  or
after some inactivity timeout?  isn't that what automount does anyway?

> A better fix would probably be to do a stat() and see if a mkdir() is really
> necessary for every part of the path given to xfce_mkdirhier().

that makes sense.  it'll be a little slower, probably, but it only has to run once.

>  > at any rate, i don't think it's an incorrect assumption to make that the
>  > parent dir of $XDG_CONFIG_HOME should already exist when we start xfce.
> 
> I totaly agree, but this is *not* what you do in the code.
> The code assumes that no directories at all exist on the filesystem.

right, because it's a generic implementation of mkdirhier() - taken verbatim
from glibc, actually, IIRC.  or maybe it's BSD's libc.  still, if we assume that
$XDG_CONFIG_HOME's parent is already available (and properly mounted), it will
work properly as-is.

anyway, it's up to benny.
Comment 5 Joel Fredrikson 2005-01-19 20:24:14 CET
> er...  there isn't a way to unmount the homedir after the user logs out?  or
> after some inactivity timeout?  isn't that what automount does anyway?

Yes, and that is exactly why we use the automounter, but you cannot create
directories in a directory under the direct control of the automounter.
You can create direcories in the mounted filesystems.


As root on the machine

% mkdir /home/foo
mkdir: Failed to make directory "/home/foo"; Operation not applicable
% mkdir /home/ittest1/foo
% 

Comment 6 Joel Fredrikson 2005-01-19 21:14:26 CET
> right, because it's a generic implementation of mkdirhier() - taken verbatim
> from glibc, actually, IIRC.  or maybe it's BSD's libc.  still, if we assume that
> $XDG_CONFIG_HOME's parent is already available (and properly mounted), it will
> work properly as-is.

According to the code, xfce_mkdirhier() originates from the mkdir-command in
FreeBSD.

So just for fun I ported mkdir from FreeBSD to solaris with a minimum of changes.
And sure enough, freebsd_mkdir can't create directories in my home-directory.

  First, just a test to see that it works ...

% freebsd_mkdir -p /tmp/foo
% ls -ld /tmp/foo
drwxr-xr-x   2 joel     it           117 Jan 19 22:03 /tmp/foo

  Verify that my home-directory exist ....

% ls -ld /home/joel
drwx--x--x 218 joel     it         69632 Jan 19 21:53 /home/joel

  Trying to create a directory, the "-p" flag must be used so that the
  mkdirhier-code is used.

% freebsd_mkdir -p /home/joel/foo
mkdir: /home/joel, Operation not applicable
% ls -ld /home/joel/foo
/home/joel/foo: No such file or directory

  And finally use solaris mkdir

% mkdir -p /home/joel/foo
% ls -ld /home/joel/foo
drwxr-xr-x   2 joel     it           512 Jan 19 22:08 /home/joel/foo/


The mkdir command from FreeBSD does not work under Solaris !!!
Comment 7 Benedikt Meurer editbugs 2005-01-31 17:59:32 CET
Brian, we need a bugzilla category for `libxfce4util' or atleast a category
`libs', so I get notified of new bug reports (I don't have time to check for new
bugs regularly).

On the topic: 

(a) Yes, automount is the only proper way to handle large NFS installations, and
its pretty common, so we need to fix this.

(b) The NFS server runs Solaris as well?

Benedikt
Comment 8 Joel Fredrikson 2005-02-01 07:58:28 CET
Both the client and server runs Solaris 9.
Comment 9 Benedikt Meurer editbugs 2005-02-02 22:12:31 CET
Created attachment 180 
Final patch

This patch should fix the problem once and for all. Please test and verify.

Note, that the stat() before mkdir() solution won't work, as that would
introduce a race condition.
Comment 10 Jasper Huijsmans editbugs 2005-03-14 21:00:18 CET
Joel, did you try Benedikts patch?
Comment 11 Joel Fredrikson 2005-03-17 18:29:53 CET
I have tested the patch and xfce_mkdirhier() works correctly for Solaris now.

Sorry, didn't realize you wait for feedback from me.
Comment 12 Benedikt Meurer editbugs 2005-03-17 20:13:43 CET
Ok, so I resolve this bug. The fix is in 4.2.1.

Bug #724

Reported by:
Joel Fredrikson
Reported on: 2005-01-19
Last modified on: 2009-07-15

People

Assignee:
Benedikt Meurer
CC List:
2 users

Version

Attachments

Suggested patch (542 bytes, patch)
2005-01-19 16:17 CET , Joel Fredrikson
no flags
Final patch (3.94 KB, patch)
2005-02-02 22:12 CET , Benedikt Meurer
no flags

Additional information