From eb8146e32e788c8087abd4389e78a2becf5db8a03af3a2b79d23ac722fd27e8b Mon Sep 17 00:00:00 2001
From: Adam Majer <amajer@suse.com>
Date: Thu, 1 Aug 2019 13:36:12 +0000
Subject: [PATCH] Accepting request 720147 from
 home:scarabeus_iv:branches:Base:System

- Use python3 instead of python as we do not need to depend on
  python2
- Format with spec-cleaner
- update to 4.8.23:
  * Modify "File exists" query dialog (#3935):
  * Speed up of large directory structures delete (#3958)
  * Support key binding for menu (#212)
  * Syntax updates:
    + shell (#3981)
    + ebuild (#3988)
    + RPM spec (#3991)
  * Code cleanup (#3955)
  * Use Geeqie (a fork of GQview) as main image viewer, fallback to GQview (#3962)
  * various small fixes
- Refresh patches:
  * mc-multi-press-f-keys.patch
  * sftp_interactive_password.patch

OBS-URL: https://build.opensuse.org/request/show/720147
OBS-URL: https://build.opensuse.org/package/show/Base:System/mc?expand=0&rev=126
---
 mc-4.8.22.sha256                |  2 --
 mc-4.8.22.tar.xz                |  3 --
 mc-4.8.23.sha256                |  2 ++
 mc-4.8.23.tar.xz                |  3 ++
 mc-multi-press-f-keys.patch     | 20 ++++++------
 mc.changes                      | 21 +++++++++++++
 mc.spec                         | 54 ++++++++++++++++-----------------
 sftp_interactive_password.patch | 42 +++++++++++++------------
 8 files changed, 85 insertions(+), 62 deletions(-)
 delete mode 100644 mc-4.8.22.sha256
 delete mode 100644 mc-4.8.22.tar.xz
 create mode 100644 mc-4.8.23.sha256
 create mode 100644 mc-4.8.23.tar.xz

diff --git a/mc-4.8.22.sha256 b/mc-4.8.22.sha256
deleted file mode 100644
index 7c24076..0000000
--- a/mc-4.8.22.sha256
+++ /dev/null
@@ -1,2 +0,0 @@
-8d9f1c75369967adfd317a05fef9861444ed049b033e4debaeaafc6df218b431  mc-4.8.22.tar.bz2
-ee7868d7ba0498cf2cccefe107d7efee7f2571098806bba2aed5a159db801318  mc-4.8.22.tar.xz
diff --git a/mc-4.8.22.tar.xz b/mc-4.8.22.tar.xz
deleted file mode 100644
index 9b5d90a..0000000
--- a/mc-4.8.22.tar.xz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:ee7868d7ba0498cf2cccefe107d7efee7f2571098806bba2aed5a159db801318
-size 2538524
diff --git a/mc-4.8.23.sha256 b/mc-4.8.23.sha256
new file mode 100644
index 0000000..67f628d
--- /dev/null
+++ b/mc-4.8.23.sha256
@@ -0,0 +1,2 @@
+238c4552545dcf3065359bd50753abbb150c1b22ec5a36eaa02c82808293267d  mc-4.8.23.tar.bz2
+dd7f7ce74183307b0df25b5c3e60ad3293fd3d3d27d2f37dd7a10efce13dff1c  mc-4.8.23.tar.xz
diff --git a/mc-4.8.23.tar.xz b/mc-4.8.23.tar.xz
new file mode 100644
index 0000000..f38cb7d
--- /dev/null
+++ b/mc-4.8.23.tar.xz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:dd7f7ce74183307b0df25b5c3e60ad3293fd3d3d27d2f37dd7a10efce13dff1c
+size 2552944
diff --git a/mc-multi-press-f-keys.patch b/mc-multi-press-f-keys.patch
index fc79905..cd1cd39 100644
--- a/mc-multi-press-f-keys.patch
+++ b/mc-multi-press-f-keys.patch
@@ -4,11 +4,11 @@ http://www.midnight-commander.org/ticket/287
  lib/tty/tty-slang.h |    1 +
  2 files changed, 16 insertions(+), 2 deletions(-)
 
-Index: mc-4.8.11/lib/tty/key.c
+Index: mc-4.8.23/lib/tty/key.c
 ===================================================================
---- mc-4.8.11.orig/lib/tty/key.c	2014-01-01 19:47:50.000000000 +0000
-+++ mc-4.8.11/lib/tty/key.c	2014-01-01 19:47:50.000000000 +0000
-@@ -1029,10 +1029,13 @@ correct_key_code (int code)
+--- mc-4.8.23.orig/lib/tty/key.c
++++ mc-4.8.23/lib/tty/key.c
+@@ -1050,10 +1050,13 @@ correct_key_code (int code)
          mod = KEY_M_SHIFT;
      }
  
@@ -23,9 +23,9 @@ Index: mc-4.8.11/lib/tty/key.c
      /*
       * We are not interested if Ctrl was pressed when entering control
       * characters, so assume that it was.  When checking for such keys,
-@@ -1118,6 +1121,16 @@ correct_key_code (int code)
+@@ -1126,6 +1129,16 @@ correct_key_code (int code)
+     if (c >= KEY_F (1) && c <= KEY_F (20))
          mod &= ~KEY_M_SHIFT;
-     }
  
 +    /*
 +     * Numerals may require modifilers with some keymaps or on obscure
@@ -40,7 +40,7 @@ Index: mc-4.8.11/lib/tty/key.c
      if (!mc_global.tty.alternate_plus_minus)
          switch (c)
          {
-@@ -1923,7 +1936,7 @@ get_key_code (int no_delay)
+@@ -1909,7 +1922,7 @@ get_key_code (int no_delay)
          {
              /* Convert escape-digits to F-keys */
              if (g_ascii_isdigit (c))
@@ -49,10 +49,10 @@ Index: mc-4.8.11/lib/tty/key.c
              else if (c == ' ')
                  c = ESC_CHAR;
              else
-Index: mc-4.8.11/lib/tty/tty-slang.h
+Index: mc-4.8.23/lib/tty/tty-slang.h
 ===================================================================
---- mc-4.8.11.orig/lib/tty/tty-slang.h	2013-04-10 21:04:31.000000000 +0100
-+++ mc-4.8.11/lib/tty/tty-slang.h	2014-01-01 19:47:50.000000000 +0000
+--- mc-4.8.23.orig/lib/tty/tty-slang.h
++++ mc-4.8.23/lib/tty/tty-slang.h
 @@ -11,6 +11,7 @@
  /*** typedefs(not structures) and defined constants **********************************************/
  
diff --git a/mc.changes b/mc.changes
index ed5f205..611217d 100644
--- a/mc.changes
+++ b/mc.changes
@@ -1,3 +1,24 @@
+-------------------------------------------------------------------
+Thu Aug  1 07:21:35 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
+
+- Use python3 instead of python as we do not need to depend on
+  python2
+- Format with spec-cleaner
+- update to 4.8.23:
+  * Modify "File exists" query dialog (#3935):
+  * Speed up of large directory structures delete (#3958)
+  * Support key binding for menu (#212)
+  * Syntax updates:
+    + shell (#3981)
+    + ebuild (#3988)
+    + RPM spec (#3991)
+  * Code cleanup (#3955)
+  * Use Geeqie (a fork of GQview) as main image viewer, fallback to GQview (#3962)
+  * various small fixes
+- Refresh patches:
+  * mc-multi-press-f-keys.patch
+  * sftp_interactive_password.patch
+
 -------------------------------------------------------------------
 Tue Jan 15 13:37:27 UTC 2019 - adam.majer@suse.de
 
diff --git a/mc.spec b/mc.spec
index 0f8be63..a8a3f64 100644
--- a/mc.spec
+++ b/mc.spec
@@ -12,17 +12,17 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 Name:           mc
+Version:        4.8.23
+Release:        0
 Summary:        Midnight Commander
 License:        GPL-3.0-or-later
 Group:          Productivity/File utilities
-Url:            http://midnight-commander.org/
-Version:        4.8.22
-Release:        0
+URL:            https://midnight-commander.org/
 Source0:        http://ftp.midnight-commander.org/mc-%{version}.tar.xz
 Source1:        x11_browser
 Source2:        %{name}.desktop
@@ -30,26 +30,17 @@ Source3:        %{name}.png
 Source4:        cmake.syntax
 Source6:        http://ftp.midnight-commander.org/%{name}-%{version}.sha256
 Patch0:         mc-fix_lib_search_path.patch
-Patch61:        mc-extd-misc.patch
-Patch62:        mc-extd-video.patch
-Patch63:        mc-extd-doc.patch
-Patch64:        mc-extd-sound.patch
-Patch69:        mc-extd-xdg.patch
-Patch71:        mc-ext-audio.patch
 Patch12:        mc-wrapper.patch
 Patch16:        mc-esc-seq.patch
 Patch17:        mc-rpm.patch
 Patch20:        mc-f-keys.patch
 Patch21:        mc-extfs-helpers-deb.patch
-
 # add patch. bnc#856501
 # http://www.midnight-commander.org/ticket/3128
 Patch22:        mc-vfs-fish-deleted_source_file.patch
-
 # changed mc-extfs-iso9660-xorriso.patch
 # to reflect upstream fix
 Patch23:        mc-extfs-iso9660-xorriso.patch
-
 #Debian fixes
 Patch32:        20_wrong_path_to_wrappers.patch
 # PATCH-FIX-UPSTREAM mc-multi-press-f-keys.patch mc287 sbrabec@suse.cz - Fixed Esc + Numeral F-key emulation.
@@ -59,11 +50,14 @@ Patch41:        mc-multi-press-f-keys.patch
 Patch52:        mc-pie.patch
 # mc-startup-timeout.patch mc3082 nadvornik@suse.cz - fix for long timeout on startup, bnc#824729
 Patch60:        mc-startup-timeout.patch
-
+Patch61:        mc-extd-misc.patch
+Patch62:        mc-extd-video.patch
+Patch63:        mc-extd-doc.patch
+Patch64:        mc-extd-sound.patch
+Patch69:        mc-extd-xdg.patch
+Patch71:        mc-ext-audio.patch
 Patch100:       xls2csv_update.patch
 Patch101:       sftp_interactive_password.patch
-
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  audiofile-devel
 BuildRequires:  e2fsprogs-devel
 BuildRequires:  gettext >= 0.18.1
@@ -79,7 +73,8 @@ BuildRequires:  xorg-x11-devel
 BuildRequires:  xz
 Requires(pre):  permissions
 Recommends:     %{name}-lang = %{version}
-Recommends:     mkisofs xorriso
+Recommends:     mkisofs
+Recommends:     xorriso
 
 %description
 GNU Midnight Commander (also referred to as MC) is a user shell much
@@ -91,10 +86,11 @@ GNU Midnight Commander allows you to manage files while making most of
 your screen and giving you a clear representation of the filesystem, yet
 it's simple enough to be run over a telnet or ssh session.
 
-MC needs several other programs for its various extfs extensions, e.g. 
+MC needs several other programs for its various extfs extensions, e.g.
 isoinfo (from mkisofs) or xorriso for the iso:// extension.
 
 %lang_package
+
 %prep
 echo "`grep %{name}-%{version}.tar.xz %{SOURCE6} | head -n1 | cut -c1-64`  %{SOURCE0}" | sha256sum -c
 %setup -q
@@ -111,7 +107,7 @@ echo "`grep %{name}-%{version}.tar.xz %{SOURCE6} | head -n1 | cut -c1-64`  %{SOU
 %patch20
 %patch21
 %patch22 -p1
-%patch23 -p0
+%patch23
 %patch32
 %patch41 -p1
 %patch52 -p1
@@ -120,14 +116,16 @@ echo "`grep %{name}-%{version}.tar.xz %{SOURCE6} | head -n1 | cut -c1-64`  %{SOU
 %patch101 -p1
 
 %build
-autoreconf --force --install
+autoreconf -fvi
 %define warn_flags -W -Wall -Wstrict-prototypes -Wpointer-arith -Wformat-security -Wno-unused-parameter
-export CFLAGS="$RPM_OPT_FLAGS %{warn_flags}"
+export CFLAGS="%{optflags} %{warn_flags}"
 
 export X11_WWW="%{_datadir}/mc/x11_browser"
 
+export PYTHON=%{_bindir}/python3
+
 %configure \
-    --localstatedir=/var/lib \
+    --localstatedir=%{_localstatedir}/lib \
     --enable-charset \
     --enable-vfs-smb --with-smb-configdir=%{_sysconfdir}/samba \
     --disable-vfs-fish
@@ -135,7 +133,7 @@ export X11_WWW="%{_datadir}/mc/x11_browser"
 make %{?_smp_mflags} V=1
 
 %install
-make DESTDIR=%{buildroot} install
+%make_install
 
 # clean up this setuid problem for now
 chmod 755 %{buildroot}/%{_libexecdir}/mc/cons.saver
@@ -147,8 +145,8 @@ mkdir -p %{buildroot}%{_sysconfdir}/profile.d
 ln -fs -t %{buildroot}%{_sysconfdir}/profile.d %{_datadir}/mc/mc.{,c}sh
 #support script for calling available GUI webbrosers
 install -m 755 %{SOURCE1} %{buildroot}%{_datadir}/mc/
-install -D -m 644 %{S:3} %{buildroot}%{_datadir}/pixmaps/%{name}.png
-install -D -m 644 %{S:3} %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/%{name}.png
+install -D -m 644 %{SOURCE3} %{buildroot}%{_datadir}/pixmaps/%{name}.png
+install -D -m 644 %{SOURCE3} %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/%{name}.png
 
 for f in ext.d/misc.sh ext.d/sound.sh ext.d/video.sh \
     extfs.d/gitfs+ extfs.d/uace extfs.d/uarc ;
@@ -156,11 +154,11 @@ do
     sed -i -e '1s@bin/sh@bin/bash@' "%{buildroot}%{_libexecdir}/mc/${f}"
 done
 
-%suse_update_desktop_file -i %name System FileManager
+%suse_update_desktop_file -i %{name} System FileManager
 # Remove not supported language
 rm -rf  %{buildroot}%{_datadir}/locale/be@tarask
 
-%find_lang %name
+%find_lang %{name}
 
 %post
 %if 0%{?suse_version} >= 1140
@@ -210,7 +208,7 @@ rm -rf  %{buildroot}%{_datadir}/locale/be@tarask
 %dir %{_datadir}/icons/hicolor/32x32/apps
 %{_datadir}/icons/hicolor/32x32/apps/%{name}.png
 
-%files lang -f %name.lang
+%files lang -f %{name}.lang
 %if 0%{?suse_version} < 1140 || 0%{?sles_version} && 0%{?sles_version} <= 11
 %lang(sv) %dir %{_datadir}/locale/sv_SE
 %lang(sv) %dir %{_datadir}/locale/sv_SE/LC_MESSAGES
diff --git a/sftp_interactive_password.patch b/sftp_interactive_password.patch
index 2272d49..afe09b3 100644
--- a/sftp_interactive_password.patch
+++ b/sftp_interactive_password.patch
@@ -1,7 +1,4 @@
-Upstream: https://midnight-commander.org/ticket/3921
-Bugzilla: 1098235
-
-commit 83e7624292232562639d13f76d84126e6779e54b
+commit 7910ef3ee50a847edf72d755381699f169d46278
 Author: Adam Majer <amajer@suse.de>
 Date:   Mon Jun 25 15:06:38 2018 +0200
 
@@ -15,10 +12,10 @@ Date:   Mon Jun 25 15:06:38 2018 +0200
     Signed-off-by: Adam Majer <amajer@suse.de>
 
 diff --git a/src/vfs/sftpfs/connection.c b/src/vfs/sftpfs/connection.c
-index 537159129..19a49874f 100644
+index 537159129..a6b7d1b2c 100644
 --- a/src/vfs/sftpfs/connection.c
 +++ b/src/vfs/sftpfs/connection.c
-@@ -292,6 +292,50 @@ sftpfs_open_connection_ssh_key (struct vfs_s_super *super, GError ** mcerror)
+@@ -292,6 +292,53 @@ sftpfs_open_connection_ssh_key (struct vfs_s_super *super, GError ** mcerror)
      return ret_value;
  }
  
@@ -41,7 +38,8 @@ index 537159129..19a49874f 100644
 +
 +static const char *kbi_passwd;
 +static const struct vfs_s_super *kbi_super;
-+static LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC(keyboard_interactive_helper)
++static
++LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC (keyboard_interactive_helper)
 +{
 +    int i;
 +    int len;
@@ -53,14 +51,16 @@ index 537159129..19a49874f 100644
 +    if (!kbi_super || !kbi_passwd)
 +        return;
 +
-+    if (strncmp(name, kbi_super->path_element->user, name_len) != 0)
++    if (strncmp (name, kbi_super->path_element->user, name_len) != 0)
 +        return;
 +
 +    // assume these are password prompts
-+    len = strlen(kbi_passwd);
-+    for (i=0; i<num_prompts; ++i) {
-+        if (strncmp(prompts[i].text, "Password: ", prompts[i].length) == 0) {
-+            responses[i].text = strdup(kbi_passwd);
++    len = strlen (kbi_passwd);
++    for (i = 0; i < num_prompts; ++i)
++    {
++        if (strncmp (prompts[i].text, "Password: ", prompts[i].length) == 0)
++        {
++            responses[i].text = strdup (kbi_passwd);
 +            responses[i].length = len;
 +        }
 +    }
@@ -69,15 +69,17 @@ index 537159129..19a49874f 100644
  /* --------------------------------------------------------------------------------------------- */
  /**
   * Open connection to host using password.
-@@ -323,6 +367,16 @@ sftpfs_open_connection_ssh_password (struct vfs_s_super *super, GError ** mcerro
+@@ -323,6 +370,18 @@ sftpfs_open_connection_ssh_password (struct vfs_s_super *super, GError ** mcerro
                 LIBSSH2_ERROR_EAGAIN);
          if (rc == 0)
              return TRUE;
 +
 +        kbi_super = super;
 +        kbi_passwd = super->path_element->password;
-+        while ((rc = libssh2_userauth_keyboard_interactive (super_data->session, super->path_element->user,
-+                                                            keyboard_interactive_helper)) ==
++        while ((rc =
++                libssh2_userauth_keyboard_interactive (sftpfs_super->session,
++                                                       super->path_element->user,
++                                                       keyboard_interactive_helper)) ==
 +               LIBSSH2_ERROR_EAGAIN);
 +        kbi_super = NULL;
 +        kbi_passwd = NULL;
@@ -86,7 +88,7 @@ index 537159129..19a49874f 100644
      }
  
      p = g_strdup_printf (_("sftp: Enter password for %s "), super->path_element->user);
-@@ -337,6 +391,17 @@ sftpfs_open_connection_ssh_password (struct vfs_s_super *super, GError ** mcerro
+@@ -337,6 +396,19 @@ sftpfs_open_connection_ssh_password (struct vfs_s_super *super, GError ** mcerro
                                                  passwd)) == LIBSSH2_ERROR_EAGAIN)
              ;
  
@@ -94,9 +96,11 @@ index 537159129..19a49874f 100644
 +        {
 +            kbi_super = super;
 +            kbi_passwd = passwd;
-+            while ((rc = libssh2_userauth_keyboard_interactive (super_data->session, super->path_element->user,
-+                                                                keyboard_interactive_helper))
-+                   == LIBSSH2_ERROR_EAGAIN);
++            while ((rc =
++                    libssh2_userauth_keyboard_interactive (sftpfs_super->session,
++                                                           super->path_element->user,
++                                                           keyboard_interactive_helper)) ==
++                   LIBSSH2_ERROR_EAGAIN);
 +            kbi_super = NULL;
 +            kbi_passwd = NULL;
 +        }