Skip to content
This repository was archived by the owner on Oct 25, 2025. It is now read-only.

Conversation

@martinetd
Copy link
Contributor

@martinetd martinetd commented Sep 16, 2025

If the service uses the default /var/cache/inadyn directory, then that
directory will have been created and there is no problem, but if using
an alternate directory with --cache-dir is used then it must also be
passed to any --check-config invocation as well lest this error message
is printed:

Cannot create fallback cache dir: No such file or directory

However, there already is another message that is only printed on
service start and not on check-conf:

inadyn[1902671]: No write permission to /var/cache/inadyn: Permission denied
inadyn[1902671]: Cannot guarantee DDNS server won't lock you out for excessive updates.

So just remove the 'Cannot create fallback' message.


This is a follow-up on #522 -- sorry for bugging you on a closed PR there!
You've suggested adding an extra fallback to /tmp, and I first did that, but when writing the commit message at this point I think we're better off without the extra fallback:

  • I think there's already too many fallbacks; it's a matter of like but I prefer things to fail hard than to try too hard in non-optimal situation
  • the cache dir is meant to avoid spamming upstream services on restart but /tmp will likely be gone after reboot, so it'd just give a false impression of working (although it'll still work for service restarts, so I guess it's better than nothing?)
  • since the cache dir being missing isn't a fatal error, I think it's better to have inadyn print many warnings everytime the cache dir is used than fallback and mask the error behind a single warning.. Although at this point I guess it's up to the user to fix their setup anyway.

If you think a fallback is better I have a commit here[1] that just needs message fixing a bit, so just tell me and I'll swap it in this PR.
[1] martinetd@06d61f1

Thanks,

@troglobit
Copy link
Owner

You make a good point, and I agree, there are too many fallbacks. So this approach is sane, but I'd like one-up you and go even further. How about this?

    home = getenv("HOME");
    if (!home) {
        logit(LOG_ERR, "%s: not writable, $HOME missing, please use --cache-dir=PATH", cache_dir);
        free(cache_dir);
        return 1;        <-- Fail in DO() so we force exit.
    }

Improve the message and fail hard if the default cache dir was not
writeable and $HOME is not set... Unless we're running for
--check-config (or --help) in which case the default directory is
considered.
@martinetd
Copy link
Contributor Author

I can only approve of this :)

This still has to be conditional on dryrun so --check-config doesn't fail (unless you think --check-config needs to pass --cache-dir as well), I've updated accordingly with a comment saying why we skip this for check-config.

Tested with env -i inadyn -n (or without the -n, this fails before forking)

@troglobit
Copy link
Owner

lgtm, nice work on this, and thank you for being patient! 😎

@troglobit troglobit merged commit 2a99888 into troglobit:master Sep 16, 2025
4 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants