la1k / flyby

A satellite tracking program
GNU General Public License v2.0
39 stars 8 forks source link

Missing ~/.config directory leads to segmentation fault #73

Closed bostrt closed 7 years ago

bostrt commented 7 years ago

I'm running flyby on a minimal raspberry pi installation. The pi user does not have the home user's xdg paths (like .config/) setup and entering the initial QTH information into flyby results in a segfault b/c fd == 0x0 here: https://github.com/la1k/flyby/blob/master/src/qth_config.c#L60-L62

bostrt commented 7 years ago

Running xdg-user-dirs-update automatically creates the required .config/ directory and flyby works fine.

bjorgan commented 7 years ago

Thanks for the issue! And also thanks for tracking the source of the error and submitting a PR. It'll solve the error when XDG_CONFIG_HOME and XDG_DATA_HOME are empty or set to the assumed defaults, which accounts for most of the cases. I've merged the PR.

However, the same problem could be triggered if they are set to anything else (e.g. export XDG_CONFIG_HOME=/tmp/unlikely/chain/of/directories, or set HOME to something arbitrary). I'll keep this issue open until I've dealt with that. Might just end up exiting with error in order to avoid having to drag in a full recursive version of mkdir. It does in any case make sense to explicitly create the defaults if required.

bjorgan commented 7 years ago

Ended up creating all missing directories along the path, fixed in 8572b25f4ba34b8f749ba0beb23ec518dc936547.