# HG changeset patch # User Matthias Förste # Date 1524735996 -7200 # Node ID d08f47fd8542b377331f63764b4022dc226304a6 # Parent 8215da26b2fe32f934a155ecd05636c5a10a2637# Parent 21cf0d0ca51bead3d8af2aade92ac8b13509c7ca [merged] diff -r 8215da26b2fe -r d08f47fd8542 .hgignore --- a/.hgignore Thu Apr 26 11:45:09 2018 +0200 +++ b/.hgignore Thu Apr 26 11:46:36 2018 +0200 @@ -3,3 +3,4 @@ init.d tele-watch tele-watch.8.gz +*.deb diff -r 8215da26b2fe -r d08f47fd8542 TODO --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TODO Thu Apr 26 11:46:36 2018 +0200 @@ -0,0 +1,4 @@ +* detect (u)mounts over watchpoints because tele-watch will probably still + watch the 'old' filesystem (in case something is mounted over the filesystem + containing the watchpoint) or none at all (in case the filesystem is + umounted) diff -r 8215da26b2fe -r d08f47fd8542 tele-watch.pl --- a/tele-watch.pl Thu Apr 26 11:45:09 2018 +0200 +++ b/tele-watch.pl Thu Apr 26 11:46:36 2018 +0200 @@ -57,6 +57,8 @@ my ($uid, $gid, $mode) = (stat $dir)[4, 5, 2]; defined(my $pid = fork()) or die "Can't fork: $!\n"; if ($pid == 0) { + # avoid execution of END{ } blocks + $clean_pids{$$} = 1; chdir $dir or die "Can't chdir to $dir: $!\n"; for ('public') { mkdir $_; @@ -68,7 +70,6 @@ chown($uid, $gid, $_); chmod($mode & 07777, $_); }, ".bzr"); - exec "true"; # avoid execution of END{ } blocks } wait; }, @@ -90,7 +91,13 @@ }, ); +my %clean_pids; + MAIN: { + + # avoid execution of END{ } blocks + $clean_pids{$$} = 1; + my @_ARGV = @ARGV; my %TARGET; @@ -150,6 +157,9 @@ # cleanup code END { + + return if delete $clean_pids{$$}; + foreach (keys %TARGET) { if (readf("$_/.watched") || 0 == $$) { unlink "$_/.watched"; @@ -185,9 +195,8 @@ open(STDOUT, ">/dev/null") or die "Can't redir STDOUT: $!\n"; defined(my $pid = fork()) or die "Can't fork: $!\n"; if ($pid) { - %TARGET = (); notice "child is $pid"; - $opt_pidfile = ""; + # detect (u)mounts over watchpoints/targets exit 0; } setsid(); diff -r 8215da26b2fe -r d08f47fd8542 tools/deb-deps --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/deb-deps Thu Apr 26 11:46:36 2018 +0200 @@ -0,0 +1,10 @@ +#!/usr/bin/equivs-build +Section: misc +Priority: optional +Standards-Version: 3.9.2 + +Package: tele-watch-deps +# Version: +# Maintainer: Your Name +Depends: liblinux-inotify2-perl, libunix-syslog-perl +Description: tele watch dependencies