If XDG_RUNTIME_DIR is set (ex. "/tmp/xdg-$USER"), but the directory is not present, most tests from "make check" fail. This happens, if one tries to build wayland and run the tests on a freshly rebooted system. Creating the directory manually enables the tests to complete.
Hi, that would be a bug in your system setup, not wayland. It's really the same thing as setting a garbage value to XDG_RUNTIME_DIR, wayland cannot fix that or the (non-existent) directory it might point to. You can see the requirements for this variable here: https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html As you can see from the requirements, it's a distribution/administrator level task to set it up properly. Arbitrary user software cannot do it.
Thank you for your swift reply. What you assume to be a bug of my system is not a bug. It is simply an incomplete system. While it is prepared for building Xorg to completion, this has not been done yet. I completely understand that this might sound obscure, but as wayland does not set up this directory structure and also does not require it to be built and installed correctly. The assumption that the variable is correctly set was in my case not actually helpful. It might be the result of either an incomplete, or a bugged system, but in any case, it makes the tests fail. I wanted to alert you guys about this. To show how this is confusing output to someone trying to compile the software: When the case I described happens, running the tests as the regular user fails. If the tests are run as a privileged user they also fail. If one however runs it as a sudo user, with linux-pam, sudo does not provide the XDG_RUNTIME_DIR variable to the tests at all. Much confusingly the tests complete perfectly. I hope that the example illustrates that there is room for improvement here. In the best case, as a user of your software I would prefer not to run into this again. Thank you for your time and efforts.
Ah, so that's the issue, I did not expect the tests to succeed if XDG_RUNTIME_DIR is not set. test-runner.c:set_xdg_runtime_dir() needs to manufacture a different XDG_RUNTIME_DIR for each invocation to avoid parallel running tests clashing with each other. It does use the existing value of XDG_RUNTIME_DIR as base when set, but it also has a fallback to /tmp otherwise. Maybe that fallback should be removed to maintain consistency. Reopening to see if there are opinions for fixing this.
As I see it there are 3 cases possible: 1) XDG_RUNTIME_DIR is not set 2) XDG_RUNTIME_DIR is set and directory exists 3) XDG_RUNTIME_DIR is set and direcotry does not exist 1) and 2) are currently covered as I see it. I do not believe that 1) should be removed, since it is a state that one is also called on to consider. For this see the link you provided, or the part I copied as a quote (QUOTE_1) down below. I possibly could be enhanced, since XDG_RUNTIME_DIR should be set by the system by my reading of the specs and should not be left unset. 3) is the problem I ran into. It also is referenced as a possibility in the specs (QUOTE_2). The solution I see, would be, to simply create the folder with correct permissions in case it is missing. In my case, doing this manually also fixed the problem of the tests failing. Regardless, the assumption of the folder just being present can imo due to the amount of possible configurations not be made. Again, thank you for your swiftness and your time in taking this up. QUOTE_1: "If $XDG_RUNTIME_DIR is not set applications should fall back to a replacement directory with similar capabilities and print a warning message. Applications should use this directory for communication and synchronization purposes and should not place larger files in it, since it might reside in runtime memory and cannot necessarily be swapped out to disk." QUOTE_2: "If, when attempting to write a file, the destination directory is non-existant an attempt should be made to create it with permission 0700. If the destination directory exists already the permissions should not be changed. The application should be prepared to handle the case where the file could not be written, either because the directory was non-existant and could not be created, or for any other reason. In such case it may chose to present an error message to the user."
(In reply to Pekka Paalanen from comment #3) > test-runner.c:set_xdg_runtime_dir() needs to manufacture a different > XDG_RUNTIME_DIR for each invocation to avoid parallel running tests clashing > with each other. It does use the existing value of XDG_RUNTIME_DIR as base > when set, but it also has a fallback to /tmp otherwise. > > Maybe that fallback should be removed to maintain consistency. Reopening to > see if there are opinions for fixing this. Yeah, I think the most sensible thing would be to always create it under the build directory.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/wayland/wayland/issues/19.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.