public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
* [cygutils - Chuck Wilson's collection of Cygwin utilities] branch master, updated. v1_4_16-12-ga804501
@ 2022-01-28  9:09 Mark Geisert
  0 siblings, 0 replies; only message in thread
From: Mark Geisert @ 2022-01-28  9:09 UTC (permalink / raw)
  To: cygwin-apps-cvs




https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/cygutils.git;h=a804501b8c33c55a45a87b6e505b4e5db41e4f2f

commit a804501b8c33c55a45a87b6e505b4e5db41e4f2f
Author: Mark Geisert <mark@maxrnd.com>
Date:   Fri Jan 28 01:07:45 2022 -0800

    Fold in latest clip fixes


Diff:
---
 BRANCHES           |  2 ++
 ChangeLog          | 22 +++++++++++++++++++---
 NEWS               |  3 +++
 configure.ac       |  2 +-
 cygutils.cygport   |  4 ++--
 src/clip/getclip.c |  8 ++++++--
 src/clip/putclip.c | 26 +++++++++++++++++++++-----
 7 files changed, 54 insertions(+), 13 deletions(-)

diff --git a/BRANCHES b/BRANCHES
index 753f632..f0a432c 100644
--- a/BRANCHES
+++ b/BRANCHES
@@ -104,3 +104,5 @@ v1_4_14
 v1_4_15
    |
 v1_4_16
+   |
+v1_4_17
diff --git a/ChangeLog b/ChangeLog
index 98e8d40..0a1709c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,26 @@
+2022-01-28  Mark Geisert  <mark@maxrnd.com>
+
+	Release 1.4.17
+	* configure.ac: Bump version number to 1.4.17.
+	* BRANCHES: Ditto.
+	* cygutils.cygport: Ditto.
+	* src/clip/getclip.c: Fix segfault on xterm selections. Thanks to
+	Denis Excoffier for the report, Brian Inglis, Andrey Repin, and Jon
+	Turney for the discussion.
+	* src/clip/putclip.c: Add missing 32/64 timespec expansion. Thanks to
+	Takashi Yano for the report and investigation.
+	* src/clip/putclip.c: Make sure allocated buf is large enough to
+	append a NUL character. Thanks to Marco Atzeri for the report.
+	* src/clip/putclip.c: Add debugging feature to allow a file name in
+	argv (undocumented).
+
 2021-11-03  Mark Geisert  <mark@maxrnd.com>  (1.4.16-8)
 
 	* src/clip/{get,put}clip.c: Replace use of Windows UTF-8 conversion
 	functions with corresponding POSIX functions. MultiByteToWideChar->
 	mbstowcs, WideCharToMultiByte->wcstombs. Thanks to Takashi Yano.
-	* src/putclip.c: Have putclip open the clipboard just once instead
-	of multiple times for multiple formats. Thanks to Takashi Yano.
+	* src/clip/putclip.c: Have putclip open the clipboard just once
+	instead of multiple times for multiple formats. Thanks to Takashi Yano.
 
 2021-09-23  Mark Geisert  <mark@maxrnd.com>  (1.4.16-7)
 
@@ -32,7 +48,7 @@
 	didn't make it into the released -3 package.  Thank you Takashi Yano.
 	* Fix maintainer build environment issues that caused cygstart crash
 	on non-AVX user systems: Thank you Takashi Yano, Brian Inglis, Achim
-	Gratz and user Jay Abel for reporting the issue.
+	Gratz, and user Jay Abel for reporting the issue.
 	* src/cygdrop/cygdrop.cc: Fix crash with recent gcc and fix printf
 	format strings. Thank you Christian Franke.
 
diff --git a/NEWS b/NEWS
index f1cedc0..3b42b62 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+1.4.17
+  * More bug fixes to getclip and putclip.
+
 1.4.16
   * Unicode support added to mkshortcut and readshortcut by Thomas Wolff.
   * Minor formatting fixes to quash compiler warnings.
diff --git a/configure.ac b/configure.ac
index 830f1bf..ce5b38a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 # Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.69)
-AC_INIT(cygutils, 1.4.16, cygwin@cygwin.com)
+AC_INIT(cygutils, 1.4.17, cygwin@cygwin.com)
 AC_CONFIG_SRCDIR([config.h.in])
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_MACRO_DIR([m4])
diff --git a/cygutils.cygport b/cygutils.cygport
index d2ca1f5..9898b51 100644
--- a/cygutils.cygport
+++ b/cygutils.cygport
@@ -1,6 +1,6 @@
 NAME=cygutils
-VERSION=1.4.16
-RELEASE=7
+VERSION=1.4.17
+RELEASE=1
 
 SUMM="A collection of simple utilities"
 DESC="A collection of simple (single source file) utilities, including"
diff --git a/src/clip/getclip.c b/src/clip/getclip.c
index 4dbaa97..4f422d9 100644
--- a/src/clip/getclip.c
+++ b/src/clip/getclip.c
@@ -479,7 +479,9 @@ getclip (FILE * out, flags_struct flags, FILE * f, char *name)
       char *prev;
       char *curr;
       char *pos;
+#if DEBUGGING
       UINT format;
+#endif
 
       OpenClipboard (0);
 #if DEBUGGING
@@ -505,7 +507,7 @@ getclip (FILE * out, flags_struct flags, FILE * f, char *name)
           DWORD err = GetLastError ();
 #if DEBUGGING
           /* look up error code displayed here in w32api/winerror.h */
-          fprintf (stderr, "GetClipboardData returns %ld\n", err);
+          fprintf (stderr, "GetClipboardData returns %d\n", err);
 #endif
           CloseClipboard ();
           return err != 0;
@@ -563,7 +565,9 @@ getclip (FILE * out, flags_struct flags, FILE * f, char *name)
       char *prev;
       char *curr;
       char *pos;
+#if DEBUGGING
       UINT format;
+#endif
 
       OpenClipboard (0);
 #if DEBUGGING
@@ -589,7 +593,7 @@ getclip (FILE * out, flags_struct flags, FILE * f, char *name)
           DWORD err = GetLastError ();
 #if DEBUGGING
           /* look up error code displayed here in w32api/winerror.h */
-          fprintf (stderr, "GetClipboardData returns %ld\n", err);
+          fprintf (stderr, "GetClipboardData returns %d\n", err);
 #endif
           CloseClipboard ();
           return err != 0;
diff --git a/src/clip/putclip.c b/src/clip/putclip.c
index fb54416..ff0e4b8 100644
--- a/src/clip/putclip.c
+++ b/src/clip/putclip.c
@@ -203,9 +203,21 @@ main (int argc, const char **argv)
 
   setlocale (LC_ALL, "");
   if (rest == NULL)
+#if DEBUGGING
+ready:
+#endif
     ec |= putclip (stdin, flags, stderr, program_name);
   else
     {
+#if DEBUGGING
+      // undocumented debugging feature: read stdin from file named in argv
+      if (isalpha (**rest))
+        {
+          FILE *tmpin = freopen (*rest, "rb", stdin);
+          if (tmpin == stdin && !*(rest + 1))
+            goto ready;
+        }
+#endif
       fprintf (stderr, "Extra args ignored: ");
       while (*rest)
         fprintf (stderr, "%s ", *rest++);
@@ -409,6 +421,10 @@ putclip (FILE * in, flags_struct flags, FILE * f, char *name)
     {
       UINT cygnativeformat;
 
+      // make sure buf and copies of it have space for a NUL to be appended
+      // DO NOT CHANGE len TO ACCOUNT FOR THIS
+      buf = realloc (buf, len + 1);
+
       // if flags.endl_mode == ENDLMODE_NOCONV
       convbuf = buf;
       convlen = len;
@@ -530,7 +546,7 @@ putclip (FILE * in, flags_struct flags, FILE * f, char *name)
 #if DEBUGGING
           DWORD err = GetLastError ();
           /* look up error code displayed here in w32api/winerror.h */
-          fprintf (stderr, "OpenClipboard returns %ld\n", err);
+          fprintf (stderr, "OpenClipboard returns %d\n", err);
 #endif
           goto failout2;
         }
@@ -573,7 +589,7 @@ putclip (FILE * in, flags_struct flags, FILE * f, char *name)
           clipbufX->cb_sec  = clipbufX->ts.tv_sec;
 #endif
           clipbufX->cb_size = convlen;
-          memcpy (&clipbufX[1], convbuf, convlen);
+          memcpy (((char *) clipbufX) + sizeof (cygcb_t), convbuf, convlen);
         }
       else if (cygNewFormat == 1)
         {
@@ -597,7 +613,7 @@ putclip (FILE * in, flags_struct flags, FILE * f, char *name)
 #if DEBUGGING
           DWORD err = GetLastError ();
           /* look up error code displayed here in w32api/winerror.h */
-          fprintf (stderr, "SetClipboardData returns %ld\n", err);
+          fprintf (stderr, "SetClipboardData returns %d\n", err);
 #endif
           goto failout;
         }
@@ -647,7 +663,7 @@ putclip (FILE * in, flags_struct flags, FILE * f, char *name)
 #if DEBUGGING
           DWORD err = GetLastError ();
           /* look up error code displayed here in w32api/winerror.h */
-          fprintf (stderr, "SetClipboardData returns %ld\n", err);
+          fprintf (stderr, "SetClipboardData returns %d\n", err);
 #endif
           goto failout;
         }
@@ -685,7 +701,7 @@ putclip (FILE * in, flags_struct flags, FILE * f, char *name)
 #if DEBUGGING
           DWORD err = GetLastError ();
           /* look up error code displayed here in w32api/winerror.h */
-          fprintf (stderr, "SetClipboardData returns %ld\n", err);
+          fprintf (stderr, "SetClipboardData returns %d\n", err);
 #endif
           goto failout;
         }



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-28  9:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-28  9:09 [cygutils - Chuck Wilson's collection of Cygwin utilities] branch master, updated. v1_4_16-12-ga804501 Mark Geisert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).