X-Git-Url: https://git.proxmox.com/?p=ifupdown2.git;a=blobdiff_plain;f=debian%2Fpatches%2Fupstream%2F0001-scheduler-avoid-waiting-for-stdout-eof-of-etc-networ.patch;fp=debian%2Fpatches%2Fupstream%2F0001-scheduler-avoid-waiting-for-stdout-eof-of-etc-networ.patch;h=e377e5621c82d819be0dd3b5eae330f95c61673d;hp=0000000000000000000000000000000000000000;hb=1997a5a6d7237815d902611b0f22010f6d133562;hpb=e6835fd11d94148db9d6fc93a19e6bdb45915e29 diff --git a/debian/patches/upstream/0001-scheduler-avoid-waiting-for-stdout-eof-of-etc-networ.patch b/debian/patches/upstream/0001-scheduler-avoid-waiting-for-stdout-eof-of-etc-networ.patch new file mode 100644 index 0000000..e377e56 --- /dev/null +++ b/debian/patches/upstream/0001-scheduler-avoid-waiting-for-stdout-eof-of-etc-networ.patch @@ -0,0 +1,44 @@ +From 1303d9211d82326f7c55d56db13eed66bb1c6535 Mon Sep 17 00:00:00 2001 +From: Friedrich Weber +Date: Tue, 26 Sep 2023 13:33:36 +0200 +Subject: [PATCH] scheduler: avoid waiting for stdout eof of /etc/network/ + scripts + +Scripts in /etc/network/ are executed using `exec_command` which +captures stdout by default, and thus waits for stdout end-of-file via +`Popen.communicate()`. However, this can cause hangs if the network +script executes a long-running command in the background. Can be +reproduced by putting the following (executable) script in +/etc/network/if-up.d/: + + #!/bin/sh + sleep 5& + +This script will cause `ifreload -a` to wait for 5 seconds per network +interface. + +To avoid waiting, do not capture stdout when executing /etc/network/ +scripts. This also improves compatibility with ifupdown, which runs +the above script in the background. + +Signed-off-by: Friedrich Weber +--- + ifupdown2/ifupdown/scheduler.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ifupdown2/ifupdown/scheduler.py b/ifupdown2/ifupdown/scheduler.py +index fda6ff2..e4d579f 100644 +--- a/ifupdown2/ifupdown/scheduler.py ++++ b/ifupdown2/ifupdown/scheduler.py +@@ -142,7 +142,7 @@ class ifaceScheduler(): + for mname in ifupdownobj.script_ops.get(op, []): + ifupdownobj.logger.debug("%s: %s : running script %s" % (ifacename, op, mname)) + try: +- utils.exec_command(mname, env=command_env) ++ utils.exec_command(mname, env=command_env, stdout=False) + except Exception as e: + if "permission denied" in str(e).lower(): + ifupdownobj.logger.warning('%s: %s %s' % (ifacename, op, str(e))) +-- +2.39.2 +