Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stubby: ensure appdata directory is present on service start #25432

Merged
merged 1 commit into from
Nov 30, 2024

Conversation

totkeks
Copy link
Contributor

@totkeks totkeks commented Nov 22, 2024

Maintainer: unknown
Compile tested: no
Run tested: manually added to the /etc/init.d/stubby on OpenWrt SNAPSHOT r28091-77cfe8fd15

fixes #25431

@hnyman
Copy link
Contributor

hnyman commented Nov 23, 2024

I think that you should set some default there in case the option is not there.
Now you just accept even an empty string as dir and start doing mkdir, chown, whatever...

Some verification of the string , check for not-empty value before doing mkdir ?
And possibly chosen only if mkdir succeeded.

Providing a fall-back default value would also be good.

@totkeks totkeks force-pushed the feature/stubby-appdata-dir branch from 14e14e8 to 44c0ac0 Compare November 23, 2024 15:33
@totkeks
Copy link
Contributor Author

totkeks commented Nov 23, 2024

I think that you should set some default there in case the option is not there. Now you just accept even an empty string as dir and start doing mkdir, chown, whatever...

Some verification of the string , check for not-empty value before doing mkdir ? And possibly chosen only if mkdir succeeded.

Providing a fall-back default value would also be good.

Thanks for the feedback!
I thought about this too, when looking at the init file.

When it builds the config from uci data, it assumes a hardcoded default value:

config_get appdata_dir "global" appdata_dir "/var/lib/stubby"

And I assumed that this would apply to my changes as well. But it doesn't because the default value only applies to the .yml config and not the uci config.

So, I replaced that with a global variable in the script and reused it for my added code block. Also added checks on the string and checked for success of mkdir.

On the other hand, it is very odd that stubby doesn't throw any errors or even warnings when the directory is not available or it has insufficient permissions. But that is an upstream issue and the package hasn't had an update in the last years. I'm surprised no one reported the issue I had before.

@totkeks
Copy link
Contributor Author

totkeks commented Nov 27, 2024

Is there anything else I need to do, before this PR could be approved?

@hnyman hnyman merged commit 55a6cd4 into openwrt:master Nov 30, 2024
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stubby: appdata_dir not created by init script
2 participants