This is no duplicate and no race condition, at all. In addition to points 1-2 by Josh Smith, I'd like to add:
3) if ~/.pulse is a symlink, pulseaudio fails to start although the target directory's permissions are correct
# ls -ld .pulse ../mario-sync/.pulse/
lrwxrwxrwx 1 mario mario 20 2008-10-10 16:53 .pulse -> ../mario-sync/.pulse
drwx------ 2 mario mario 4096 2008-10-10 16:53 /home/mario-sync/.pulse
the problem lies in pulsecore/core-util.c, function pa_make_secure_dir line 206 and following:
#ifdef HAVE_LSTAT
if (lstat(dir, &st) < 0)
#else
if (stat(dir, &st) < 0)
#endif
goto fail;
Since we are compiling for linux, 'lstat' is available. But pulseaudio should have used 'stat' instead, because in contrast to 'stat', 'lstat' returns the symlink's permissions (lrwxrwxrwx), not those of the target directory (drwx------).
This is no duplicate and no race condition, at all. In addition to points 1-2 by Josh Smith, I'd like to add:
3) if ~/.pulse is a symlink, pulseaudio fails to start although the target directory's permissions are correct
# ls -ld .pulse ../mario- sync/.pulse/ sync/.pulse sync/.pulse
lrwxrwxrwx 1 mario mario 20 2008-10-10 16:53 .pulse -> ../mario-
drwx------ 2 mario mario 4096 2008-10-10 16:53 /home/mario-
the problem lies in pulsecore/ core-util. c, function pa_make_secure_dir line 206 and following:
#ifdef HAVE_LSTAT
if (lstat(dir, &st) < 0)
#else
if (stat(dir, &st) < 0)
#endif
goto fail;
#ifndef OS_IS_WIN32 st.st_mode) ||
((st.st_ mode & 0777) != m)) { log_warn( "Secure directory creation not supported on Win32.");
if (!S_ISDIR(
(st.st_uid != uid) ||
(st.st_gid != gid) ||
errno = EACCES;
goto fail;
}
#else
pa_
#endif
Since we are compiling for linux, 'lstat' is available. But pulseaudio should have used 'stat' instead, because in contrast to 'stat', 'lstat' returns the symlink's permissions (lrwxrwxrwx), not those of the target directory (drwx------).