Comments (9)
This change caused a regression in Finit:
From commit 414a49d:
When the inotify callback is called for a file that has been removed,
the call torealpath()
obviously fails (ENOENT
). This fix only takes
the regular case into account, files removed from a symlinked enabled
directory is not handled -- needs more work for that.
As it says, I've not made any attempts at fixing the code for your use-case, @JackNewman12, but I thought it worth mentioning here as a heads-up for you.
from finit.
Yup, correct.
I fail to recall why it looks like it does rn ... does it work better if you drop the IN_DONT_FOLLOW
?
from finit.
I fiddled around with the flags for a bit but couldn't get it working. I
I think the issue is the symlink destination doesn't exist that early in the boot so the inotify probably fails. (At least trying to do an inotifyd command on a bad symlink seems to fail).
I think perhaps I might need to have an event on the symlink update to add an additional watch.
'IN_DONT_FOLLOW' should be correct I believe.
from finit.
Yeah. If I hack in a mkdir
very early on so that the symlink is valid then it seems to work.
from finit.
Aha, of course! Yeah, that's a bit tricky, but you have the early hook points perhaps?
from finit.
I was thinking about that just before I left work but in my (very brief) look it wasn't obvious to me when finit has setup those conf watches vs the hooks.
I think the script would have to be part of HOOK_MOUNT_POST, but according to the bootstrap finit has already loaded all the *.conf files.
Edit: Actually a few more seconds of looking and it seems like this should work.
from finit.
Yeah, a hook script on HOOK_BASEFS_UP
should do the trick.
from finit.
Thanks! HOOK_BASEFS_UP
works perfectly.
Although it looks like conf_changed()
converts the path to a realpath before doing a conf_find()
, but do_change()
would end up adding the non-real path to the change list. So touching files would never cause an HUP.
I just quickly added this minimal patch to get it working for me.
diff --git a/src/conf.c b/src/conf.c
--- a/src/conf.c
+++ b/src/conf.c
@@ -1040,30 +1040,40 @@ static void drop_changes(void)
static int do_change(char *dir, char *name, uint32_t mask)
{
char fn[strlen(dir) + strlen(name) + 2];
+ char *rp;
struct conf_change *node;
paste(fn, sizeof(fn), dir, name);
dbg("path: %s mask: %08x", fn, mask);
- node = conf_find(fn);
+ rp = realpath(fn, NULL);
+ if (!rp)
+ return 0;
+
+ node = conf_find(rp);
if (node) {
dbg("Event already registered for %s ...", name);
+ free(rp);
return 0;
}
node = malloc(sizeof(*node));
- if (!node)
+ if (!node) {
+ free(rp);
return 1;
+ }
- node->name = strdup(fn);
+ node->name = strdup(rp);
if (!node->name) {
free(node);
+ free(rp);
return 1;
}
- dbg("Event registered for %s, mask 0x%x", fn, mask);
+ dbg("Event registered for %s, mask 0x%x", rp, mask);
TAILQ_INSERT_HEAD(&conf_change_list, node, link);
+ free(rp);
return 0;
}
from finit.
Nice catch, would you like to make PR for that? Because that patch looks good to go for me :)
from finit.
Related Issues (20)
- service environment variables are not expanded when sourced HOT 2
- task with untriggered condition in runlevel S blocks boot HOT 5
- Does finit start rc.local and gettys too early? HOT 2
- unexpected service restart on initctl reload, notify-related? HOT 4
- dbus and runparts not working
- Finit v4.5 drops all but first word in sourced service environment
- All internal conditions get stuck in flux after initctl reload
- Explicit declaration of PID style readiness notification
- Variables declared with `set NAME=VAL` set in environment with leading `set `
- Build error using clang 17 on musl (call to undeclared function 'basename') HOT 1
- Processes depends on notify:pid did not stop when their parent process was killed HOT 3
- tmpfiles.d feature does not work for statically-linked Finit et al. HOT 2
- dBus server HOT 3
- finit hangs during system shutting down HOT 6
- Spell out unsupported command or change to initctl error string
- Mounting filesystems from /etc/finit "OK" even though mount call fails HOT 3
- sysctl with complex values fails HOT 1
- initctl touch does not respect -n flag
- initctl touch does not support template services
- Possible undefined behavior when --with-fstab=no is set HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from finit.