--- ./utils.py_orig	2017-09-22 06:24:22 -0500
+++ ./utils.py	2017-09-22 06:30:25 -0500
@@ -27,6 +27,7 @@
 
 import yum.plugins as plugins
 from urlgrabber.progress import format_number
+import subprocess
 
 def suppress_keyboard_interrupt_message():
     old_excepthook = sys.excepthook
@@ -54,6 +55,113 @@
                                  (seconds % 60))
     return "%02d:%02d" % ((seconds / 60), seconds % 60)
 
+def pid_elapse(pid):
+    etime_proc = subprocess.Popen("ps " + "-p " + pid + " -o etime=",
+                                   stdout=subprocess.PIPE,
+                                   stderr=subprocess.PIPE,
+                                   shell=True)
+    (etime, error) = etime_proc.communicate()
+    if etime_proc.returncode == 0:
+        etime = etime.replace('-',':')
+        etime_list = etime.split(':')
+        etime_len = len(etime_list)
+ 
+        (ds, hs, ms, ss, num_secs) = (0, 0, 0, 0, 0)
+ 
+        if etime_len == 4:
+            ds = int(etime_list[0]) * 86400
+            hs = int(etime_list[1]) * 3600
+            ms = int(etime_list[2]) * 60
+            ss = int(etime_list[3])
+
+        elif etime_len == 3:
+            hs = int(etime_list[0]) * 3600
+            ms = int(etime_list[1]) * 60
+            ss = int(etime_list[2])
+
+        elif etime_len == 2:
+            ms = int(etime_list[0]) * 60
+            ss = int(etime_list[1])
+ 
+        elif etime_len == 1:
+            if not etime_list[0].isspace():
+                ss = int(etime_list[0])
+ 
+        num_secs = ds + hs + ms +ss
+    return num_secs        
+
+def cpu_elapse(pid):
+    cpu_proc = subprocess.Popen("ps " + "-p " + pid + " -o time=",
+                                   stdout=subprocess.PIPE,
+                                   stderr=subprocess.PIPE,
+                                   shell=True)
+    (cpu_time, error) = cpu_proc.communicate()
+    if cpu_proc.returncode == 0:
+        etime = cpu_time.replace('-',':')
+        etime_list = etime.split(':')
+        etime_len = len(etime_list)
+
+        (ds, hs, ms, ss, num_secs) = (0, 0, 0, 0, 0)
+
+        if etime_len == 4:
+            ds = int(etime_list[0]) * 86400
+            hs = int(etime_list[1]) * 3600
+            ms = int(etime_list[2]) * 60
+            ss = int(etime_list[3])
+        elif etime_len == 3:
+            hs = int(etime_list[0]) * 3600
+            ms = int(etime_list[1]) * 60
+            ss = int(etime_list[2])
+
+        elif etime_len == 2:
+            ms = int(etime_list[0]) * 60
+            ss = int(etime_list[1])
+
+        elif etime_len == 1:
+            if not etime_list[0].isspace():
+                ss = int(etime_list[0])
+
+        num_secs = ds + hs + ms +ss
+    return num_secs
+
+def sys_boottime():
+    up_proc = subprocess.Popen("uptime",
+                                  stdout=subprocess.PIPE,
+                                  shell=True)
+    (op, error) = up_proc.communicate()
+    op = op.split()
+    (days, hm, ds, hs, ms, ts) = (0, 0, 0, 0, 0, 0)
+    op[3] = op[3].strip(',')
+    if op[3] != "days":
+        if op[3] == "mins": # case like (05:47AM   up 38 mins,  1 user .....)
+            hrs = 0
+            mn = int(op[2])
+        else:
+            hm = op[3].split(':') # case like (06:29AM   up   1:20,  1 user)
+            if len(hm) == 2:
+                hrs = int (hm[0])
+                mn = int(hm[1].strip(','))
+            elif len(hm) == 1:
+                hrs = 0
+                mn = int(hm[0])
+    else:
+        days = int(op[2]) # case like (05:39AM   up 3 days,   6:37,  4 users....)
+        hm = op[4].split(':')
+        if len(hm) == 2:
+            hrs = int (hm[0])
+            mn = int(hm[1].strip(','))
+        elif len(hm) == 1:
+            hrs = 0
+            mn = int(hm[0])
+
+    ds = days * 86400
+    hs = hrs * 3600
+    ms = mn * 60
+    ts = ds + hs + ms    
+    epoch_time = int(time.time())
+    boot_time = epoch_time - ts
+    return boot_time
+
 def get_process_info(pid):
     if not pid:
         return
@@ -64,45 +172,51 @@
         return
         
     # Maybe true if /proc isn't mounted, or not Linux ... or something.
-    if (not os.path.exists("/proc/%d/status" % pid) or
-        not os.path.exists("/proc/stat") or
-        not os.path.exists("/proc/%d/stat" % pid)):
-        return
+    # For AIX we can't read directly /proc files.
 
     ps = {}
-    for line in open("/proc/%d/status" % pid):
-        if line[-1] != '\n':
-            continue
-        data = line[:-1].split(':\t', 1)
-        if len(data) < 2:
-            continue
-        if data[1].endswith(' kB'):
-            data[1] = data[1][:-3]
-        ps[data[0].strip().lower()] = data[1].strip()
-    if 'vmrss' not in ps:
-        return
-    if 'vmsize' not in ps:
-        return
-    boot_time = None
-    for line in open("/proc/stat"):
-        if line.startswith("btime "):
-            boot_time = int(line[len("btime "):-1])
-            break
-    if boot_time is None:
-        return
-    ps_stat = open("/proc/%d/stat" % pid).read().split()
-    ps['utime'] = jiffies_to_seconds(ps_stat[13])
-    ps['stime'] = jiffies_to_seconds(ps_stat[14])
-    ps['cutime'] = jiffies_to_seconds(ps_stat[15])
-    ps['cstime'] = jiffies_to_seconds(ps_stat[16])
-    ps['start_time'] = boot_time + jiffies_to_seconds(ps_stat[21])
-    ps['state'] = {'R' : _('Running'),
-                   'S' : _('Sleeping'),
-                   'D' : _('Uninterruptible'),
-                   'Z' : _('Zombie'),
-                   'T' : _('Traced/Stopped')
-                   }.get(ps_stat[2], _('Unknown'))
-                   
+    boot_time = sys_boottime()
+    status_proc = subprocess.Popen("ps " + "-p " + str(pid) + " -o status=",
+                               stdout=subprocess.PIPE,
+                               stderr=subprocess.PIPE,
+                               shell=True)
+
+    (status, error) = status_proc.communicate()
+    if status_proc.returncode == 0:
+        status = status.strip()
+    ps['cutime'] = cpu_elapse(str(pid))
+    ps['start_time'] = pid_elapse(str(pid)) 
+    ps['state'] = {'A' : _('Active'),
+                   'O' : _('Nonexistnace'), 
+                   'W' : _('Swapped'),
+                   'I' : _('Idle'),
+                   'Z' : _('Canceled'),
+                   'T' : _('Stopped')
+                   }.get(status, _('Unknown'))
+
+    comm_proc = subprocess.Popen("ps " + "-p " + str(pid) + " -o comm=",
+                               stdout=subprocess.PIPE,
+                               stderr=subprocess.PIPE,
+                               shell=True)
+
+    (cmd, error) = comm_proc.communicate()
+    if comm_proc.returncode == 0:
+        ps['name'] = cmd.strip('\n')
+
+    rss_proc = subprocess.Popen("ps " + " -p  " + str(pid) + " -o rss=",
+                               stdout=subprocess.PIPE,
+                               stderr=subprocess.PIPE,
+                               shell=True)
+
+    (rss, error) = rss_proc.communicate()
+    if rss_proc.returncode == 0:
+        ps['vmrss'] = int(rss.strip())
+
+    ps['utime'] = 0
+    ps['stime'] = 0
+    ps['cstime'] = 0
+    ps['vmsize'] = 0
+
     return ps
 
 def show_lock_owner(pid, logger):
@@ -117,10 +231,10 @@
         nmsg = _("  The other application is: %s") % ps['name']
 
     logger.critical("%s", nmsg)
-    logger.critical(_("    Memory : %5s RSS (%5sB VSZ)") %
-                    (format_number(int(ps['vmrss']) * 1024),
-                     format_number(int(ps['vmsize']) * 1024)))
+    logger.critical(_("    Memory : %5s ") %
+                    (format_number(int(ps['vmrss']) * 1024)))
     
+    ps['start_time'] = (int(time.time())) - ps['start_time']
     ago = seconds_to_ui_time(int(time.time()) - ps['start_time'])
     logger.critical(_("    Started: %s - %s ago") %
                     (time.ctime(ps['start_time']), ago))
--- ./yum/misc.py_orig	2017-09-22 06:33:20 -0500
+++ ./yum/misc.py	2017-09-18 13:37:35 -0500
@@ -21,6 +21,7 @@
 import bz2
 import gzip
 import shutil
+import subprocess
 _available_compression = ['gz', 'bz2']
 try:
     import lzma
@@ -1023,35 +1024,51 @@
 def get_open_files(pid):
     """returns files open from this pid"""
     files = []
-    maps_f = '/proc/%s/maps' % pid
-    try:
-        maps = open(maps_f, 'r')
-    except (IOError, OSError), e:
-        return files
 
-    for line in maps:
-        if line.find('fd:') == -1:
-            continue
-        line = line.replace('\n', '')
-        slash = line.find('/')
-        filename = line[slash:]
-        filename = filename.replace('(deleted)', '') #only mildly retarded
-        filename = filename.strip()
-        if filename not in files:
-            files.append(filename)
-    
-    cli_f = '/proc/%s/cmdline' % pid
-    try:
-        cli = open(cli_f, 'r')
-    except (IOError, OSError), e:
-        return files
-    
-    cmdline = cli.read()
-    if cmdline.find('\00') != -1:
-        cmds = cmdline.split('\00')
-        for i in cmds:
-            if i.startswith('/'):
-                files.append(i)
+    line_num = 0
+    procmap_proc = subprocess.Popen("procmap " + pid,
+                                     stdout=subprocess.PIPE,
+                                     stderr=subprocess.PIPE,
+                                     shell=True)
+    for line in procmap_proc.stderr:
+       if re.search("is a kernel process", line):
+            return files
+    grep_proc = subprocess.Popen("grep 'read/exec'",
+                                  stdin=procmap_proc.stdout,
+                                  stdout=subprocess.PIPE,
+                                  shell=True)
+    for line in grep_proc.stdout:
+        line = line.strip().split()
+        if line_num != 0:
+            objects = line[:][3]
+            # .a archive files. Entry returned is libtest.a[shr.o]
+            # but it's better to have the entry as libtest.a as rpm -ql command shows
+            # library as libtest.a.
+            find_a = line[:][3].find('.a')
+            if find_a != -1:
+                a_line = objects[0:find_a+2]
+                files.append(a_line)
+            else:
+                files.append(objects)
+
+        elif line_num == 0:
+            ps_proc = subprocess.Popen("ps -o args -p" + pid + "| sed 1d",
+                                        stdout=subprocess.PIPE,
+                                        shell=True)
+            (cmd, error) = ps_proc.communicate()
+            space = cmd.find(' ')
+            cmd = cmd[0:space]
+            slash = cmd.find('/')
+            if slash == -1:
+                os.environ["PATH"]="/opt/freeware/bin:/opt/freeware/sbin:/usr/linux/sbin:/usr/linux/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
+                which_proc = subprocess.Popen("which " + cmd,
+                                                 stdout=subprocess.PIPE,
+                                                 stderr=subprocess.PIPE,
+                                                 shell=True)
+                (which_op, error) = which_proc.communicate()
+                if which_proc.returncode == 0:
+                    files.append(which_op)
+            line_num = line_num + 1
 
     return files
 
--- ./yum/rpmsack.py_orig	2017-09-22 06:34:07 -0500
+++ ./yum/rpmsack.py	2017-09-18 13:37:35 -0500
@@ -1223,7 +1223,8 @@
                 if not pkgs:
                     self._pkgname_fails.add(name)
             else:
-                pkgs = self.returnPkgs()
+                #pkgs = self.returnPkgs()
+                pkgs = []
             for po in pkgs:
                 for tag in ('arch', 'rel', 'ver', 'epoch'):
                     if loc[tag] is not None and loc[tag] != getattr(po, tag):
