Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package progress for openSUSE:Factory 
checked in at 2021-04-27 21:34:32
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/progress (Old)
 and      /work/SRC/openSUSE:Factory/.progress.new.12324 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "progress"

Tue Apr 27 21:34:32 2021 rev:5 rq:888524 version:0.16

Changes:
--------
--- /work/SRC/openSUSE:Factory/progress/progress.changes        2020-12-04 
21:29:10.694184261 +0100
+++ /work/SRC/openSUSE:Factory/.progress.new.12324/progress.changes     
2021-04-27 21:34:40.075984358 +0200
@@ -1,0 +2,9 @@
+Mon Apr 26 11:33:01 UTC 2021 - Paolo Stivanin <[email protected]>
+
+- Update to 0.16:
+  * fix procstat_getprocs()
+  * add support for single binary
+  * add scp, zip and unzip
+  * add FreeBSD support
+
+-------------------------------------------------------------------

Old:
----
  progress-0.15.tar.gz

New:
----
  progress-0.16.tar.gz

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

Other differences:
------------------
++++++ progress.spec ++++++
--- /var/tmp/diff_new_pack.28N9jf/_old  2021-04-27 21:34:40.543985129 +0200
+++ /var/tmp/diff_new_pack.28N9jf/_new  2021-04-27 21:34:40.547985135 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package progress
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           progress
-Version:        0.15
+Version:        0.16
 Release:        0
 Summary:        Coreutils Viewer
 License:        GPL-3.0-or-later
@@ -25,8 +25,19 @@
 URL:            https://github.com/Xfennec/progress
 Source0:        
https://github.com/Xfennec/progress/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
 Patch1:         progress-fix_ncurses_without_pkgconfig.patch
-BuildRequires:  ncurses-devel
 BuildRequires:  pkgconfig
+BuildRequires:  pkgconfig(form)
+BuildRequires:  pkgconfig(formw)
+BuildRequires:  pkgconfig(menu)
+BuildRequires:  pkgconfig(menuw)
+BuildRequires:  pkgconfig(ncurses)
+BuildRequires:  pkgconfig(ncurses++)
+BuildRequires:  pkgconfig(ncurses++w)
+BuildRequires:  pkgconfig(ncursesw)
+BuildRequires:  pkgconfig(panel)
+BuildRequires:  pkgconfig(panelw)
+BuildRequires:  pkgconfig(tic)
+BuildRequires:  pkgconfig(tinfo)
 Provides:       cv = %{version}
 Obsoletes:      cv < %{version}
 
@@ -42,7 +53,7 @@
 %patch1
 
 %build
-make %{?_smp_mflags} CFLAGS="-g -Wall -D_FILE_OFFSET_BITS=64 %{optflags}"
+%make_build CFLAGS="-g -Wall -D_FILE_OFFSET_BITS=64 %{optflags}"
 
 %install
 %make_install PREFIX=%{_prefix}

++++++ progress-0.15.tar.gz -> progress-0.16.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/progress-0.15/Makefile new/progress-0.16/Makefile
--- old/progress-0.15/Makefile  2020-06-08 10:45:33.000000000 +0200
+++ new/progress-0.16/Makefile  2021-03-04 11:26:40.000000000 +0100
@@ -16,6 +16,9 @@
 ifeq ($(UNAME), Darwin)
     override LDFLAGS += -lncurses
 endif
+ifeq ($(UNAME), FreeBSD)
+    override LDFLAGS += -lncurses -lprocstat
+endif
 PREFIX ?= /usr/local
 BINDIR = $(PREFIX)/bin
 MANDIR = $(PREFIX)/share/man/man1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/progress-0.15/README.md new/progress-0.16/README.md
--- old/progress-0.15/README.md 2020-06-08 10:45:33.000000000 +0200
+++ new/progress-0.16/README.md 2021-03-04 11:26:40.000000000 +0100
@@ -1,10 +1,10 @@
 progress - Coreutils Progress Viewer [![Build 
Status](https://travis-ci.org/Xfennec/progress.svg?branch=master)](https://travis-ci.org/Xfennec/progress)
 =====================
 
-What is it?
------------
+What is it
+----------
 
-This tool can be described as a **Tiny**, Dirty, Linux-and-OSX-Only C command
+This tool can be described as a **Tiny**, Dirty C command
 that looks for coreutils basic commands (cp, mv, dd, tar, gzip/gunzip,
 cat, etc.) currently running on your system and displays the
 **percentage** of copied data. It can also show **estimated time** and 
**throughput**,
@@ -14,15 +14,17 @@
 
 _(After many requests: the colors in the shell come from 
[powerline-shell](https://github.com/milkbikis/powerline-shell). Try it, it's 
cool.)_
 
+`progress` works on Linux, FreeBSD and macOS.
+
 Formerly known as cv (Coreutils Viewer).
 
-How do you install it?
-----------------------
+How do you install it
+---------------------
 
 On deb-based systems (Debian, Ubuntu, Mint, etc.) run:
 
     apt install progress
-    
+
 On rpm-based systems (Red Hat, CentOS, SUSE, etc.), run:
 
     yum install progress
@@ -30,27 +32,27 @@
 On macOS, with homebrew, run:
 
     brew install progress
-    
+
 On macOS, with MacPorts, run:
 
     port install progress
 
-
-How do you build it from source?
---------------------------------
+How do you build it from source
+-------------------------------
 
     make && make install
 
+On FreeBSD, substitute `make` with `gmake`.
+
 It depends on library ncurses, you may have to install corresponding packages 
(may be something like 'libncurses5-dev' or 'ncurses-devel').
 
-How do you run it?
-------------------
+How do you run it
+-----------------
 
 Just launch the binary, `progress`.
 
-
-What can I do with it?
-----------------------
+What can I do with it
+---------------------
 
 A few examples. You can:
 
@@ -73,8 +75,8 @@
 
 and much more.
 
-How does it work?
------------------
+How does it work
+----------------
 
 It simply scans `/proc` for interesting commands, and then looks at
 directories `fd` and `fdinfo` to find opened files and seek positions,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/progress-0.15/progress.1 new/progress-0.16/progress.1
--- old/progress-0.15/progress.1        2020-06-08 10:45:33.000000000 +0200
+++ new/progress-0.16/progress.1        2021-03-04 11:26:40.000000000 +0100
@@ -32,7 +32,7 @@
 .SH DESCRIPTION
 This manual page briefly documents the \fBprogress\fP command.
 .PP
-This tool can be described as a Tiny, Dirty, Linux-Only C command
+This tool can be described as a Tiny, Dirty, C command
 that looks for coreutils basic commands (cp, mv, dd, tar, gzip/gunzip,
 cat, etc.) currently running on your system and displays the
 percentage of copied data.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/progress-0.15/progress.c new/progress-0.16/progress.c
--- old/progress-0.15/progress.c        2020-06-08 10:45:33.000000000 +0200
+++ new/progress-0.16/progress.c        2021-03-04 11:26:40.000000000 +0100
@@ -46,8 +46,21 @@
 # include <sys/proc_info.h>
 # include <libproc.h>
 # include <sys/disk.h>
-#else
+#endif // __APPLE__
+#ifdef __linux__
 # include <linux/fs.h>
+#endif // __linux__
+#ifdef __FreeBSD__
+# include <sys/disk.h>
+#endif // __FreeBSD__
+
+#ifdef __FreeBSD__
+# include <sys/param.h>
+# include <sys/queue.h>
+# include <sys/socket.h>
+# include <sys/sysctl.h>
+# include <sys/user.h>
+# include <libprocstat.h>
 #endif
 
 #include "progress.h"
@@ -58,13 +71,22 @@
 // list and generate it at runtime.
 static int proc_names_cnt;
 static char **proc_names;
-char *default_proc_names[] = {"cp", "mv", "dd", "tar", "cat", "rsync",
+char *default_proc_names[] = {"cp", "mv", "dd", "tar", "bsdtar", "cat", 
"rsync", "scp",
     "grep", "fgrep", "egrep", "cut", "sort", "md5sum", "sha1sum",
-    "sha224sum", "sha256sum", "sha384sum", "sha512sum", "adb",
-    "gzip", "gunzip", "bzip2", "bunzip2", "xz", "unxz", "lzma", "unlzma", 
"7z", "7za",
+    "sha224sum", "sha256sum", "sha384sum", "sha512sum",
+#ifdef __FreeBSD__
+    "md5", "sha1", "sha224", "sha256", "sha512", "sha512t256", "rmd160",
+    "skein256", "skein512", "skein1024",
+#endif
+    "adb",
+    "gzip", "gunzip", "bzip2", "bunzip2", "xz", "unxz", "lzma", "unlzma", 
"7z", "7za", "zip", "unzip",
     "zcat", "bzcat", "lzcat",
+    "coreutils",
     "split",
     "gpg",
+#if defined(__APPLE__) || defined(__FreeBSD__)
+    "gcp", "gmv",
+#endif
     NULL
 };
 
@@ -179,7 +201,8 @@
 free(pids);
 return pid_count;
 }
-#else
+#endif // __APPLE__
+#ifdef __linux__
 int find_pid_by_id(pid_t pid, pidinfo_t *pid_list)
 {
 char fullpath_exe[MAXPATHLEN + 1];
@@ -255,7 +278,88 @@
 closedir(proc);
 return pid_count;
 }
-#endif
+#endif // __linux__
+#ifdef __FreeBSD__
+int find_pid_by_id(pid_t pid, pidinfo_t *pid_list)
+{
+struct procstat *procstat;
+struct kinfo_proc *procs;
+unsigned int proc_count;
+
+struct kinfo_proc *proc;
+char pathname[PATH_MAX];
+
+int i, found = 0;
+
+procstat = procstat_open_sysctl();
+assert(procstat != NULL);
+
+procs = procstat_getprocs(procstat, KERN_PROC_PID, pid, &proc_count);
+if (procs == NULL)
+    goto done;
+
+for (i = 0; i < proc_count; i++) {
+    proc = &procs[i];
+    procstat_getpathname(procstat, proc, pathname, sizeof(pathname));
+    if (strlen(pathname) == 0)
+        // kernel thread I guess?
+        continue;
+
+    pid_list[0].pid = pid;
+    strcpy(pid_list[0].name, basename(pathname));
+    found = 1;
+    break;
+}
+
+procstat_freeprocs(procstat, procs);
+done:
+procstat_close(procstat);
+
+return found;
+}
+
+int find_pids_by_binary_name(char *bin_name, pidinfo_t *pid_list, int max_pids)
+{
+struct procstat *procstat;
+struct kinfo_proc *procs;
+unsigned int proc_count;
+
+struct kinfo_proc *proc;
+char pathname[PATH_MAX];
+
+int pid_count = 0;
+int i;
+
+procstat = procstat_open_sysctl();
+assert(procstat != NULL);
+
+procs = procstat_getprocs(procstat, KERN_PROC_PROC, 0, &proc_count);
+if (procs == NULL)
+    goto done;
+
+for (i = 0; i < proc_count; i++) {
+    proc = &procs[i];
+    procstat_getpathname(procstat, proc, pathname, sizeof(pathname));
+    if (strlen(pathname) == 0)
+        // kernel thread I guess? see proc->ki_comm instead
+        continue;
+
+    if (!strcmp(basename(pathname), bin_name)) {
+        pid_list[pid_count].pid = proc->ki_pid;
+        strcpy(pid_list[pid_count].name, bin_name);
+        pid_count++;
+        if (pid_count == max_pids)
+            break;
+    }
+}
+
+procstat_freeprocs(procstat, procs);
+done:
+procstat_close(procstat);
+
+return pid_count;
+}
+#endif // __FreeBSD__
 
 #ifdef __APPLE__
 int find_fd_for_pid(pid_t pid, int *fd_list, int max_fd)
@@ -299,7 +403,8 @@
 }
 return count;
 }
-#else
+#endif // __APPLE__
+#ifdef __linux__
 int find_fd_for_pid(pid_t pid, int *fd_list, int max_fd)
 {
 DIR *proc;
@@ -362,13 +467,77 @@
 closedir(proc);
 return count;
 }
-#endif
+#endif // __linux__
+#ifdef __FreeBSD__
+int find_fd_for_pid(pid_t pid, int *fd_list, int max_fd)
+{
+struct procstat *procstat;
+struct kinfo_proc *procs;
+unsigned int proc_count;
+
+struct kinfo_proc *proc;
+struct filestat *fstat;
+struct filestat_list *fstat_list;
+
+int count = 0;
+int i;
+
+procstat = procstat_open_sysctl();
+assert(procstat != NULL);
+
+procs = procstat_getprocs(procstat, KERN_PROC_PID, pid, &proc_count);
+if (procs == NULL)
+    goto done;
+
+for (i = 0; i < proc_count; i++) {
+    proc = &procs[i];
+
+    fstat_list = procstat_getfiles(procstat, proc, 0);
+    if (fstat_list == NULL)
+        continue;
+    STAILQ_FOREACH(fstat, fstat_list, next) {
+        if (fstat->fs_type != PS_FST_TYPE_VNODE)
+            continue;
+        if (fstat->fs_fd < 0) // usually non-zero fs_uflags: 
PS_FST_UFLAG_{TEXT,CTTY,...}
+            continue;
+
+        struct vnstat vn;
+        char errbuf[_POSIX2_LINE_MAX];
+
+        if (procstat_get_vnode_info(procstat, fstat, &vn, errbuf) != 0)
+            // see errbuf
+            continue;
+
+        if (!(vn.vn_type == PS_FST_VTYPE_VREG || vn.vn_type == 
PS_FST_VTYPE_VBLK))
+            continue;
+
+        if (is_ignored_file(fstat->fs_path))
+            continue;
+
+        // OK, we've found a potential interesting file.
+        fd_list[count++] = fstat->fs_fd;
+        // fstat->fs_offset is looked up once again in get_fdinfo()
+
+        if (count == max_fd)
+            break;
+    }
+
+    procstat_freefiles(procstat, fstat_list);
+}
+
+procstat_freeprocs(procstat, procs);
+done:
+procstat_close(procstat);
+
+return count;
+}
+#endif // __FreeBSD__
 
 
 signed char get_fdinfo(pid_t pid, int fdnum, fdinfo_t *fd_info)
 {
 struct stat stat_buf;
-#ifndef __APPLE__
+#ifdef __linux__
 char fdpath[MAXPATHLEN + 1];
 char line[LINE_LEN];
 FILE *fp;
@@ -384,7 +553,8 @@
 if (proc_pidfdinfo(pid, fdnum, PROC_PIDFDVNODEPATHINFO, &vnodeInfo, 
PROC_PIDFDVNODEPATHINFO_SIZE) <= 0)
     return 0;
 strncpy(fd_info->name, vnodeInfo.pvip.vip_path, MAXPATHLEN);
-#else
+#endif // __APPLE__
+#ifdef __linux__
 ssize_t len;
 snprintf(fdpath, MAXPATHLEN, "%s/%d/fd/%d", PROC_PATH, pid, fdnum);
 
@@ -396,6 +566,63 @@
     return 0;
 }
 #endif
+#ifdef __FreeBSD__
+struct procstat *procstat;
+struct kinfo_proc *procs;
+unsigned int proc_count;
+
+struct kinfo_proc *proc;
+struct filestat *fstat;
+struct filestat_list *fstat_list;
+
+int i;
+
+procstat = procstat_open_sysctl();
+assert(procstat != NULL);
+
+procs = procstat_getprocs(procstat, KERN_PROC_PID, pid, &proc_count);
+if (procs == NULL)
+    goto done;
+
+for (i = 0; i < proc_count; i++) {
+    proc = &procs[i];
+
+    fstat_list = procstat_getfiles(procstat, proc, 0);
+    if (fstat_list == NULL)
+        continue;
+
+    gettimeofday(&fd_info->tv, &tz);
+
+    STAILQ_FOREACH(fstat, fstat_list, next) {
+        if (fstat->fs_fd != fdnum)
+            continue;
+
+        strncpy(fd_info->name, fstat->fs_path, MAXPATHLEN);
+
+        struct vnstat vn;
+        char errbuf[_POSIX2_LINE_MAX];
+
+        if (procstat_get_vnode_info(procstat, fstat, &vn, errbuf) != 0)
+            // see errbuf
+            continue;
+
+        fd_info->pos = fstat->fs_offset;
+        // XXX PS_FST_FFLAG_APPEND?
+        fd_info->mode = (
+            fstat->fs_fflags & (PS_FST_FFLAG_WRITE | PS_FST_FFLAG_READ) ? 
PM_READWRITE :
+            fstat->fs_fflags & PS_FST_FFLAG_WRITE ? PM_WRITE :
+            fstat->fs_fflags & PS_FST_FFLAG_READ ? PM_READ :
+            0
+        );
+    }
+
+    procstat_freefiles(procstat, fstat_list);
+}
+
+procstat_freeprocs(procstat, procs);
+done:
+procstat_close(procstat);
+#endif // __FreeBSD__
 
 if (stat(fd_info->name, &stat_buf) == -1) {
     //~ printf("[debug] %i - %s\n",pid,fd_info->name);
@@ -428,7 +655,16 @@
     }
     fd_info->size = bc*bs;
     printf("Size: %lld\n", fd_info->size);
-#else
+#endif
+#ifdef __FreeBSD__
+    if (ioctl(fd, DIOCGMEDIASIZE, &fd_info->size) < 0) {
+        if (flag_debug)
+            nperror("ioctl (get_fdinfo)");
+        close(fd);
+        return 0;
+    }
+#endif
+#ifdef __linux__
     if (ioctl(fd, BLKGETSIZE64, &fd_info->size) < 0) {
         if (flag_debug)
             nperror("ioctl (get_fdinfo)");
@@ -450,7 +686,8 @@
     fd_info->mode = PM_WRITE;
 if (vnodeInfo.pfi.fi_openflags & FREAD && vnodeInfo.pfi.fi_openflags & FWRITE)
     fd_info->mode = PM_READWRITE;
-#else
+#endif // __APPLE__
+#ifdef __linux__
 flags = 0;
 fd_info->pos = 0;
 
@@ -479,7 +716,7 @@
     fd_info->mode = PM_READWRITE;
 
 fclose(fp);
-#endif
+#endif // __linux__
 return 1;
 }
 
@@ -537,7 +774,7 @@
 
     switch (c) {
         case 'v':
-            printf("progress version %s\n",PROGRESS_VERSION);
+            printf("progress version %s\n", PROGRESS_VERSION);
             exit(EXIT_SUCCESS);
             break;
 
@@ -545,7 +782,7 @@
             printf("progress - Coreutils Viewer\n");
             printf("---------------------\n");
             printf("Shows progress on file manipulations (cp, mv, dd, 
...)\n\n");
-            printf("Monitored commands (default):\n");
+            printf("Monitored commands (default, you can add virtually 
anything):\n");
             for(i = 0 ; i < proc_names_cnt ; i++)
                 printf("%s ", proc_names[i]);
             printf("\n\n");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/progress-0.15/progress.h new/progress-0.16/progress.h
--- old/progress-0.15/progress.h        2020-06-08 10:45:33.000000000 +0200
+++ new/progress-0.16/progress.h        2021-03-04 11:26:40.000000000 +0100
@@ -25,7 +25,7 @@
 
 #include "hlist.h"
 
-#define PROGRESS_VERSION         "0.15"
+#define PROGRESS_VERSION         "0.16"
 
 #define PROC_PATH       "/proc"
 #define MAX_PIDS        32

Reply via email to