The patch I included in comment 2 is wrong, my bad. I probably got mixed up when I tested it yesterday.
Running xdg-user-dirs-update after setting HOME to the test environment /tmp/dd-<temp> does not create XDG Special User Directories in this directory as I thought it did, because xdg-user-dirs-update gets the user's home directory from HOME only if it cannot get it from /etc/passwd (see function get_home_dir in its source code, file xdg-user-dirs-update.c).
It does create a file user-dirs.dirs in the new XDG_CONFIG_HOME though, since there isn't any. But since the paths defined in this file are relative to $HOME, and that no XDG Special User Directories were created in the new HOME, the paths point to non-existent directories.
So we have to do everything by hand instead of using xdg-user-dirs-update. I attach here a new, hopefully correct version of the patch I suggested in comment 2 to fix bugs 1660174 1660224 1660342. I have also changed the bug's description, section [Fix].
The patch I included in comment 2 is wrong, my bad. I probably got mixed up when I tested it yesterday.
Running xdg-user- dirs-update after setting HOME to the test environment /tmp/dd-<temp> does not create XDG Special User Directories in this directory as I thought it did, because xdg-user- dirs-update gets the user's home directory from HOME only if it cannot get it from /etc/passwd (see function get_home_dir in its source code, file xdg-user- dirs-update. c).
It does create a file user-dirs.dirs in the new XDG_CONFIG_HOME though, since there isn't any. But since the paths defined in this file are relative to $HOME, and that no XDG Special User Directories were created in the new HOME, the paths point to non-existent directories.
So we have to do everything by hand instead of using xdg-user- dirs-update. I attach here a new, hopefully correct version of the patch I suggested in comment 2 to fix bugs 1660174 1660224 1660342. I have also changed the bug's description, section [Fix].