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

xterm: Changes to 'upstream-unstable'



 MANIFEST                 |    2 -
 THANKS                   |    6 ++-
 main.c                   |   48 ++++++++++++++++++++++++----
 misc.c                   |   60 +++++++++++++++++++++++++++--------
 package/debian/changelog |    6 +++
 package/freebsd/Makefile |    2 -
 package/xterm.spec       |    4 +-
 version.h                |    6 +--
 xterm.log.html           |   29 ++++++++++++++++-
 xterm.man                |   79 +++++++++++++++++++++++++++++++++--------------
 10 files changed, 190 insertions(+), 52 deletions(-)

New commits:
commit 95e6e9e31c13949dfaed09cedf61b6bdbbf97eb9
Author: Sven Joachim <svenjoac@gmx.de>
Date:   Fri Mar 7 17:49:03 2014 +0100

    Imported Upstream version 303

diff --git a/MANIFEST b/MANIFEST
index bc11abb..7cc89db 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,4 +1,4 @@
-MANIFEST for xterm-302, version xterm-302
+MANIFEST for xterm-303, version xterm-303
 --------------------------------------------------------------------------------
 MANIFEST                        this file
 256colres.h                     resource-definitions for 256-color mode
diff --git a/THANKS b/THANKS
index a38ebf9..1b83740 100644
--- a/THANKS
+++ b/THANKS
@@ -1,4 +1,4 @@
--- $XTermId: THANKS,v 1.11 2013/08/08 08:24:07 tom Exp $
+-- $XTermId: THANKS,v 1.12 2014/03/03 19:31:41 tom Exp $
 -- vile:txtmode fk=8bit
 There's no AUTHORS file in this distribution; it would be redundant since
 I (Thomas E. Dickey) have done more than 80% of the work on xterm since 1996.
@@ -13,6 +13,7 @@ Here's a list from xterm.log.html of people who have contributed changes.
 Adam M Costello
 Adam Sulmicki
 Ailin Nemui
+Al Poole
 Alan Coopersmith
 Alex Hornung
 Alexander Pohoyda
@@ -23,6 +24,7 @@ Andreas Schwab
 Andres Perera
 Andrew Sumner
 Andrew Tipton
+Andrey Panov
 Andries E Brouwer
 Anton Kovalenko
 Balazs Kezes
@@ -155,6 +157,7 @@ Rob Braun
 Robert Brady
 Robert Earl
 Robin Cutshaw
+Romain Francois
 Ross Combs
 Ross Paterson
 Ryan Johnson
@@ -184,6 +187,7 @@ Tomohiro Kubota
 Tor Lillqvist
 Torrey Lyons
 Victor Stinner
+Vincent Lefevre
 Werner Lemberg
 Will Day
 Zdenek Sekera
diff --git a/main.c b/main.c
index 6157068..c644e7a 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $XTermId: main.c,v 1.748 2014/03/03 01:15:27 tom Exp $ */
+/* $XTermId: main.c,v 1.751 2014/03/07 02:35:39 tom Exp $ */
 
 /*
  * Copyright 2002-2013,2014 by Thomas E. Dickey
@@ -1203,6 +1203,9 @@ static OptionHelp xtermOptions[] = {
 { "-/+rw",                 "turn on/off reverse wraparound" },
 { "-/+s",                  "turn on/off multiscroll" },
 { "-/+sb",                 "turn on/off scrollbar" },
+#if OPT_REPORT_COLORS
+{ "-report-colors",        "report colors as they are allocated" },
+#endif
 #if OPT_REPORT_FONTS
 { "-report-fonts",         "report fonts as loaded to stdout" },
 #endif
@@ -3149,9 +3152,37 @@ find_utmp(struct UTMP_STR *tofind)
 #define USE_NO_DEV_TTY 0
 #endif
 
+static int
+same_leaf(char *a, char *b)
+{
+    char *p = x_basename(a);
+    char *q = x_basename(b);
+    return !strcmp(p, q);
+}
+
+/*
+ * "good enough" (inode wouldn't port to Cygwin)
+ */
+static int
+same_file(const char *a, const char *b)
+{
+    struct stat asb;
+    struct stat bsb;
+    int result = 0;
+
+    if ((stat(a, &asb) == 0)
+	&& (stat(b, &bsb) == 0)
+	&& ((asb.st_mode & S_IFMT) == S_IFREG)
+	&& ((bsb.st_mode & S_IFMT) == S_IFREG)
+	&& (asb.st_mtime == bsb.st_mtime)
+	&& (asb.st_size == bsb.st_size)) {
+	result = 1;
+    }
+    return result;
+}
+
 /*
  * Only set $SHELL for paths found in the standard location.
- * ...or if $SHELL happens to give an absolute pathname to an executable.
  */
 static Boolean
 validShell(const char *pathname)
@@ -3179,6 +3210,9 @@ validShell(const char *pathname)
 			TRACE(("...test \"%s\"\n", q));
 			if (!strcmp(q, pathname)) {
 			    result = True;
+			} else if (same_leaf(q, (char *) pathname) &&
+				   same_file(q, pathname)) {
+			    result = True;
 			}
 			free(r);
 		    }
@@ -4577,7 +4611,7 @@ spawnXTerm(XtermWidget xw)
 	     * program rather than choosing between $SHELL and "/bin/sh".
 	     */
 	    if (validShell(explicit_shname)) {
-		xtermSetenv("SHELL", shell_path = explicit_shname);
+		xtermSetenv("SHELL", explicit_shname);
 	    } else if (validProgram(shell_path = x_getenv("SHELL"))) {
 		if (!validShell(shell_path)) {
 		    xtermUnsetenv("SHELL");
@@ -4595,11 +4629,13 @@ spawnXTerm(XtermWidget xw)
 	     * Set $XTERM_SHELL, which is not necessarily a valid shell, but
 	     * is executable.
 	     */
-	    if (explicit_shname != 0 && access(explicit_shname, X_OK) == 0) {
-		free(shell_path);
+	    if (validProgram(explicit_shname)) {
 		shell_path = explicit_shname;
-		xtermSetenv("XTERM_SHELL", shell_path);
+	    } else if (shell_path == 0) {
+		/* this could happen if the explicit shname lost a race */
+		shell_path = resetShell(shell_path);
 	    }
+	    xtermSetenv("XTERM_SHELL", shell_path);
 
 	    shname = x_basename(shell_path);
 	    TRACE(("shell path '%s' leaf '%s'\n", shell_path, shname));
diff --git a/misc.c b/misc.c
index c70e34c..658aa81 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
-/* $XTermId: misc.c,v 1.701 2014/03/03 01:19:15 tom Exp $ */
+/* $XTermId: misc.c,v 1.703 2014/03/07 01:43:32 tom Exp $ */
 
 /*
  * Copyright 1999-2013,2014 by Thomas E. Dickey
@@ -2180,6 +2180,20 @@ ReportAnsiColorRequest(XtermWidget xw, int colornum, int final)
 int
 getVisualInfo(XtermWidget xw)
 {
+#define MYFMT "getVisualInfo \
+depth %d, \
+type %d (%s), \
+size %d \
+rgb masks (%04lx/%04lx/%04lx)\n"
+#define MYARG \
+       vi->depth,\
+       vi->class,\
+       ((vi->class & 1) ? "dynamic" : "static"),\
+       vi->colormap_size,\
+       vi->red_mask,\
+       vi->green_mask,\
+       vi->blue_mask
+
     TScreen *screen = TScreenOf(xw);
     Display *dpy = screen->display;
     XVisualInfo myTemplate;
@@ -2191,21 +2205,16 @@ getVisualInfo(XtermWidget xw)
 				     &myTemplate, &xw->numVisuals);
 
 	if ((xw->visInfo != 0) && (xw->numVisuals > 0)) {
+	    XVisualInfo *vi = xw->visInfo;
 	    if (resource.reportColors) {
-		printf("getVisualInfo depth %d, type %d (%s), size %d\n",
-		       xw->visInfo->depth,
-		       xw->visInfo->class,
-		       ((xw->visInfo->class & 1) ? "dynamic" : "static"),
-		       xw->visInfo->colormap_size);
+		printf(MYFMT, MYARG);
 	    }
-	    TRACE(("getVisualInfo depth %d, type %d (%s), size %d\n",
-		   xw->visInfo->depth,
-		   xw->visInfo->class,
-		   ((xw->visInfo->class & 1) ? "dynamic" : "static"),
-		   xw->visInfo->colormap_size));
+	    TRACE((MYFMT, MYARG));
 	}
     }
     return (xw->visInfo != 0) && (xw->numVisuals > 0);
+#undef MYFMT
+#undef MYARG
 }
 
 static void
@@ -2409,8 +2418,25 @@ simpleColors(XColor * colortable, unsigned length)
     return state;
 }
 
+/*
+ * Shift the mask left or right to put its most significant bit at the 16-bit
+ * mark.
+ */
+static unsigned
+normalizeMask(unsigned mask)
+{
+    while (mask < 0x8000) {
+	mask <<= 1;
+    }
+    while (mask >= 0x10000) {
+	mask >>= 1;
+    }
+    return mask;
+}
+
 static unsigned
-searchColors(XColor * colortable, unsigned length, unsigned color, int state)
+searchColors(XColor * colortable, unsigned mask, unsigned length, unsigned
+	     color, int state)
 {
     unsigned result = 0;
     unsigned n;
@@ -2418,9 +2444,10 @@ searchColors(XColor * colortable, unsigned length, unsigned color, int state)
     unsigned long diff;
     unsigned value;
 
+    mask = normalizeMask(mask);
     for (n = 0; n < length; ++n) {
 	SelectColor(state, colortable[n], value);
-	diff = (color - value);
+	diff = ((color & mask) - (value & mask));
 	diff *= diff;
 	if (diff < best) {
 #if 0
@@ -2488,7 +2515,12 @@ allocateExactRGB(XtermWidget xw, Colormap cmap, XColor * def)
 
 	    if (loadColorTable(xw, cmap_size)
 		&& (state = simpleColors(screen->cmap_data, cmap_size)) > 0) {
-#define SearchColors(which) temp.which = (unsigned short) searchColors(screen->cmap_data, cmap_size, save.which, state)
+#define SearchColors(which) \
+	temp.which = (unsigned short) searchColors(screen->cmap_data, \
+						   (unsigned) xw->visInfo->which##_mask,\
+						   cmap_size, \
+						   save.which, \
+						   state)
 		SearchColors(red);
 		SearchColors(green);
 		SearchColors(blue);
diff --git a/package/debian/changelog b/package/debian/changelog
index b8c242e..5aa0daa 100644
--- a/package/debian/changelog
+++ b/package/debian/changelog
@@ -1,3 +1,9 @@
+xterm-dev (303) unstable; urgency=low
+
+  * maintenance updates
+
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Tue, 04 Mar 2014 17:46:25 -0500
+
 xterm-dev (302) unstable; urgency=low
 
   * maintenance updates
diff --git a/package/freebsd/Makefile b/package/freebsd/Makefile
index ba96789..2c519d1 100644
--- a/package/freebsd/Makefile
+++ b/package/freebsd/Makefile
@@ -5,7 +5,7 @@
 # and "make makesum".
 
 PORTNAME=	xterm
-PORTVERSION=	302
+PORTVERSION=	303
 CATEGORIES=	x11
 MASTER_SITES=	ftp://invisible-island.net/xterm/ \
 		CRITICAL
diff --git a/package/xterm.spec b/package/xterm.spec
index f18b6db..f4b9584 100644
--- a/package/xterm.spec
+++ b/package/xterm.spec
@@ -1,11 +1,11 @@
-# $XTermId: xterm.spec,v 1.65 2014/02/28 21:41:43 tom Exp $
+# $XTermId: xterm.spec,v 1.66 2014/03/04 22:46:25 tom Exp $
 Summary: X terminal emulator (development version)
 %global my_middle xterm
 %global my_suffix -dev
 %global fullname %{my_middle}%{my_suffix}
 %global my_class XTermDev
 Name: %{fullname}
-Version: 302
+Version: 303
 Release: 1
 License: X11
 Group: User Interface/X
diff --git a/version.h b/version.h
index 2e85746..6f6398d 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
-/* $XTermId: version.h,v 1.381 2014/03/03 01:57:01 tom Exp $ */
+/* $XTermId: version.h,v 1.383 2014/03/07 02:46:24 tom Exp $ */
 
 /*
  * Copyright 1998-2013,2014 by Thomas E. Dickey
@@ -38,8 +38,8 @@
  * version of X to which this version of xterm has been built.  The resulting
  * number in parentheses is my patch number (Thomas E. Dickey).
  */
-#define XTERM_PATCH   302
-#define XTERM_DATE    2014-03-02
+#define XTERM_PATCH   303
+#define XTERM_DATE    2014-03-06
 
 #ifndef __vendorversion__
 #define __vendorversion__ "XTerm"
diff --git a/xterm.log.html b/xterm.log.html
index 20b3254..580baf5 100644
--- a/xterm.log.html
+++ b/xterm.log.html
@@ -30,7 +30,7 @@
  * sale, use or other dealings in this Software without prior written        *
  * authorization.                                                            *
  *****************************************************************************
-  $XTermId: xterm.log.html,v 1.1435 2014/03/03 01:57:06 tom Exp $
+  $XTermId: xterm.log.html,v 1.1443 2014/03/07 02:47:00 tom Exp $
   -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
 
@@ -72,6 +72,8 @@
   CHANGELOG</a>).</p>
 
   <ul>
+    <li><a href="#xterm_303">Patch #303 - 2014/03/06</a></li>
+
     <li><a href="#xterm_302">Patch #302 - 2014/03/02</a></li>
 
     <li><a href="#xterm_301">Patch #301 - 2014/01/19</a></li>
@@ -889,6 +891,29 @@
     <li><a href="#xterm_01">Patch #1 - 1996/1/6</a></li>
   </ul>
 
+  <h1><a name="xterm_303" id="xterm_303">Patch #303 -
+  2014/03/06</a></h1>
+
+  <ul>
+    <li>improve check for <code>/etc/shells</code> to allow its
+    entries to be symbolic links.</li>
+
+    <li>fix a regression in <a href="#xterm_302">patch #302</a>
+    fixes relating to interaction of <code>SHELL</code> and
+    <code>XTERM_SHELL</code> variables (Debian #740919).</li>
+
+    <li>improve manpage discussion of use of
+    <code>/etc/shells</code> for validating the <code>SHELL</code>
+    environment variable.</li>
+
+    <li>further improve the approximation for color map by ignoring
+    bits which would not be applied by the rgb masks for the
+    current visual (report by Joe Peterson).</li>
+
+    <li>add <code>-report-colors</code> to usage-message (report by
+    Joe Peterson).</li>
+  </ul>
+
   <h1><a name="xterm_302" id="xterm_302">Patch #302 -
   2014/03/02</a></h1>
 
@@ -932,7 +957,7 @@
 
     <li>fix incorrect free from <a href="#xterm_301">patch #301</a>
     changes, if explicit program without <code>-e</code> option is
-    a valid shell (patch by Romain Francois).</li>
+    a valid shell (patch by Romain Francoise).</li>
   </ul>
 
   <h1><a name="xterm_301" id="xterm_301">Patch #301 -
diff --git a/xterm.man b/xterm.man
index ac21432..a171fb2 100644
--- a/xterm.man
+++ b/xterm.man
@@ -1,5 +1,5 @@
 '\" t
-.\" $XTermId: xterm.man,v 1.579 2014/03/02 12:06:08 tom Exp $
+.\" $XTermId: xterm.man,v 1.580 2014/03/07 00:40:43 tom Exp $
 .\"
 .\" Copyright 1996-2013,2014 by Thomas E. Dickey
 .\"
@@ -123,21 +123,29 @@ autorepeat.
 Double-size characters are displayed properly if your font server supports
 scalable fonts.
 The VT220 emulation does not support soft fonts, it is otherwise complete.
-.IR Termcap (5)
-entries that work with
-.I \*n
-include
+.PP
+Terminal database (\fIterminfo\fP (5) or \fItermcap\fP (5))
+entries that work with \fI\*n\fP include
+.IP
 an optional platform-specific entry (\*(``__default_termname__\*(''),
+.br
 \*(``xterm\*('',
+.br
 \*(``vt102\*('',
+.br
 \*(``vt100\*('',
+.br
 \*(``ansi\*('' and
-\*(``dumb\*(''.
-.I \*n
-automatically searches the termcap file in this order for these entries and then
+.br
+\*(``dumb\*(''
+.PP
+\fI\*N\fP automatically searches the
+terminal database in this order for these entries and then
 sets the \*(``TERM\*('' and the \*(``TERMCAP\*('' environment variables.
 You may also use \*(``vt220\*('',  but must set the terminal emulation level
 with the \fBdecTerminalID\fP resource.
+On most systems, \fI\*n\fP will use the terminfo database.
+Some older systems use termcap.
 (The \*(``TERMCAP\*('' environment variable is not set if \fI\*n\fP is linked
 against a terminfo library, since the requisite information is not provided
 by the termcap emulation of terminfo libraries).
@@ -200,11 +208,7 @@ When activated, the current screen is saved and replaced with the alternate
 screen.
 Saving of lines scrolled off the top of the window is disabled until the
 normal screen is restored.
-The
-.IR termcap (5)
-entry for
-.I \*n
-allows the visual editor
+The usual terminal description for \fI\*n\fP allows the visual editor
 .IR vi (1)
 to switch to the alternate screen for editing and to restore the screen
 on exit.
@@ -327,18 +331,29 @@ beginning with \*(``./\*('' or \*(``../\*('',
 In either case, this check fails
 if \fI\*n\fP cannot construct an absolute path.
 .bP
-If that check fails,
+If that check fails (or if no such parameter is given),
 \fI\*n\fP next checks the \*(``SHELL\*('' variable.
+If that specifies an executable file,
+\fI\*n\fP will attempt to start that.
+However, \fI\*n\fP additionally checks if it is a valid shell,
+and will unset \*(``SHELL\*('' if it is not.
 .bP
-If \*(``SHELL\*('' is not set,
+If \*(``SHELL\*('' is not set to an executable file,
 \fI\*n\fP tries to use the shell program specified
 in the user's password file entry.
+As before, \fI\*n\fP verifies if this is a valid shell.
 .bP
-Finally, if the password file entry does not specify a shell,
+Finally, if the password file entry does not specify a valid shell,
 \fI\*n\fP uses \fI/bin/sh\fP.
 .PP
 The \fB\-e\fP option cannot be used with this parameter since
 it uses all parameters following the option.
+.PP
+\fI\*N\fP validates shell programs by finding their pathname in
+the text file \fB/etc/shells\fP.
+It treats the environment variable \*(``SHELL\*('' specially because
+(like \*(``TERM\*(''), \fI\*n\fP both reads and updates the variable,
+and because the program started by \fI\*n\fP is not necessarily a shell.
 .\" ***************************************************************************
 .PP
 The other options are used to control the appearance and behavior.
@@ -1012,17 +1027,24 @@ This option indicates that \fI\*n\fP should start in Tektronix mode, rather
 than in VT102 mode.
 Switching between the two windows is done using the
 \*(``Options\*('' menus.
-.IR Termcap (5)
-entries that work with
-.I \*n
+.IP
+Terminal database (\fIterminfo\fP (5) or \fItermcap\fP (5))
+entries that work with \fI\*n\fR are:
+.IP
 \*(``tek4014\*('',
+.br
 \*(``tek4015\*('',
+.br
 \*(``tek4012\*('',
+.br
 \*(``tek4013\*('',
+.br
 \*(``tek4010\*('', and
+.br
 \*(``dumb\*(''.
+.IP
 .I \*n
-automatically searches the termcap file in this order for these entries and then
+automatically searches the terminal database in this order for these entries and then
 sets the \*(``TERM\*('' and the \*(``TERMCAP\*('' environment variables.
 .TP 8
 .B +t
@@ -6415,8 +6437,13 @@ is the display name,
 pointing to the X server (see \fBDISPLAY NAMES\fP in X(__miscmansuffix__)).
 .TP 5
 TERM
-is set according to the termcap (or terminfo) entry which it is using as
+is set according to the terminfo (or termcap) entry which it is using as
 a reference.
+.IP
+On some systems, you may encounter situations where the shell which you
+use and \fI\*n\fP are built using libraries with different terminal databases.
+In that situation, \fI\*n\fP may choose a terminal description not known
+to the shell.
 .TP 5
 WINDOWID
 is set to the X window id number of the \fI\*n\fP window.
@@ -6461,11 +6488,14 @@ when \fI\*n\fP is configured to update utmp.
 .TP 5
 SHELL
 when \fI\*n\fP is configured to update utmp.
-It is also set if you provide the shell name as the optional parameter.
+It is also set if you provide a valid shell name as the optional parameter.
 .IP
 \fI\*N\fP sets this to an absolute pathname.
 If you have set the variable to a relative pathname,
 \fI\*n\fP may set it to a different shell pathname.
+.IP
+If you have set this to an pathname which does not correspond to a valid
+shell, \fI\*n\fP may unset it, to avoid confusion.
 .TP 5
 TERMCAP
 the contents of the termcap entry corresponding to $TERM,
@@ -6480,6 +6510,11 @@ may be defined to a nonstandard location in the configure script.
 .SH FILES
 The actual pathnames given may differ on your system.
 .TP 5
+\fI/etc/shells\fP
+contains a list of valid shell programs,
+used by \fI\*n\fP to decide if the \*(``SHELL\*('' environment
+variable should be set for the process started by \fI\*n\fP.
+.TP 5
 \fI/etc/utmp\fP
 the system logfile, which records user logins.
 .TP 5


Reply to: