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.
Created attachment 158 Suggested patch
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.
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.
(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.
> 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 %
> 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 !!!
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
Both the client and server runs Solaris 9.
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.
Joel, did you try Benedikts patch?
I have tested the patch and xfce_mkdirhier() works correctly for Solaris now. Sorry, didn't realize you wait for feedback from me.
Ok, so I resolve this bug. The fix is in 4.2.1.