pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/53344: sysutils/salt 2018.3.0 pkgin module fixes



>Number:         53344
>Category:       pkg
>Synopsis:       sysutils/salt 2018.3.0 pkgin module fixes
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 05 15:05:00 +0000 2018
>Originator:     Travis Paul
>Release:        current
>Organization:
>Environment:
NetBSD n7.local 7.1.2 NetBSD 7.1.2 (GENERIC.201803151611Z) amd64

>Description:
Salt's pkgin module has some issues:
- pkg.file_dict crashes
- pkg.latest_version doesn't actually work

Patches accepted upstream (also added some unit tests upstream): https://github.com/saltstack/salt/pull/47814

I was informed that these fixes will not make it into 2018.3.1, and will be available 2 months after 2018.3.1 is released at the earliest.

salt-2017.7.4 in pkgsrc 2018Q1 is also broken but the fixes for pkg.latest_version don't work there and I haven't been able to fix the issue in that version yet. 
>How-To-Repeat:
pkgin reports that nginx version 1.14.0 is available but not yet installed:

# pkgin se nginx
nginx-1.14.0         Lightweight HTTP server and mail proxy server

=: package is installed and up-to-date
<: package is installed but newer version is available
: installed package has a greater version than available package

However, pkg.latest_version returns nothing:

# salt \* pkg.latest_version nginx
salt.n7test.local:


pkg_info shows the installed files for an installed package:

# pkg_info -qL nginx
/opt/pkg/current/man/man8/nginx.8
/opt/pkg/current/sbin/nginx
/opt/pkg/current/share/examples/nginx/conf/fastcgi.conf
/opt/pkg/current/share/examples/nginx/conf/fastcgi_params
/opt/pkg/current/share/examples/nginx/conf/koi-utf
/opt/pkg/current/share/examples/nginx/conf/koi-win
/opt/pkg/current/share/examples/nginx/conf/mime.types
/opt/pkg/current/share/examples/nginx/conf/nginx.conf
/opt/pkg/current/share/examples/nginx/conf/win-utf
/opt/pkg/current/share/examples/nginx/html/50x.html
/opt/pkg/current/share/examples/nginx/html/inde



However, pkg.file_dict throws an exception:

# salt \* pkg.file_dict nginx

salt.n7-test.local:
   The minion function caused an exception: Traceback (most recent call last):
     File "/opt/pkg/current/lib/python2.7/site-packages/salt/minion.py", line 1600, in _thread_return
       return_data = minion_instance.executors[fname](opts, data, func, args, kwargs)
     File "/opt/pkg/current/lib/python2.7/site-packages/salt/executors/direct_call.py", line 12, in execute
       return func(*args, **kwargs)
     File "/opt/pkg/current/lib/python2.7/site-packages/salt/modules/pkgin.py", line 684, in file_dict
       for field in ret:
   RuntimeError: dictionary changed size during iteration
>Fix:
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/salt/distinfo,v
retrieving revision 1.35
diff -u -r1.35 distinfo
--- distinfo    12 May 2018 11:29:35 -0000      1.35
+++ distinfo    5 Jun 2018 09:05:25 -0000
@@ -5,4 +5,5 @@
 SHA512 (salt-2018.3.0.tar.gz) = 3d64a4d12d4ff7effe644b682b138d8f49fd00523e9cfe3e80bebff9c944a089fb41cbac92e63139633425f49c1eebeb99145290a0bdd1b4f306da86abe9b2e5
 Size (salt-2018.3.0.tar.gz) = 13448567 bytes
 SHA1 (patch-salt_grains_core.py) = 735a71cd9616be34cce6b015da7a70cace08accd
+SHA1 (patch-salt_modules_pkgin.py) = c2c2d10d7657f3a64d7e1f3292de0d8cb798480a
 SHA1 (patch-salt_version.py) = 1827dac3609a938fae38ee5dfd2a873c9723dfbd
Index: patches/patch-salt_modules_pkgin.py
===================================================================
RCS file: patches/patch-salt_modules_pkgin.py
diff -N patches/patch-salt_modules_pkgin.py
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-salt_modules_pkgin.py 5 Jun 2018 09:05:25 -0000
@@ -0,0 +1,38 @@
+$NetBSD$
+
+Fixes 2 bugs in the pkgin module:
+- pkg.latest_version doesn't return a version for an uninstalled package.
+- pkg.file_dict crashes.
+https://github.com/saltstack/salt/pull/47814
+
+--- salt/modules/pkgin.py.orig 2018-04-02 16:35:12.000000000 +0000
++++ salt/modules/pkgin.py
+@@ -181,7 +181,9 @@ def latest_version(*names, **kwargs):
+
+         out = __salt__['cmd.run'](cmd, output_loglevel='trace')
+         for line in out.splitlines():
+-            p = line.split(',' if _supports_parsing() else None)
++            if line.startswith('No results found for'):
++                return pkglist
++            p = line.split(';' if _supports_parsing() else None)
+
+             if p and p[0] in ('=:', '<:', '>:', ''):
+                 # These are explanation comments
+@@ -190,7 +192,7 @@ def latest_version(*names, **kwargs):
+                 s = _splitpkg(p[0])
+                 if s:
+                     if not s[0] in pkglist:
+-                        if len(p) > 1 and p[1] == '<':
++                        if len(p) > 1 and p[1] in ('<', '', '='):
+                             pkglist[s[0]] = s[1]
+                         else:
+                             pkglist[s[0]] = ''
+@@ -681,7 +683,7 @@ def file_dict(*packages):
+                 continue  # unexpected string
+
+     ret = {'errors': errors, 'files': files}
+-    for field in ret:
++    for field in list(ret):
+         if not ret[field] or ret[field] == '':
+             del ret[field]
+     return ret


Home | Main Index | Thread Index | Old Index