FS#6399 - Fails to download online content when ~/.local/share does not exist

Attached to Project: OpenTTD
Opened by Matthijs Kooijman (matthijs) - Monday, 07 December 2015, 10:56 GMT
Type Bug
Category Core
Status Not confirmed
Assigned To No-one
Operating System Linux
Severity Low
Priority Normal
Reported Version 1.5.3
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


It seems that when downloading things through the online content user interface, and ~/.local/share does not exist, the download fails with a "file not writable" error.

strace shows that it tries to open up the final filename right away, which obviously fails:

open("/root/.local/share/openttd/content_download/baseset/OpenSFX-0.2.3.tar.gz", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ENOENT (No such file or directory)

No mkdir calls happen at all (not even inside ~/.local/share, interestingly). When ~/.local/share *does* exist, mkdir calls do happen, but only inside ~/local.share. In this case, there is also a failed mkdir for ~/.config/openttd, so there is presumably also a problem for a non-existing ~/.config directory.

This problem was observed on version 1.5.3 and 1.4.4, on a Debian Sid and Jessie system respectively.

In addition, the automatic OpenGFX download (when no gfx are available) fails when ~/.local/share does not exist, though an additional problem is that no error (just a download dialog that gets shown for a fraction of a second, then disappears leaving an empty window).
This task depends upon