Package: pssh
Version: 2.3.1-4
Severity: normal

Dear Maintainer,

Running parallel-ssh with the -o option results in RuntimeWarnings
resulting from incorrect use of the buffering option (buffering=1).

casey@host:~$ parallel-ssh -o outdir -h hosts date
/usr/lib/python3/dist-packages/psshlib/manager.py:304: RuntimeWarning: line 
buffering (buffering=1) isn't supported in binary mode, the default buffer size 
will be used
  self.files[filename] = open(filename, 'wb', buffering=1)
/usr/lib/python3/dist-packages/psshlib/manager.py:304: RuntimeWarning: line 
buffering (buffering=1) isn't supported in binary mode, the default buffer size 
will be used
  self.files[filename] = open(filename, 'wb', buffering=1)
[1] 08:55:00 [SUCCESS] host1
[2] 08:55:00 [SUCCESS] host1

According to the python documentation for open():

    buffering is an optional integer used to set the buffering policy.
    Pass 0 to switch buffering off (only allowed in binary mode), 1 to select
    line buffering (only usable in text mode), and an integer > 1 to indicate
    the size of a fixed-size chunk buffer.  When no buffering argument is
    given, the default buffering policy works as follows:

An "upstream" version of has the following fix:

https://github.com/lilydjwg/pssh/commit/5e544a7444aa7a337f64c91d34cf669bef46c1d7

which is equivalent to this in the stable debian package of pssh:

--- /usr/lib/python3/dist-packages/psshlib/manager.py.old       2021-02-22 
16:02:07.000000000 -0700
+++ /usr/lib/python3/dist-packages/psshlib/manager.py.new       2021-08-19 
09:17:14.226959140 -0600
@@ -301,7 +301,7 @@
                 return

             if data == self.OPEN:
-                self.files[filename] = open(filename, 'wb', buffering=1)
+                self.files[filename] = open(filename, 'wb', buffering=0)
                 psshutil.set_cloexec(self.files[filename])
             else:
                 dest = self.files[filename]
@@ -309,6 +309,7 @@
                     dest.close()
                 else:
                     dest.write(data)
+                    dest.flush()

     def open_files(self, host):
         """Called from another thread to create files for stdout and stderr.

That works just fine on my system.


-- System Information:
Debian Release: 11.0
  APT prefers stable-security
  APT policy: (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-8-amd64 (SMP w/8 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages pssh depends on:
ii  openssh-client  1:8.4p1-5
ii  python3         3.9.2-3

pssh recommends no packages.

pssh suggests no packages.

-- no debconf information

Reply via email to