Hello community,

here is the log from the commit of package procps for openSUSE:Factory checked 
in at 2018-01-07 17:20:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/procps (Old)
 and      /work/SRC/openSUSE:Factory/.procps.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "procps"

Sun Jan  7 17:20:40 2018 rev:107 rq:560027 version:3.3.12

Changes:
--------
--- /work/SRC/openSUSE:Factory/procps/procps.changes    2017-08-12 
19:40:22.505782385 +0200
+++ /work/SRC/openSUSE:Factory/.procps.new/procps.changes       2018-01-07 
17:20:47.174926171 +0100
@@ -1,0 +2,6 @@
+Tue Dec 19 15:58:21 UTC 2017 - [email protected]
+
+- Add patch procps-ng-3.3.12-sysctl-iobuf-write.patch to use
+  increased buffer on writing /proc/sys/net/ipv4/ip_local_reserved_ports
+
+-------------------------------------------------------------------

New:
----
  procps-ng-3.3.12-sysctl-iobuf-write.patch

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

Other differences:
------------------
++++++ procps.spec ++++++
--- /var/tmp/diff_new_pack.B38qZG/_old  2018-01-07 17:20:48.278874426 +0100
+++ /var/tmp/diff_new_pack.B38qZG/_new  2018-01-07 17:20:48.278874426 +0100
@@ -65,6 +65,8 @@
 Patch35:        procps-ng-3.3.12-sysctl-iobuf.patch
 # PATCH-FIX-SUSE -- Ignore EIO on reading unset value of e.g. 
/proc/sys/net/ipv6/conf/all/stable_secret
 Patch36:        procps-ng-3.3.12-stable_secret.patch
+# PATCH-ENHANCE-SUSE -- Use increased buffer on writing 
/proc/sys/net/ipv4/ip_local_reserved_ports
+Patch37:        procps-ng-3.3.12-sysctl-iobuf-write.patch
 BuildRequires:  automake
 BuildRequires:  dejagnu
 BuildRequires:  libselinux-devel
@@ -153,6 +155,7 @@
 %patch34
 %patch35
 %patch36
+%patch37
 
 %build
 #

++++++ procps-ng-3.3.12-sysctl-iobuf-write.patch ++++++
Be able to write very long lines for /proc/sys/net/ipvq/ip_local_reserved_ports

---
 sysctl.c |   96 +++++++++++++++++++++++++++++++++++++++++++--------------------
 1 file changed, 66 insertions(+), 30 deletions(-)

--- sysctl.c
+++ sysctl.c    2017-12-19 13:50:34.327716771 +0100
@@ -28,6 +28,7 @@
 
 #include <dirent.h>
 #include <errno.h>
+#include <fcntl.h>
 #include <getopt.h>
 #include <glob.h>
 #include <libgen.h>
@@ -366,20 +367,21 @@ static int DisplayAll(const char *restri
        return rc;
 }
 
+#define LINELEN 4096
+
 /*
  * Write a sysctl setting
  */
-static int WriteSetting(const char *setting)
+static int WriteSetting(char *setting)
 {
-       int rc = 0;
+       int fd, rc = 0;
        const char *name = setting;
-       const char *value;
-       const char *equals;
+       char *equals;
+       char *value;
        char *tmpname;
        char *outname;
        char *last_dot;
 
-       FILE *fp;
        struct stat ts;
 
        if (!name)
@@ -440,9 +442,8 @@ static int WriteSetting(const char *sett
                goto out;
        }
 
-       fp = fopen(tmpname, "w");
-
-       if (!fp) {
+       fd = openat(AT_FDCWD, tmpname, O_WRONLY|O_TRUNC);
+       if (fd < 0) {
                switch (errno) {
                case ENOENT:
                        if (!IgnoreError) {
@@ -460,26 +461,48 @@ static int WriteSetting(const char *sett
                        break;
                }
        } else {
-               if (iobuf)
-                       setvbuf(fp, iobuf, _IOFBF, IOBUFSIZ);
-               rc = fprintf(fp, "%s\n", value);
-               if (0 < rc)
-                       rc = 0;
-               if (close_stream(fp) != 0)
+               char *token = NULL, *ptr = &value[0], save;
+               size_t offset = 0, length = strlen(value);
+               ssize_t junk;
+
+               do {
+                       if (length > LINELEN)
+                               token = (char*)memrchr(ptr+offset, ',', 
LINELEN);
+                       if (token) {
+                               save = *token;
+                               *token = '\0';
+                       }
+                       lseek(fd, 1, SEEK_CUR);
+                       junk = write(fd, ptr+offset, strlen(ptr+offset)+1);
+                       if (junk < 1 || junk >= length)
+                               break;
+                       offset += junk;
+                       length -= junk;
+                       if (token)
+                               *token = save;
+               } while (length > 0);
+               if (close(fd) < 0)
                        xwarn(_("setting key \"%s\""), outname);
                if (rc == 0 && !Quiet) {
                        if (NameOnly) {
                                fprintf(stdout, "%s\n", outname);
                        } else {
-                               if (PrintName) {
-                                       fprintf(stdout, "%s = %s\n",
-                                               outname, value);
-                               } else {
-                                       if (PrintNewline)
-                                               fprintf(stdout, "%s\n", value);
-                                       else
-                                               fprintf(stdout, "%s", value);
-                               }
+                               length = strlen(value);
+                               ptr = &value[0];
+
+                               if (PrintName)
+                                       fprintf(stdout, "%s = ", outname);
+
+                               do {
+                                       junk = fprintf(stdout, "%s", ptr);
+                                       if (junk < 1 || junk >= length)
+                                               break;
+                                       ptr += junk;
+                                       length -= junk;
+                               } while (length > 0);
+
+                               if (PrintNewline)
+                                       fputc('\n', stdout);
                        }
                }
        }
@@ -503,22 +526,21 @@ static int pattern_match(const char *str
        return (1);
 }
 
-#define LINELEN 4096
-
 /*
  * Preload the sysctl's from the conf file.  We parse the file and then
  * reform it (strip out whitespace).
  */
 static int Preload(const char *restrict const filename)
 {
-       char oneline[LINELEN];
        char buffer[LINELEN];
+       char *oneline;
        FILE *fp;
        char *t;
        int n = 0;
        int rc = 0;
        char *name, *value;
        glob_t globbuf;
+       size_t maxlen;
        int globerr;
        int globflg;
        int j;
@@ -539,6 +561,13 @@ static int Preload(const char *restrict
        if (globerr != 0 && globerr != GLOB_NOMATCH)
                xerr(EXIT_FAILURE, _("glob failed"));
 
+       oneline = iobuf;        /* Allow to fail */
+       if (!oneline) {
+               oneline = &buffer[0];
+               maxlen = sizeof(buffer);
+       } else
+               maxlen = IOBUFSIZ;
+
        for (j = 0; j < globbuf.gl_pathc; j++) {
                fp = (globbuf.gl_pathv[j][0] == '-' && !globbuf.gl_pathv[j][1])
                    ? stdin : fopen(globbuf.gl_pathv[j], "r");
@@ -547,7 +576,8 @@ static int Preload(const char *restrict
                        return -1;
                }
 
-               while (fgets(oneline, sizeof oneline, fp)) {
+               while (fgets(oneline, maxlen, fp)) {
+                       size_t offset;
                        n++;
                        t = StripLeadingAndTrailingSpaces(oneline);
 
@@ -569,6 +599,10 @@ static int Preload(const char *restrict
                        if (pattern && !pattern_match(name, pattern))
                                continue;
 
+                       offset = strlen(name);
+                       memmove(&oneline[0], name, offset);
+                       oneline[offset++] = '=';
+
                        value = strtok(NULL, "\n\r");
                        if (!value || !*value) {
                                xwarnx(_("%s(%d): invalid syntax, 
continuing..."),
@@ -578,10 +612,12 @@ static int Preload(const char *restrict
 
                        while ((*value == ' ' || *value == '\t') && *value != 0)
                                value++;
-
                        /* should NameOnly affect this? */
-                       sprintf(buffer, "%s=%s", name, value);
-                       rc |= WriteSetting(buffer);
+                       memmove(&oneline[offset], value, strlen(value));
+                       offset += strlen(value);
+                       oneline[offset] = '\0';
+
+                       rc |= WriteSetting(oneline);
                }
 
                fclose(fp);

Reply via email to