22177995 /dev/console and /dev/msglog redirection getting garbled in legacy locale on s11
authorravikuku<ravi.n.kumar@oracle.com>
Thu, 14 Jul 2016 02:12:08 -0700
changeset 1641 35beb75f273a
parent 1640 3f47e6c7568f
child 1642 004d92496882
22177995 /dev/console and /dev/msglog redirection getting garbled in legacy locale on s11
open-src/app/luit/22177995.patch
open-src/app/luit/Makefile
open-src/app/xterm/22177995.patch
open-src/app/xterm/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/luit/22177995.patch	Thu Jul 14 02:12:08 2016 -0700
@@ -0,0 +1,43 @@
+--- a/luit.c.orig	Fri Jun  3 00:19:19 2016
++++ b/luit.c	Wed Jul  6 23:43:47 2016
+@@ -30,6 +30,7 @@
+ #include <string.h>
+ #include <locale.h>
+ #include <sys/types.h>
++#include <sys/strredir.h>
+ #include <fcntl.h>
+ #include <unistd.h>
+ #include <errno.h>
+@@ -64,6 +65,7 @@
+ 
+ static volatile int sigwinch_queued = 0;
+ static volatile int sigchld_queued = 0;
++int Console = 0;
+ 
+ static int convert(int, int);
+ static int condom(int, char **);
+@@ -303,6 +305,9 @@
+ 		FatalError("-encoding requires an argument\n");
+ 	    locale_name = argv[i + 1];
+ 	    i += 2;
++	} else if (!strcmp(argv[i], "-C")) {
++	    Console = 1;
++	    i += 1;
+ 	} else if (!strcmp(argv[i], "-p")) {
+ 	    pipe_option = 1;
+ 	    i += 1;
+@@ -650,6 +655,14 @@
+ 	close_waitpipe(0);
+     }
+ 
++    if (Console) {
++	int consfd = open("/dev/console", O_RDONLY);
++	    if (consfd >= 0) {
++		 if (ioctl(consfd, SRIOCSREDIR, 0) != -1)
++		    close(consfd);
++	    }
++    }
++
+     execvp(path, argv);
+     perror("Couldn't exec");
+     ExitProgram(1);
--- a/open-src/app/luit/Makefile	Wed Jul 13 11:11:36 2016 -0700
+++ b/open-src/app/luit/Makefile	Thu Jul 14 02:12:08 2016 -0700
@@ -2,7 +2,7 @@
 #
 # luit - character set encoding filter for terminal emulators like xterm
 #
-# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -39,6 +39,7 @@
 # Patches to apply to source after unpacking, in order
 SOURCE_PATCHES += solaris-man.patch,-p1
 SOURCE_PATCHES += 6824625.patch,-p1
+SOURCE_PATCHES += 22177995.patch,-p1
 
 # Need to rebuild configure after patching configure.ac in remove-zlib.patch
 AUTORECONF=yes
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xterm/22177995.patch	Thu Jul 14 02:12:08 2016 -0700
@@ -0,0 +1,17 @@
+--- a/main.c.orig2	2016-06-03 00:19:39.914041433 -0700
++++ b/main.c	2016-07-07 23:44:11.858793092 -0700
+@@ -2441,6 +2441,14 @@
+ 	    SysError(ERROR_LUMALLOC);
+ 
+ 	x_appendargv(command_to_exec_with_luit, split_filter);
++	
++	if (Console) {
++	    char *encoding_opt1[2];
++	    int pos = 0;
++	    encoding_opt1[pos++] = "-C";
++	    encoding_opt1[pos] = 0;
++	    x_appendargv(command_to_exec_with_luit, encoding_opt1);
++	}
+ 	if (count_using) {
+ 	    char *encoding_opt[4];
+ 	    encoding_opt[0] = x_strdup("-encoding");
--- a/open-src/app/xterm/Makefile	Wed Jul 13 11:11:36 2016 -0700
+++ b/open-src/app/xterm/Makefile	Thu Jul 14 02:12:08 2016 -0700
@@ -71,6 +71,7 @@
 SOURCE_PATCHES = desktop-icon.patch,-p1
 SOURCE_PATCHES += solaris-ia.patch,-p1
 SOURCE_PATCHES += xpg-open.patch,-p1
+SOURCE_PATCHES += 22177995.patch,-p1
 
 # Man pages to apply Sun footer to & attributes to list
 SUNTOUCHED_MANPAGES=koi8rxterm.man resize.man uxterm.man xterm.man