Package: python3-daemon
Version: 2.1.2-2
Severity: important
Tags: upstream patch

Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
   * What was the outcome of this action?
   * What outcome did you expect instead?

*** End of the template - remove these template lines ***

Packaging zfs-snap-manager.  Uses DaemonRunner to fork into background.
Problem with openning stderr in DaemonRunner.__init__ . With Python3
buffering argument to open() should be set to 1 for line buffering.

This class fails to work with Python3, rendering this package mostly
unusable. 


-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.12-amd64-mag (SMP w/8 CPU cores)
Locale: LANG=en_NZ.UTF-8, LC_CTYPE=en_NZ.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_NZ:en (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages python3-daemon depends on:
ii  python3                3.7.1-3
ii  python3-lockfile       1:0.12.2-2
ii  python3-pkg-resources  40.6.2-1

python3-daemon recommends no packages.

python3-daemon suggests no packages.

-- no debconf information
Index: python-daemon-2.1.2/daemon/runner.py
===================================================================
--- python-daemon-2.1.2.orig/daemon/runner.py
+++ python-daemon-2.1.2/daemon/runner.py
@@ -37,6 +37,9 @@ from .daemon import (basestring, unicode
 from .daemon import DaemonContext
 from .daemon import _chain_exception_from_existing_exception_context
 
+# Sort out buffering constant for open()
+BUFFERING = (1 if sys.version_info.major >= 3 else 0)
+
 
 class DaemonRunnerError(Exception):
     """ Abstract base class for errors from DaemonRunner. """
@@ -110,7 +113,7 @@ class DaemonRunner:
         self.daemon_context.stdin = open(app.stdin_path, 'rt')
         self.daemon_context.stdout = open(app.stdout_path, 'w+t')
         self.daemon_context.stderr = open(
-                app.stderr_path, 'w+t', buffering=0)
+                app.stderr_path, 'w+t', buffering=BUFFERING)
 
         self.pidfile = None
         if app.pidfile_path is not None:

Reply via email to