Hello community,

here is the log from the commit of package targetcli-fb for openSUSE:Factory 
checked in at 2020-05-26 17:19:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/targetcli-fb (Old)
 and      /work/SRC/openSUSE:Factory/.targetcli-fb.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "targetcli-fb"

Tue May 26 17:19:09 2020 rev:18 rq:808062 version:2.1.52

Changes:
--------
--- /work/SRC/openSUSE:Factory/targetcli-fb/targetcli-fb.changes        
2020-02-19 12:41:23.783723502 +0100
+++ /work/SRC/openSUSE:Factory/.targetcli-fb.new.2738/targetcli-fb.changes      
2020-05-26 17:19:19.911976292 +0200
@@ -1,0 +2,18 @@
+Thu May 21 17:38:48 UTC 2020 - ldun...@suse.com
+
+- Update to version 2.1.52:
+  * version 2.1.52
+  * daemon-interactive: do not allow clearing the prompt
+  * daemon-interactive: show path on prompt
+  * daemonized-mode: add interactive shell support
+  * Use temp file objects for temporary storage area
+  * Fix StringIO/BytesIO stuck issue
+  * Fix targetclid daemon infinite stuck
+  * targetclid.sock: change SocketMode to 0600
+    (bsc#1168415 CVE-2020-10699)
+  * setup.py: add the socket and service files to the data_files section
+  * Use StringIO as a buffer instead of a file
+  Also, add a patch to move systemd unit files to /usr/lib/systemd/system:
+  * fix-setup-install.patch
+
+-------------------------------------------------------------------

Old:
----
  targetcli-fb-2.1.51.tar.xz
  targetclid.service
  targetclid.socket

New:
----
  fix-setup-install.patch
  targetcli-fb-2.1.52.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ targetcli-fb.spec ++++++
--- /var/tmp/diff_new_pack.qoX1GW/_old  2020-05-26 17:19:21.031978700 +0200
+++ /var/tmp/diff_new_pack.qoX1GW/_new  2020-05-26 17:19:21.035978708 +0200
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           targetcli-fb
-Version:        2.1.51
+Version:        2.1.52
 Release:        0
 Summary:        A command shell for managing the Linux LIO kernel target
 License:        Apache-2.0
@@ -26,8 +26,6 @@
 URL:            https://github.com/open-iscsi/%{name}
 Source:         %{name}-%{version}.tar.xz
 Source1:        %{name}.service
-Source2:        targetclid.socket
-Source3:        targetclid.service
 BuildRequires:  %{python_module configshell-fb}
 BuildRequires:  %{python_module devel}
 BuildRequires:  %{python_module pyparsing}
@@ -58,6 +56,7 @@
 %{?systemd_ordering}
 Patch1:         Split-out-blockdev-readonly-state-detection-helper.patch
 Patch2:         rbd-support.patch
+Patch3:         fix-setup-install.patch
 
 %python_subpackages
 
@@ -87,6 +86,7 @@
 # RBD support is dependent on LIO changes present in the SLE/Leap kernel
 %patch2 -p1
 %endif
+%patch3 -p1
 
 %build
 %python_build
@@ -101,8 +101,6 @@
 install -D -m644 targetcli.8 %{buildroot}%{_mandir}/man8/targetcli.8
 install -D -m644 targetclid.8 %{buildroot}%{_mandir}/man8/targetclid.8
 install -D -m644 %{S:1} %{buildroot}%{_unitdir}/targetcli.service
-install -D -m644 %{S:2} %{buildroot}%{_unitdir}/targetclid.socket
-install -D -m644 %{S:3} %{buildroot}%{_unitdir}/targetclid.service
 %fdupes %{buildroot}
 ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rctargetcli
 ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rctargetclid

++++++ _service ++++++
--- /var/tmp/diff_new_pack.qoX1GW/_old  2020-05-26 17:19:21.067978777 +0200
+++ /var/tmp/diff_new_pack.qoX1GW/_new  2020-05-26 17:19:21.071978786 +0200
@@ -7,7 +7,7 @@
     <param name="versionformat">@PARENT_TAG@</param>
     <param name="versionrewrite-pattern">v(\d*\.\d*\.)(\d*)</param>
     <param name="versionrewrite-replacement">\1\2</param>
-    <param name="revision">v2.1.51</param>
+    <param name="revision">v2.1.52</param>
     <param name="changesgenerate">enable</param>
   </service>
   <service name="recompress" mode="disabled">

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.qoX1GW/_old  2020-05-26 17:19:21.087978820 +0200
+++ /var/tmp/diff_new_pack.qoX1GW/_new  2020-05-26 17:19:21.087978820 +0200
@@ -1,4 +1,4 @@
 <servicedata>
 <service name="tar_scm">
                 <param 
name="url">https://github.com/open-iscsi/targetcli-fb.git</param>
-              <param 
name="changesrevision">06076aba7e9e9bd4a1e84bac61e85265e8075b8e</param></service></servicedata>
\ No newline at end of file
+              <param 
name="changesrevision">bab9fc16236c4aceade31e95327bc7b493bb157a</param></service></servicedata>
\ No newline at end of file

++++++ fix-setup-install.patch ++++++
From: Lee Duncan <ldun...@suse.com>
Date: Thu May 21 11:32:02 PDT 2020
Subject: [PATCH] fix setup install patch

Fix the setup.py install script to install systemd
files in /usr/lib/systemd/system instead of /lib/systemd/system
---
diff --git a/setup.py b/setup.py
index 4518165c57a6..2ebfc04605c0 100755
--- a/setup.py
+++ b/setup.py
@@ -34,7 +34,7 @@ setup(
                'scripts/targetcli',
                'daemon/targetclid'
               ],
-    data_files = [('/lib/systemd/system', ['systemd/targetclid.socket', 
'systemd/targetclid.service'])],
+    data_files = [('/usr/lib/systemd/system', ['systemd/targetclid.socket', 
'systemd/targetclid.service'])],
     classifiers = [
         "Programming Language :: Python",
         "Programming Language :: Python :: 3",
++++++ targetcli-fb-2.1.51.tar.xz -> targetcli-fb-2.1.52.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/targetcli-fb-2.1.51/daemon/targetclid 
new/targetcli-fb-2.1.52/daemon/targetclid
--- old/targetcli-fb-2.1.51/daemon/targetclid   2019-11-06 13:31:26.000000000 
+0100
+++ new/targetcli-fb-2.1.52/daemon/targetclid   2020-05-11 13:14:43.000000000 
+0200
@@ -26,12 +26,14 @@
 from os import getuid, getenv, unlink
 from threading import Thread
 
+import os
 import sys
 import socket
 import struct
 import fcntl
 import signal
 import errno
+import tempfile
 
 
 err = sys.stderr
@@ -153,7 +155,7 @@
                 connection.close()
                 still_listen = False
             else:
-                self.con._stdout = self.con._stderr = f = 
open("/tmp/data.txt", "w")
+                self.con._stdout = self.con._stderr = f = 
tempfile.NamedTemporaryFile(mode='w', delete=False)
                 try:
                     # extract multiple commands delimited with '%'
                     list_data = data.decode().split('%')
@@ -167,13 +169,15 @@
                 self.con._stderr = self.con_stderr_
                 f.close()
 
-                with open('/tmp/data.txt', 'r') as f:
+                with open(f.name, 'r') as f:
                     output = f.read()
                     var = struct.pack('i', len(output))
                     connection.sendall(var) # length of string
                     if len(output):
                         connection.sendall(output.encode()) # actual string
 
+                os.unlink(f.name)
+
 
 def usage():
     print("Usage: %s [--version|--help]" % sys.argv[0], file=err)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/targetcli-fb-2.1.51/scripts/targetcli 
new/targetcli-fb-2.1.52/scripts/targetcli
--- old/targetcli-fb-2.1.51/scripts/targetcli   2019-11-06 13:31:26.000000000 
+0100
+++ new/targetcli-fb-2.1.52/scripts/targetcli   2020-05-11 13:14:43.000000000 
+0200
@@ -64,6 +64,7 @@
                      'max_backup_files': '10',
                      'auto_add_default_portal': True,
                      'auto_use_daemon': False,
+                     'daemon_use_batch_mode': False,
                     }
 
 def usage():
@@ -121,7 +122,7 @@
     except IndexError:
         return None
 
-def call_daemon(shell, req):
+def call_daemon(shell, req, interactive):
     try:
         sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
     except socket.error as err:
@@ -139,9 +140,23 @@
                 "then run '#targetcli --disable-daemon'", 'red'))
         sys.exit(1)
 
+    # Two cases where we want to get pwd:
+    # 1. Before starting shell in interactive mode, needed for setting terminal
+    # 2. And only in Interactive mode, having command 'cd'
+    get_pwd = False
+    if interactive:
+        if not req:
+            req = "pwd"
+            get_pwd = True
+        elif "cd " in req:
+            req += "%pwd"
+            get_pwd = True
+    else:
+        req = "cd /%" + req # Non-interactive modes always consider start at 
'/'
+
     try:
         # send request
-        sock.sendall(req)
+        sock.sendall(req.encode())
     except socket.error as err:
         shell.con.display(shell.con.render_text(err, 'red'))
         sys.exit(1)
@@ -152,16 +167,31 @@
     amount_received = 0
 
     # get the actual data in chunks
+    output = ""
+    path = ""
     while amount_received < amount_expected:
         data = sock.recv(1024)
+        data = data.decode()
         amount_received += len(data)
-        print(data.decode(), end ="")
+        output += data
+
+    if get_pwd:
+        output_split = output.splitlines()
+        lines = len(output_split)
+        for i in range(0, lines):
+            if i == lines-1:
+                path = str(output_split[i])
+            else:
+                print(str(output_split[i]), end ="\n")
+    else:
+        print(output, end ="")
 
     sock.send(b'-END@OF@DATA-')
     sock.close()
-    sys.exit(0)
 
-def get_arguments(shell):
+    return path
+
+def switch_to_daemon(shell, interactive):
     readline.set_completer(completer)
     readline.set_completer_delims('')
 
@@ -172,27 +202,50 @@
 
     if len(sys.argv) > 1:
         command = " ".join(sys.argv[1:])
+        call_daemon(shell, command, False)
+        sys.exit(0)
+
+    if interactive:
+        shell.con.display("targetcli shell version %s\n"
+                          "Entering targetcli interactive mode for daemonized 
approach.\n"
+                          "Type 'exit' to quit.\n"
+                          % targetcli_version)
     else:
-        inputs = []
         shell.con.display("targetcli shell version %s\n"
-                        "Entering targetcli batch mode for daemonized 
approach.\n"
-                        "Enter multiple commands separated by newline and "
-                        "type 'exit' to run them all in one go.\n"
-                        % targetcli_version)
-        while True:
-            shell.con.raw_write("/> ")
-            command = six.moves.input()
-            if command.lower() == "exit":
-                break
+                          "Entering targetcli batch mode for daemonized 
approach.\n"
+                          "Enter multiple commands separated by newline and "
+                          "type 'exit' to run them all in one go.\n"
+                          % targetcli_version)
+
+    prompt_path = "/"
+    if interactive:
+        prompt_path = call_daemon(shell, None, interactive) # get the initial 
path
+
+    inputs = []
+    real_exit=False
+    while True:
+        command = six.moves.input("%s> " %prompt_path)
+        if command.lower() == "exit":
+            real_exit=True
+        elif not command:
+            continue
+        if not interactive:
             inputs.append(command)
-        command = '%'.join(inputs)  # delimit multiple commands with '%'
-
-    if not command:
-        sys.exit(1)
-
-    usage_version(command);
+            if real_exit:
+                command = '%'.join(inputs)  # delimit multiple commands with 
'%'
+                call_daemon(shell, command, interactive)
+                break
+        else:
+            if real_exit:
+                break
+            path = call_daemon(shell, command, interactive)
+            if path:
+                if path[0] == "/":
+                    prompt_path = path
+                else:
+                    print(path)  # Error No Path ...
 
-    return command
+    sys.exit(0)
 
 def main():
     '''
@@ -224,8 +277,12 @@
         if sys.argv[1] in ("disable-daemon", "--disable-daemon"):
             disable_daemon=True
 
+    interactive_mode = True
+    if shell.prefs['daemon_use_batch_mode']:
+        interactive_mode = False
+
     if use_daemon and not disable_daemon:
-        call_daemon(shell, get_arguments(shell).encode())
+        switch_to_daemon(shell, interactive_mode)
         # does not return
 
     try:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/targetcli-fb-2.1.51/setup.py 
new/targetcli-fb-2.1.52/setup.py
--- old/targetcli-fb-2.1.51/setup.py    2019-11-06 13:31:26.000000000 +0100
+++ new/targetcli-fb-2.1.52/setup.py    2020-05-11 13:14:43.000000000 +0200
@@ -34,6 +34,7 @@
                'scripts/targetcli',
                'daemon/targetclid'
               ],
+    data_files = [('/lib/systemd/system', ['systemd/targetclid.socket', 
'systemd/targetclid.service'])],
     classifiers = [
         "Programming Language :: Python",
         "Programming Language :: Python :: 3",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/targetcli-fb-2.1.51/systemd/targetclid.socket 
new/targetcli-fb-2.1.52/systemd/targetclid.socket
--- old/targetcli-fb-2.1.51/systemd/targetclid.socket   2019-11-06 
13:31:26.000000000 +0100
+++ new/targetcli-fb-2.1.52/systemd/targetclid.socket   2020-05-11 
13:14:43.000000000 +0200
@@ -4,6 +4,7 @@
 
 [Socket]
 ListenStream=/var/run/targetclid.sock
+SocketMode=0600
 
 [Install]
 WantedBy=sockets.target
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/targetcli-fb-2.1.51/targetcli/ui_node.py 
new/targetcli-fb-2.1.52/targetcli/ui_node.py
--- old/targetcli-fb-2.1.51/targetcli/ui_node.py        2019-11-06 
13:31:26.000000000 +0100
+++ new/targetcli-fb-2.1.52/targetcli/ui_node.py        2020-05-11 
13:14:43.000000000 +0200
@@ -52,6 +52,9 @@
         self.define_config_group_param(
             'global', 'auto_use_daemon', 'bool',
             'If true, commands will be sent to targetclid.')
+        self.define_config_group_param(
+            'global', 'daemon_use_batch_mode', 'bool',
+            'If true, use batch mode for daemonized approach.')
 
     def assert_root(self):
         '''
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/targetcli-fb-2.1.51/targetcli/version.py 
new/targetcli-fb-2.1.52/targetcli/version.py
--- old/targetcli-fb-2.1.51/targetcli/version.py        2019-11-06 
13:31:26.000000000 +0100
+++ new/targetcli-fb-2.1.52/targetcli/version.py        2020-05-11 
13:14:43.000000000 +0200
@@ -15,4 +15,4 @@
 under the License.
 '''
 
-__version__ = '2.1.51'
+__version__ = '2.1.52'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/targetcli-fb-2.1.51/targetclid.8 
new/targetcli-fb-2.1.52/targetclid.8
--- old/targetcli-fb-2.1.51/targetclid.8        2019-11-06 13:31:26.000000000 
+0100
+++ new/targetcli-fb-2.1.52/targetclid.8        2020-05-11 13:14:43.000000000 
+0200
@@ -30,11 +30,38 @@
 .br
 $ targetcli ls
 .TP
-You can use batch mode for sending multiple commands in one go,
+You can use interactive mode,
 .br
 $ targetcli <hit-enter>
 .br
-targetcli shell version 2.1.50
+targetcli shell version 2.1.51
+.br
+Entering targetcli interactive mode for daemonized approach.
+.br
+Type 'exit' to quit.
+.br
+/> pwd
+.br
+/
+.br
+/> cd /iscsi
+.br
+/> pwd
+.br
+/iscsi
+.br
+/> exit
+.br
+.TP
+You can also use batch mode for sending multiple commands in one go,
+.br
+$ targetcli set global daemon_use_batch_mode=true
+.br
+Parameter daemon_use_batch_mode is now 'true'.
+.br
+$ targetcli <hit-enter>
+.br
+targetcli shell version 2.1.51
 .br
 Entering targetcli batch mode for daemonized approach.
 .br


Reply via email to