bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-readline] readline - 7.0 for mingw64 and probably mingw32


From: J. Peter Mugaas
Subject: [Bug-readline] readline - 7.0 for mingw64 and probably mingw32
Date: Thu, 27 Oct 2016 22:28:28 -0400

I was compiling readline 7.0 on Windows 10 with MINGW-64 (the MSYS2
distribution).  In doing so, I had to adjust a patch they had and I thought
I would send it on to you so that it could be incorporated.

What they did was ifdef out the following:

Colors.c
S_ISUID
S_ISGID
S_ISLNK
S_ISSOCK

histfile.c
HAVE_CHOWN

The reason they probably did this was because those things probably do not
make any sense for native Win32/Win64 programs or they would be implemented
in different ways that would not correspond with what you did.

Between the "=", I have included the patch that I created for MSYS2's
distribution of mingw-w64
=====
--- readline-7.0/colors.c.orig  2016-01-25 10:38:00.000000000 -0500
+++ readline-7.0/colors.c       2016-10-27 15:53:42.182834700 -0400
@@ -37,6 +37,10 @@
 #include "posixstat.h" // stat related macros (S_ISREG, ...)
 #include <fcntl.h> // S_ISUID
 
+#ifndef S_ISDIR
+#define        S_ISDIR(m)      (((m) & S_IFMT) == S_IFDIR)
+#endif
+
 // strlen()
 #if defined (HAVE_STRING_H)
 #  include <string.h>
@@ -182,12 +186,17 @@
       if (S_ISREG (mode))
         {
           colored_filetype = C_FILE;
-
+#ifdef S_ISUID
           if ((mode & S_ISUID) != 0 && is_colored (C_SETUID))
             colored_filetype = C_SETUID;
-          else if ((mode & S_ISGID) != 0 && is_colored (C_SETGID))
+               else
+#endif
+#ifdef S_ISGID
+          if ((mode & S_ISGID) != 0 && is_colored (C_SETGID))
             colored_filetype = C_SETGID;
-          else if (is_colored (C_CAP) && 0) //f->has_capability)
+          else
+#endif
+                 if (is_colored (C_CAP) && 0) //f->has_capability)
             colored_filetype = C_CAP;
           else if ((mode & S_IXUGO) != 0 && is_colored (C_EXEC))
             colored_filetype = C_EXEC;
@@ -211,12 +220,16 @@
             colored_filetype = C_STICKY;
 #endif
         }
+#if defined (S_ISLNK)
       else if (S_ISLNK (mode))
         colored_filetype = C_LINK;
+#endif
       else if (S_ISFIFO (mode))
         colored_filetype = C_FIFO;
+#if defined (S_ISSOCK)
       else if (S_ISSOCK (mode))
         colored_filetype = C_SOCK;
+#endif
       else if (S_ISBLK (mode))
         colored_filetype = C_BLK;
       else if (S_ISCHR (mode))

--- readline-7.0/histfile.c.orig        2016-10-27 16:31:45.300161000 -0400
+++ readline-7.0/histfile.c     2016-10-27 16:54:31.600897400 -0400
@@ -606,12 +606,14 @@
       history_lines_written_to_file = 0;
     }
 
+#if defined (HAVE_CHOWN)
   /* Make sure the new filename is owned by the same user as the old.  If
one
      user is running this, it's a no-op.  If the shell is running after
sudo
      with a shared history file, we don't want to leave the history file
      owned by root. */
   if (rv == 0 && exists)
     r = chown (filename, finfo.st_uid, finfo.st_gid);
+#endif
 
   xfree (filename);
   FREE (tempname);
@@ -753,12 +755,14 @@
       history_lines_written_to_file = 0;
     }
 
+#if defined (HAVE_CHOWN)
   /* Make sure the new filename is owned by the same user as the old.  If
one
      user is running this, it's a no-op.  If the shell is running after
sudo
      with a shared history file, we don't want to leave the history file
      owned by root. */
   if (rv == 0 && exists)
     mode = chown (histname, finfo.st_uid, finfo.st_gid);
+#endif
 
   FREE (histname);
   FREE (tempname);
=====




reply via email to

[Prev in Thread] Current Thread [Next in Thread]