Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package xdiskusage for openSUSE:Factory 
checked in at 2021-05-06 22:53:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/xdiskusage (Old)
 and      /work/SRC/openSUSE:Factory/.xdiskusage.new.2988 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "xdiskusage"

Thu May  6 22:53:04 2021 rev:17 rq:891056 version:1.54

Changes:
--------
--- /work/SRC/openSUSE:Factory/xdiskusage/xdiskusage.changes    2020-08-18 
12:03:13.147424913 +0200
+++ /work/SRC/openSUSE:Factory/.xdiskusage.new.2988/xdiskusage.changes  
2021-05-06 22:53:36.750505708 +0200
@@ -1,0 +2,8 @@
+Thu May  6 13:55:10 UTC 2021 - Ferdinand Thiessen <r...@fthiessen.de>
+
+- Update to version 1.54
+  * Prevent difficult-to-understand errors in the event of
+    filenames with newlines.
+  * Bugfixes
+
+-------------------------------------------------------------------

Old:
----
  xdiskusage-1.52.tgz

New:
----
  xdiskusage-1.54.tgz

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

Other differences:
------------------
++++++ xdiskusage.spec ++++++
--- /var/tmp/diff_new_pack.XmZuhO/_old  2021-05-06 22:53:37.170503975 +0200
+++ /var/tmp/diff_new_pack.XmZuhO/_new  2021-05-06 22:53:37.170503975 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package xdiskusage
 #
-# 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:           xdiskusage
-Version:        1.52
+Version:        1.54
 Release:        0
 Summary:        Graphically displays the amount of disk space used by each 
subdirectory
 License:        GPL-2.0-only

++++++ xdiskusage-1.52.tgz -> xdiskusage-1.54.tgz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xdiskusage-1.52/Makefile new/xdiskusage-1.54/Makefile
--- old/xdiskusage-1.52/Makefile        2020-06-19 05:02:26.000000000 +0200
+++ new/xdiskusage-1.54/Makefile        2021-01-05 06:47:07.000000000 +0100
@@ -1,7 +1,7 @@
 SHELL=/bin/sh
 
 PROGRAM = xdiskusage
-VERSION = 1.52
+VERSION = 1.54
 
 CXXFILES = panels.C xdiskusage.C
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xdiskusage-1.52/README new/xdiskusage-1.54/README
--- old/xdiskusage-1.52/README  2020-06-19 05:02:35.000000000 +0200
+++ new/xdiskusage-1.54/README  2021-01-05 06:51:12.000000000 +0100
@@ -1,4 +1,4 @@
-xdiskusage Version 1.52
+xdiskusage Version 1.54
 
 ----------------------------------------------------------------
 How to compile xdiskusage:
@@ -144,6 +144,8 @@
   PostScript.  It will either run it through lpr (or any command you
   choose) or send it to a file.
 
+  Quit (q or Esc): exit
+
 ----------------------------------------------------------------
 Acknowledgements
 ----------------------------------------------------------------
@@ -155,8 +157,10 @@
 Stephane Gourichon contributed many suggested improvements.
 <stephane dot gourichon at lip6 dot fr>
 
+So did Keith Thompson
+
 ----------------------------------------------------------------
-Copyright (C) 2014 Bill Spitzak
+Copyright (C) 2021 Bill Spitzak
 ----------------------------------------------------------------
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xdiskusage-1.52/panels.C new/xdiskusage-1.54/panels.C
--- old/xdiskusage-1.52/panels.C        2014-12-22 01:42:17.000000000 +0100
+++ new/xdiskusage-1.54/panels.C        2020-12-04 05:09:06.000000000 +0100
@@ -9,7 +9,7 @@
 Fl_Input *disk_input=(Fl_Input *)0;
 
 static void cb_browser(Fl_Button*, void*) {
-  const char* c = fl_file_chooser("Folder", "*/", disk_input->value());
+  const char* c = fl_dir_chooser("Folder", disk_input->value());
 if (c) disk_input->value(c);
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xdiskusage-1.52/panels.fl 
new/xdiskusage-1.54/panels.fl
--- old/xdiskusage-1.52/panels.fl       2014-12-22 01:42:17.000000000 +0100
+++ new/xdiskusage-1.54/panels.fl       2020-12-04 05:09:25.000000000 +0100
@@ -36,7 +36,7 @@
     }
     Fl_Button {} {
       label browser
-      callback {const char* c = fl_file_chooser("Folder", "*/", 
disk_input->value());
+      callback {const char* c = fl_dir_chooser("Folder", disk_input->value());
 if (c) disk_input->value(c);}
       xywh {350 200 40 25} labelsize 8
       code0 {\#include <FL/Fl_File_Chooser.H>}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xdiskusage-1.52/xdiskusage.1 
new/xdiskusage-1.54/xdiskusage.1
--- old/xdiskusage-1.52/xdiskusage.1    2014-12-22 01:42:17.000000000 +0100
+++ new/xdiskusage-1.54/xdiskusage.1    2021-01-05 06:51:06.000000000 +0100
@@ -1,5 +1,5 @@
 .\"Man page for xdiskusage, by Bill Spitzak.
-.TH xdiskusage 1 "4 Sep 2014"
+.TH xdiskusage 1 "4 Jan 2021"
 .SH NAME
 \fIxdiskusage\fR - Graphical display of disk usage
 .SH SYNOPSIS
@@ -148,6 +148,9 @@
 PostScript.  It will either run it through lpr (or any command you
 choose) or send it to a file.
 
+.B Quit (q or Esc)
+Quit the application.
+
 .SH BUGS
 
 Gets confused by "df" output on some platforms, requiring
@@ -164,7 +167,7 @@
 
 .SH COPYRIGHT
 
-Copyright (C) 2014 Bill Spitzak
+Copyright (C) 2021 Bill Spitzak
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xdiskusage-1.52/xdiskusage.C 
new/xdiskusage-1.54/xdiskusage.C
--- old/xdiskusage-1.52/xdiskusage.C    2020-06-19 05:03:30.000000000 +0200
+++ new/xdiskusage-1.54/xdiskusage.C    2021-01-05 06:51:30.000000000 +0100
@@ -1,8 +1,8 @@
 // xdiskusage.C
 
 const char* copyright = 
-"xdiskusage version 1.52\n"
-"Copyright (C) 2014 Bill Spitzak\n"
+"xdiskusage version 1.54\n"
+"Copyright (C) 2021 Bill Spitzak\n"
 "Based on xdu by Phillip C. Dykstra\n"
 "\n"
 "This program is free software; you can redistribute it and/or modify "
@@ -20,6 +20,13 @@
 "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 "
 "USA.";
 
+#if defined _GNU_SOURCE || _POSIX_C_SOURCE >= 200809L
+#define HAVE_GETDELIM
+#define GETDELIM(a,b,c,d) getdelim(a,b,c,d)
+#else
+#define GETDELIM(a,b,c,d) getdelim_fallback(a,b,c,d)
+#endif
+
 #if defined(DF_COMMAND)
 // assumme DU_COMMAND is also defined
 #elif defined(__hpux)
@@ -35,8 +42,9 @@
 # define DF_COMMAND "/bin/df -k"
 # define DU_COMMAND "/bin/du -kd"
 #else // linux
+# define NULL_TERMS
 # define DF_COMMAND "df -k -x usbfs -x tmpfs"
-# define DU_COMMAND "du -kx"
+# define DU_COMMAND "du -0kx"
 #endif
 
 #include <stdio.h>
@@ -113,8 +121,8 @@
   }
   Disk** pointer = &firstdisk;
   for (;;) {
-    char buffer[1024];
-    if (!fgets(buffer, 1024, f)) break;
+    char buffer[2048];
+    if (!fgets(buffer, 2048, f)) break;
     int n = 0; // number of words
     char* word[10]; // pointer to each word
     for (char* p = buffer; n < 10;) {
@@ -253,6 +261,7 @@
   static void columns_cb(Fl_Widget* o, void*);
   static void copy_cb(Fl_Widget* o, void*);
   static void print_cb(Fl_Widget* o, void*);
+  static void quit_cb(Fl_Widget* o, void*);
   static Node* sort(Node* n, int (*compare)(const Node*, const Node*));
   static OutputWindow* make(const char*, Disk* = 0);
   static void print_file(OutputWindow* d, FILE *f, bool portrait, bool fill);
@@ -400,7 +409,7 @@
     brother->brother = n;
   } else {
     parent->child = n;
-  }    
+  }
   brother = n;
   return n;
 }
@@ -435,6 +444,7 @@
     {0},
   {"copy to clipboard", 'c', OutputWindow::copy_cb},
   {"print", 'p', OutputWindow::print_cb},
+  {"quit", 'q', OutputWindow::quit_cb},
   {0}
 };
 
@@ -442,15 +452,84 @@
   return (a->size > b->size) ? -1 : 1;
 }
 
+#ifndef HAVE_GETDELIM
+
+static ssize_t getdelim_fallback(char **lineptr, size_t *n, int delim, FILE 
*stream) {
+  char c;
+  char *buf;
+  size_t len = 0;
+  size_t buflen;
+
+  if (!lineptr || !n) {
+    errno = EINVAL;
+    return -1;
+  }
+
+  buf = *lineptr;
+  buflen = *n;
+
+  if (!(buf) && !(buflen)) {
+    buflen = 2048;
+    buf = (char*)malloc(buflen);
+    if (!buf) {
+      errno = ENOMEM;
+      return -1;
+    }
+  }
+
+  for (;;) {
+    c = (char)getc(stream);
+    if (c == EOF)
+      break;
+
+     buf[len] = c;
+
+    if (++len >= buflen) {
+      char *tmp;
+      buflen += 2048;
+      tmp = (char*)realloc((void*)buf,buflen);
+      if (!tmp) {
+        errno = EINVAL;
+        return -1;
+      }
+      buf = tmp;
+    }
+
+    if (c == (char)delim)
+      break;
+  }
+
+  buf[len] = '\0';
+
+  *lineptr = buf;
+  *n = buflen;
+
+  return len - 1;
+}
+#endif
+
+
 OutputWindow* OutputWindow::make(const char* path, Disk* disk) {
 
   cancelled = 0;
 
+  // If the platform supports it, this helps prevent
+  // difficult-to-understand errors in the event of filenames
+  // with newlines.
+  bool null_term = false;
+
   FILE* f;
   bool true_file;
-  char buffer[2048];
+  char *buffer;
+  size_t buffer_size = 2048;
   char pathbuf[1024];
 
+  buffer = (char*)malloc(buffer_size);
+  if (!buffer) {
+    alert("Error allocating memory for buffer!");
+    return 0;
+  }
+
   if (!path) {
     // it is a pipe
     true_file = true;
@@ -458,7 +537,7 @@
   } else {
     if (!disk) {
       // follow all symbolic links...
-      strncpy(pathbuf, path, 1024);
+      strncpy(pathbuf, path, 1023);
       for (int i=0; i<10; i++) {
        char *p = (char*)fl_filename_name(pathbuf);
        int j = readlink(pathbuf, p, 1024-(p-pathbuf));
@@ -477,7 +556,7 @@
       // we can figure out freespace.
       reload_cb(0,0);
       for (Disk* d=firstdisk; d; d=d->next) {
-        if(strcmp(d->mount, path) == 0) {
+        if (strcmp(d->mount, path) == 0) {
           disk = d;
           break;
         }
@@ -513,9 +592,11 @@
       sprintf(buffer, "du -k%c \"%s\"", all_files ? 'a' : ' ', path);
     else
 #endif
-      snprintf(buffer, 2048,
+      snprintf(buffer, buffer_size,
                DU_COMMAND"%c \"%s\"", all_files ? 'a' : ' ', path);
-    
+#ifdef NULL_TERMS
+    null_term = true;
+#endif
     f = popen(buffer,"r");
     if (!f) {
       alert("Problem running '%s' : %s", buffer, strerror(errno));
@@ -566,8 +647,8 @@
       return 0;
     }
 
-    // FIXME: don't limit line length to 2048
-    if (!fgets(buffer, 2048, f)) {
+    ssize_t len = 0;
+    if ((len = GETDELIM(&buffer, &buffer_size, null_term ? 0 : '\n', f)) == 
-1) {
       if (!runningtotal) {
        alert("%s: empty or bad file", path ? path : "stdin");
        cancelled = 1;
@@ -575,30 +656,18 @@
       }
       break;
     }
+    if (!null_term && len && buffer[len-1] == '\n') buffer[len-1] = 0;
 
-    // If the line was longer than the maximum, warn about it,
-    // and discard the line.
-    size_t len = strlen (buffer);
-    if (buffer[len-1] != '\n') {
-      fprintf (stderr, "%s:%u: line too long, skipping it\n",
-               path ? path : "stdin", (unsigned)line_no);
-      // Read until end of line or EOF.
-      while (1) {
-        char c = getc (f);
-        if (c == '\n' || c == EOF)
-          break;
-      }
-      continue;
-    }
-
-    // null-terminate the line:
-    char* p = buffer+len;
-    if (p > buffer && p[-1] == '\n') p[-1] = 0;
-
+    char* p;
     ull size = strtoull(buffer, &p, 10);
     if (!isspace(*p) || p == buffer) {
       if (!*p || *p=='#') continue; // ignore blank lines or comments (?)
-      alert("%s:%u: does not look like du output: %s",
+      if (true_file)
+        alert("%s:input line %u: does not look like du output: %s",
+            path ? path : "stdin", (unsigned)line_no, p);
+      else
+        alert("%s: line %u: does not look like du output: %s\n"
+              "Please run du manually and examine the output for 
irregularities.",
             path ? path : "stdin", (unsigned)line_no, p);
       cancelled = 1;
       continue;
@@ -670,7 +739,7 @@
   while (root->child && !root->size && !root->child->brother) {
     Node* child = root->child;
     if (root->name) {
-      char buffer[1024];
+      char buffer[2048];
       char* p = buffer;
       const char* q = root->name;
       while (*q) *p++ = *q++;
@@ -713,6 +782,8 @@
     }
   }
 
+  free((void*)buffer);
+
   root->size = runningtotal;
 
   OutputWindow* d = new OutputWindow(window_w, window_h, root->name);
@@ -939,7 +1010,7 @@
   if (n == current_root) return;
   current_root = n;
   root_depth = newdepth;
-  char buffer[1024];
+  char buffer[2048];
   buffer[0] = 0;
   char* p = buffer;
   for (int i = 0; i < root_depth; i++) {
@@ -958,7 +1029,7 @@
 
 void OutputWindow::copy_cb(Fl_Widget* o, void*) {
   OutputWindow* d = (OutputWindow*)(o->window());
-  char buffer[1024];
+  char buffer[2048];
   char* p = buffer;
   for (int i = 0; i < d->current_depth; i++) {
     const char* q = d->path[i]->name;
@@ -966,7 +1037,7 @@
     if (p[-1] != '/') *p++ = '/';
   }
   strcpy(p, d->current_node->name);
-  Fl::selection(*d, buffer, strlen(buffer));
+  Fl::copy(buffer, strlen(buffer), 2); // both clipboard & selection
 }
   
 OutputWindow::~OutputWindow() {
@@ -1226,4 +1297,8 @@
   fprintf(f,"showpage\npagelevel restore\n%%%%EOF\n");
 }
 
+void OutputWindow::quit_cb(Fl_Widget* o, void*) {
+  exit(EXIT_SUCCESS);
+}
+
 // End of xdiskusage.C
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xdiskusage-1.52/xdiskusage.spec 
new/xdiskusage-1.54/xdiskusage.spec
--- old/xdiskusage-1.52/xdiskusage.spec 2020-06-19 05:03:40.000000000 +0200
+++ new/xdiskusage-1.54/xdiskusage.spec 2021-01-05 06:48:32.000000000 +0100
@@ -6,7 +6,7 @@
 
 Summary:    Grapically displays the amount of disks used for by each 
subdirectory.
 Name:       xdiskusage
-Version:    1.52
+Version:    1.54
 Release:    1
 Source0:    http://xdiskusage.sourceforge.net/%{name}-%{version}.tgz
 Copyright:  GPL

Reply via email to