troglobit / finit

Fast init for Linux. Cookies included
https://troglobit.com/projects/finit/
MIT License
622 stars 61 forks source link

Finit ignores deleted/moved .conf files in /etc/finit.d #340

Closed troglobit closed 1 year ago

troglobit commented 1 year ago

@JackNewman12 reports, in #337:

I also noticed that conf.c do_change() seems to ignore deleted files. Commenting out this checks causes a deleted or moved .conf to correctly remove a service. Not sure why this check is here so I'm afraid I might be missing some edge-cases.

 static int do_change(char *dir, char *name, uint32_t mask) 
 { 
  char fn[strlen(dir) + strlen(name) + 2]; 
  struct conf_change *node; 

  paste(fn, sizeof(fn), dir, name); 
  dbg("path: %s mask: %08x", fn, mask); 

  node = conf_find(fn); 
-     if (mask & (IN_DELETE | IN_MOVED_FROM)) { 
-         drop_change(node); 
-         return 0; 
-     }
  if (node) {
      dbg("Event already registered for %s ...", name);
      return 0;
  }
troglobit commented 1 year ago

Cannot for the life of me figure out why this was ever needed. I've tested both with and without this patch, and on my system Finit works, but I'm adopting the patch as-is anyway because there's not comment/motivation to keep the code.