15810316 problem in UTILITY/EMACS
authorAli Bahrami <Ali.Bahrami@Oracle.COM>
Thu, 07 Feb 2013 15:54:53 -0700
changeset 1147 6095231b2f75
parent 1146 94088715b2bf
child 1148 f165f5ee8976
15810316 problem in UTILITY/EMACS 16171813 emacs rgrep assumes gnu find in path; fails using GNU-specific options 16246357 emacs -nw hangs on startup starting with s12_14
components/emacs/README
components/emacs/gnu-emacs.p5m
components/emacs/patches/eval_file_local_var.patch
components/emacs/patches/find.patch
components/emacs/patches/tty_startup_hang.patch
--- a/components/emacs/README	Thu Feb 07 08:47:14 2013 -0800
+++ b/components/emacs/README	Thu Feb 07 15:54:53 2013 -0700
@@ -18,7 +18,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
 #
 
 NAME:             emacs
@@ -37,17 +37,40 @@
 - We patch the following changes to the emacs sources:
 
 	sysmalloc.patch
-	    Use the system malloc instead of the built in one
+	    Use the system malloc instead of the built in one.
 
 	dldump.patch
 	    Use the native Solaris dldump() function (emacs/src/unexsol.c)
 	    to produce the dumped emacs, rather than the generic ELF
-	    code (emacs-22.1/src/unexelf.c).
+	    code (emacs-xxx/src/unexelf.c).
 
 	xft.patch
 	    Patch configure script to provide necessary missing
 	    libraries for the GTK version of emacs.
 
+	eval_file_local_var.patch
+	    When the Emacs user option `enable-local-variables' is set to
+	    `:safe' (the default value is t), Emacs should automatically refuse
+	    to evaluate `eval' forms in file-local variable sections. See:
+
+		http://www.openwall.com/lists/oss-security/2012/08/13/1
+		http://www.openwall.com/lists/oss-security/2012/08/13/2
+
+	find.patch
+	    The rgrep function uses the GNU-specific -path option to the
+	    find command. Change the default value for the find-program
+	    variable in grep.el to use GNU find.
+
+	tty_startup_hang.patch
+	    Emacs 23.x has a latent bug that causes it to run the X11 input
+	    select code even when running without a window system via the
+	    -nw option. This worked because a variable in libglib.so used
+	    to be zero, but in newer versions of libglib.so it is not. The
+	    result is that 'emacs -nw' hangs on startup and has to be killed
+	    from another shell. This is fixed in eamcs 24.2. See:
+
+		http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9754
+
 - Emacs can be built as either 32-bit or 64-bit, depending on the target
   machine. The benefit of a 64-bit emacs is that the size of the files it
   can handle is not limited to 128MB, as it is with the 32-bit version.
--- a/components/emacs/gnu-emacs.p5m	Thu Feb 07 08:47:14 2013 -0800
+++ b/components/emacs/gnu-emacs.p5m	Thu Feb 07 15:54:53 2013 -0700
@@ -18,7 +18,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
 #
 <transform file path=usr.*/man/.+ -> default mangler.man.stability uncommitted>
 
@@ -2520,3 +2520,8 @@
 	fmri=pkg:/editor/gnu-emacs/gnu-emacs-gtk \
 	fmri=pkg:/editor/gnu-emacs/gnu-emacs-x11 \
 	fmri=pkg:/editor/gnu-emacs/gnu-emacs-no-x11
+
+# The rgrep command uses GNU-find specific options, so we patch Solaris emacs
+# to use GNU find. As this functionality is relatively core, ensure that
+# installing emacs also brings in the package containing GNU find.
+depend type=require fmri=__TBD pkg.debug.depend.file=usr/gnu/bin/find 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/emacs/patches/eval_file_local_var.patch	Thu Feb 07 15:54:53 2013 -0700
@@ -0,0 +1,32 @@
+*** emacs-23.4.orig/lisp/files.el	Wed Jan 11 05:35:01 2012
+--- emacs-23.4/lisp/files.el	Fri Feb  1 13:21:50 2013
+***************
+*** 2986,2996 ****
+  	      ;; Obey `enable-local-eval'.
+  	      ((eq var 'eval)
+  	       (when enable-local-eval
+! 		 (push elt all-vars)
+! 		 (or (eq enable-local-eval t)
+! 		     (hack-one-local-variable-eval-safep (eval (quote val)))
+! 		     (safe-local-variable-p var val)
+! 		     (push elt unsafe-vars))))
+  	      ;; Ignore duplicates (except `mode') in the present list.
+  	      ((and (assq var all-vars) (not (eq var 'mode))) nil)
+  	      ;; Accept known-safe variables.
+--- 2986,3001 ----
+  	      ;; Obey `enable-local-eval'.
+  	      ((eq var 'eval)
+  	       (when enable-local-eval
+! 		 (let ((safe (or (hack-one-local-variable-eval-safep
+! 				  (eval (quote val)))
+! 				 ;; In case previously marked safe (bug#5636).
+! 				 (safe-local-variable-p var val))))
+! 		   ;; If not safe and e-l-v = :safe, ignore totally.
+! 		   (when (or safe (not (eq enable-local-variables :safe)))
+! 		     (push elt all-vars)
+! 		     (or (eq enable-local-eval t)
+! 			 safe
+! 			 (push elt unsafe-vars))))))
+  	      ;; Ignore duplicates (except `mode') in the present list.
+  	      ((and (assq var all-vars) (not (eq var 'mode))) nil)
+  	      ;; Accept known-safe variables.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/emacs/patches/find.patch	Thu Feb 07 15:54:53 2013 -0700
@@ -0,0 +1,20 @@
+*** emacs-23.4.orig/lisp/progmodes/grep.el	Wed Jan 11 05:35:01 2012
+--- emacs-23.4/lisp/progmodes/grep.el	Fri Feb  1 11:01:11 2013
+***************
+*** 421,427 ****
+  This variable's value takes effect when `grep-compute-defaults' is called.")
+  
+  ;;;###autoload
+! (defvar find-program (purecopy "find")
+    "The default find program for `grep-find-command'.
+  This variable's value takes effect when `grep-compute-defaults' is called.")
+  
+--- 421,428 ----
+  This variable's value takes effect when `grep-compute-defaults' is called.")
+  
+  ;;;###autoload
+! ;;Change from find to GNU find for Solaris, as emacs uses GNU-specific options
+! (defvar find-program (purecopy "/usr/gnu/bin/find")
+    "The default find program for `grep-find-command'.
+  This variable's value takes effect when `grep-compute-defaults' is called.")
+  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/emacs/patches/tty_startup_hang.patch	Thu Feb 07 15:54:53 2013 -0700
@@ -0,0 +1,45 @@
+*** emacs-23.4.orig/src/lisp.h	Wed Jan 11 05:35:01 2012
+--- emacs-23.4/src/lisp.h	Fri Feb  1 11:12:55 2013
+***************
+*** 3435,3440 ****
+--- 3435,3441 ----
+  #ifdef HAVE_X_WINDOWS
+  /* Defined in xfns.c */
+  extern void syms_of_xfns P_ ((void));
++ extern int x_in_use;
+  
+  /* Defined in xsmfns.c */
+  extern void syms_of_xsmfns P_ ((void));
+*** emacs-23.4.orig/src/xfns.c	Wed Jan 11 05:35:01 2012
+--- emacs-23.4/src/xfns.c	Fri Feb  1 11:13:27 2013
+***************
+*** 183,189 ****
+  
+  /* Nonzero if using X.  */
+  
+! static int x_in_use;
+  
+  /* Non nil if no window manager is in use.  */
+  
+--- 183,189 ----
+  
+  /* Nonzero if using X.  */
+  
+! int x_in_use;
+  
+  /* Non nil if no window manager is in use.  */
+  
+*** emacs-23.4.orig/src/xgselect.c	Wed Jan 11 05:35:01 2012
+--- emacs-23.4/src/xgselect.c	Fri Feb  1 11:13:54 2013
+***************
+*** 44,49 ****
+--- 44,52 ----
+    int n_gfds = 0, our_tmo = 0, retval = 0, our_fds = 0;
+    int prio, i, nfds, tmo_in_millisec;
+  
++   if (!x_in_use)
++     return select (max_fds, rfds, wfds, efds, timeout);
++ 
+    if (rfds) memcpy (&all_rfds, rfds, sizeof (all_rfds));
+    else FD_ZERO (&all_rfds);
+    if (wfds) memcpy (&all_wfds, wfds, sizeof (all_rfds));