diff --git a/SOURCES/emacs-0012-New-verify-error-GnuTLS-interface-for-certificate-va.patch b/SOURCES/emacs-0012-New-verify-error-GnuTLS-interface-for-certificate-va.patch new file mode 100644 index 0000000..8fe5667 --- /dev/null +++ b/SOURCES/emacs-0012-New-verify-error-GnuTLS-interface-for-certificate-va.patch @@ -0,0 +1,300 @@ +From 59fd52bfdd7e4a763b5d950ee2213b3bb1e69916 Mon Sep 17 00:00:00 2001 +From: Jan Synacek +Date: Tue, 11 Sep 2018 13:03:56 +0200 +Subject: [PATCH 1/2] New verify-error GnuTLS interface for certificate + validation + +* net/gnutls.el (gnutls-verify-error): New defcustom to control +the behavior when a certificate fails validation. Defaults to +old behavior: never abort, just warn. +(gnutls-negotiate): Use it. + +* gnutls.c: Replace `:verify_hostname_error' with `:verify_error', +now a list of certificate validation checks that will abort a +connection with an error. +(Fgnutls_boot): Document it and use it. + +(cherry-picked from commit 31b4827ea9ba8d22deb17c0593f0f555a33e1fa4) + +jsynacek: gnutls-verify-error defaults to t in RHEL-7. + +Resolves: #1403643 +--- + lisp/net/gnutls.el | 67 ++++++++++++++++++++++++++++++++++++++++------------ + src/bootstrap-emacs | Bin 25556936 -> 0 bytes + src/emacs | Bin 25556936 -> 0 bytes + src/fns.c | 22 ++++++++++++++++- + src/gnutls.c | 48 +++++++++++++++++++++++-------------- + src/temacs | Bin 15992560 -> 0 bytes + 6 files changed, 103 insertions(+), 34 deletions(-) + delete mode 100755 src/bootstrap-emacs + delete mode 100755 src/emacs + delete mode 100755 src/temacs + +diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el +index 243c64e..2585f48 100644 +--- a/lisp/net/gnutls.el ++++ b/lisp/net/gnutls.el +@@ -51,6 +51,19 @@ set this variable to \"normal:-dhe-rsa\"." + :type '(choice (const nil) + string)) + ++(defcustom gnutls-verify-error t ++ "If non-nil, this should be a list of checks per hostname regex or t." ++ :group 'gnutls ++ :type '(choice ++ (const t) ++ (repeat :tag "List of hostname regexps with flags for each" ++ (list ++ (choice :tag "Hostname" ++ (const ".*" :tag "Any hostname") ++ regexp) ++ (set (const :trustfiles) ++ (const :hostname)))))) ++ + (defcustom gnutls-trustfiles + '( + "/etc/ssl/certs/ca-certificates.crt" ; Debian, Ubuntu, Gentoo and Arch Linux +@@ -141,19 +154,25 @@ MIN-PRIME-BITS is the minimum acceptable size of Diffie-Hellman keys + \(see `gnutls-min-prime-bits' for more information). Use nil for the + default. + +-When VERIFY-HOSTNAME-ERROR is not nil, an error will be raised +-when the hostname does not match the presented certificate's host +-name. The exact verification algorithm is a basic implementation +-of the matching described in RFC2818 (HTTPS), which takes into +-account wildcards, and the DNSName/IPAddress subject alternative +-name PKIX extension. See GnuTLS' gnutls_x509_crt_check_hostname +-for details. When VERIFY-HOSTNAME-ERROR is nil, only a warning +-will be issued. ++VERIFY-HOSTNAME-ERROR is a backwards compatibility option for ++putting `:hostname' in VERIFY-ERROR. ++ ++When VERIFY-ERROR is t or a list containing `:trustfiles', an ++error will be raised when the peer certificate verification fails ++as per GnuTLS' gnutls_certificate_verify_peers2. Otherwise, only ++warnings will be shown about the verification failure. + +-When VERIFY-ERROR is not nil, an error will be raised when the +-peer certificate verification fails as per GnuTLS' +-gnutls_certificate_verify_peers2. Otherwise, only warnings will +-be shown about the verification failure. ++When VERIFY-ERROR is t or a list containing `:hostname', an error ++will be raised when the hostname does not match the presented ++certificate's host name. The exact verification algorithm is a ++basic implementation of the matching described in ++RFC2818 (HTTPS), which takes into account wildcards, and the ++DNSName/IPAddress subject alternative name PKIX extension. See ++GnuTLS' gnutls_x509_crt_check_hostname for details. Otherwise, ++only a warning will be issued. ++ ++Note that the list in `gnutls-verify-error', matched against the ++HOSTNAME, is the default VERIFY-ERROR. + + VERIFY-FLAGS is a numeric OR of verification flags only for + `gnutls-x509pki' connections. See GnuTLS' x509.h for details; +@@ -186,8 +205,28 @@ defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT." + (if gnutls-algorithm-priority + (upcase gnutls-algorithm-priority) + "NORMAL"))))) ++ (verify-error (or verify-error ++ ;; this uses the value of `gnutls-verify-error' ++ (cond ++ ;; if t, pass it on ++ ((eq gnutls-verify-error t) ++ t) ++ ;; if a list, look for hostname matches ++ ((listp gnutls-verify-error) ++ (mapcan ++ (lambda (check) ++ (when (string-match (car check) hostname) ++ (cdr check))) ++ gnutls-verify-error)) ++ ;; else it's nil ++ (t nil)))) + (min-prime-bits (or min-prime-bits gnutls-min-prime-bits)) +- (params `(:priority ,priority-string ++ params ret) ++ ++ (when verify-hostname-error ++ (push :hostname verify-error)) ++ ++ (setq params `(:priority ,priority-string + :hostname ,hostname + :loglevel ,gnutls-log-level + :min-prime-bits ,min-prime-bits +@@ -196,9 +235,7 @@ defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT." + :keylist ,keylist + :verify-flags ,verify-flags + :verify-error ,verify-error +- :verify-hostname-error ,verify-hostname-error + :callbacks nil)) +- ret) + + (gnutls-message-maybe + (setq ret (gnutls-boot process type params)) +diff --git a/src/fns.c b/src/fns.c +index fbb3fb5..2a417ff 100644 +--- a/src/fns.c ++++ b/src/fns.c +@@ -2252,7 +2252,7 @@ usage: (nconc &rest LISTS) */) + storing the results into elements of VALS, a C vector of Lisp_Objects. + LENI is the length of VALS, which should also be the length of SEQ. */ + +-static void ++static EMACS_INT + mapcar1 (EMACS_INT leni, Lisp_Object *vals, Lisp_Object fn, Lisp_Object seq) + { + register Lisp_Object tail; +@@ -2326,6 +2326,7 @@ mapcar1 (EMACS_INT leni, Lisp_Object *vals, Lisp_Object fn, Lisp_Object seq) + } + + UNGCPRO; ++ return leni; + } + + DEFUN ("mapconcat", Fmapconcat, Smapconcat, 3, 3, 0, +@@ -2411,6 +2412,24 @@ SEQUENCE may be a list, a vector, a bool-vector, or a string. */) + + return sequence; + } ++ ++DEFUN ("mapcan", Fmapcan, Smapcan, 2, 2, 0, ++ doc: /* Apply FUNCTION to each element of SEQUENCE, and concatenate ++the results by altering them (using `nconc'). ++SEQUENCE may be a list, a vector, a bool-vector, or a string. */) ++ (Lisp_Object function, Lisp_Object sequence) ++{ ++ USE_SAFE_ALLOCA; ++ EMACS_INT leni = XFASTINT (Flength (sequence)); ++ if (CHAR_TABLE_P (sequence)) ++ wrong_type_argument (Qlistp, sequence); ++ Lisp_Object *args; ++ SAFE_ALLOCA_LISP (args, leni); ++ ptrdiff_t nmapped = mapcar1 (leni, args, function, sequence); ++ Lisp_Object ret = Fnconc (nmapped, args); ++ SAFE_FREE (); ++ return ret; ++} + + /* This is how C code calls `yes-or-no-p' and allows the user + to redefined it. +@@ -4984,6 +5003,7 @@ this variable. */); + defsubr (&Snconc); + defsubr (&Smapcar); + defsubr (&Smapc); ++ defsubr (&Smapcan); + defsubr (&Smapconcat); + defsubr (&Syes_or_no_p); + defsubr (&Sload_average); +diff --git a/src/gnutls.c b/src/gnutls.c +index 57d9e17..0c4d10b 100644 +--- a/src/gnutls.c ++++ b/src/gnutls.c +@@ -49,7 +49,7 @@ static Lisp_Object QCgnutls_bootprop_loglevel; + static Lisp_Object QCgnutls_bootprop_hostname; + static Lisp_Object QCgnutls_bootprop_min_prime_bits; + static Lisp_Object QCgnutls_bootprop_verify_flags; +-static Lisp_Object QCgnutls_bootprop_verify_hostname_error; ++static Lisp_Object QCgnutls_bootprop_verify_error; + + /* Callback keys for `gnutls-boot'. Unused currently. */ + static Lisp_Object QCgnutls_bootprop_callbacks_verify; +@@ -729,8 +729,12 @@ certificates for `gnutls-x509pki'. + :verify-flags is a bitset as per GnuTLS' + gnutls_certificate_set_verify_flags. + +-:verify-hostname-error, if non-nil, makes a hostname mismatch an +-error. Otherwise it will be just a warning. ++:verify-hostname-error is ignored. Pass :hostname in :verify-error ++instead. ++ ++:verify-error is a list of symbols to express verification checks or ++`t' to do all checks. Currently it can contain `:trustfiles' and ++`:hostname' to verify the certificate or the hostname respectively. + + :min-prime-bits is the minimum accepted number of bits the client will + accept in Diffie-Hellman key exchange. +@@ -774,8 +778,7 @@ one trustfile (usually a CA bundle). */) + /* Lisp_Object callbacks; */ + Lisp_Object loglevel; + Lisp_Object hostname; +- /* Lisp_Object verify_error; */ +- Lisp_Object verify_hostname_error; ++ Lisp_Object verify_error; + Lisp_Object prime_bits; + + CHECK_PROCESS (proc); +@@ -800,11 +803,14 @@ one trustfile (usually a CA bundle). */) + keylist = Fplist_get (proplist, QCgnutls_bootprop_keylist); + crlfiles = Fplist_get (proplist, QCgnutls_bootprop_crlfiles); + loglevel = Fplist_get (proplist, QCgnutls_bootprop_loglevel); +- verify_hostname_error = Fplist_get (proplist, QCgnutls_bootprop_verify_hostname_error); ++ verify_error = Fplist_get (proplist, QCgnutls_bootprop_verify_error); + prime_bits = Fplist_get (proplist, QCgnutls_bootprop_min_prime_bits); + ++ if (!Flistp (verify_error)) ++ error ("gnutls-boot: invalid :verify_error parameter (not a list)"); ++ + if (!STRINGP (hostname)) +- error ("gnutls-boot: invalid :hostname parameter"); ++ error ("gnutls-boot: invalid :hostname parameter (not a string)"); + c_hostname = SSDATA (hostname); + + state = XPROCESS (proc)->gnutls_state; +@@ -1033,14 +1039,17 @@ one trustfile (usually a CA bundle). */) + + if (peer_verification != 0) + { +- if (NILP (verify_hostname_error)) +- GNUTLS_LOG2 (1, max_log_level, "certificate validation failed:", +- c_hostname); +- else +- { ++ if (EQ (verify_error, Qt) ++ || !NILP (Fmember (QCgnutls_bootprop_trustfiles, verify_error))) ++ { + emacs_gnutls_deinit (proc); + error ("Certificate validation failed %s, verification code %d", + c_hostname, peer_verification); ++ } ++ else ++ { ++ GNUTLS_LOG2 (1, max_log_level, "certificate validation failed:", ++ c_hostname); + } + } + +@@ -1080,14 +1089,17 @@ one trustfile (usually a CA bundle). */) + + if (!fn_gnutls_x509_crt_check_hostname (gnutls_verify_cert, c_hostname)) + { +- if (NILP (verify_hostname_error)) +- GNUTLS_LOG2 (1, max_log_level, "x509 certificate does not match:", +- c_hostname); +- else +- { ++ if (EQ (verify_error, Qt) ++ || !NILP (Fmember (QCgnutls_bootprop_hostname, verify_error))) ++ { + fn_gnutls_x509_crt_deinit (gnutls_verify_cert); + emacs_gnutls_deinit (proc); + error ("The x509 certificate does not match \"%s\"", c_hostname); ++ } ++ else ++ { ++ GNUTLS_LOG2 (1, max_log_level, "x509 certificate does not match:", ++ c_hostname); + } + } + fn_gnutls_x509_crt_deinit (gnutls_verify_cert); +@@ -1144,7 +1156,7 @@ syms_of_gnutls (void) + DEFSYM (QCgnutls_bootprop_min_prime_bits, ":min-prime-bits"); + DEFSYM (QCgnutls_bootprop_loglevel, ":loglevel"); + DEFSYM (QCgnutls_bootprop_verify_flags, ":verify-flags"); +- DEFSYM (QCgnutls_bootprop_verify_hostname_error, ":verify-hostname-error"); ++ DEFSYM (QCgnutls_bootprop_verify_error, ":verify-error"); + + DEFSYM (Qgnutls_e_interrupted, "gnutls-e-interrupted"); + Fput (Qgnutls_e_interrupted, Qgnutls_code, + diff --git a/SOURCES/emacs-0013-gnutls.el-increase-gnutls-min-prime-bits-to-1024-by-.patch b/SOURCES/emacs-0013-gnutls.el-increase-gnutls-min-prime-bits-to-1024-by-.patch new file mode 100644 index 0000000..34140b7 --- /dev/null +++ b/SOURCES/emacs-0013-gnutls.el-increase-gnutls-min-prime-bits-to-1024-by-.patch @@ -0,0 +1,27 @@ +From 3abc26f07ebb7779fd5cb00092829f437ebc71c2 Mon Sep 17 00:00:00 2001 +From: Jan Synacek +Date: Tue, 11 Sep 2018 13:18:27 +0200 +Subject: [PATCH 2/2] gnutls.el: increase gnutls-min-prime-bits to 1024 by + default + +Get rid of the gnutls warning saying that the DH key has been lowered. + +Related: #1403643 +--- + lisp/net/gnutls.el | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el +index 2585f48..ce69244 100644 +--- a/lisp/net/gnutls.el ++++ b/lisp/net/gnutls.el +@@ -79,7 +79,7 @@ The files may not exist, in which case they will be ignored." + (repeat (file :tag "Bundle filename")))) + + ;;;###autoload +-(defcustom gnutls-min-prime-bits 256 ++(defcustom gnutls-min-prime-bits 1024 + ;; Several mail servers send fewer bits than the GnuTLS default. + ;; Currently, 256 appears to be a reasonable choice (Bug#11267). + "Minimum number of prime bits accepted by GnuTLS for key exchange. + diff --git a/SOURCES/emacs-jpeg-detection.patch b/SOURCES/emacs-jpeg-detection.patch new file mode 100644 index 0000000..0471725 --- /dev/null +++ b/SOURCES/emacs-jpeg-detection.patch @@ -0,0 +1,24 @@ +Based on the upstream commit ff3878d749591ebf78da532ec1eb6fa00cb5757d. + +http://lists.gnu.org/archive/html/emacs-diffs/2015-03/msg00224.html + +Resolves: #1487557 + +--- a/configure 2017-09-15 16:21:24.912133006 +0200 ++++ b/configure 2017-09-15 16:26:00.869651920 +0200 +@@ -12583,11 +12583,13 @@ + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #include +- version=JPEG_LIB_VERSION ++ #if JPEG_LIB_VERSION >= 62 ++ version 6b or later ++ #endif + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "version= *(6[2-9]|[7-9][0-9])" >/dev/null 2>&1; then : ++ $EGREP "version 6b or later" >/dev/null 2>&1; then : + $as_echo "#define HAVE_JPEG 1" >>confdefs.h + + else diff --git a/SOURCES/emacs-menu.patch b/SOURCES/emacs-menu.patch new file mode 100644 index 0000000..b7bd810 --- /dev/null +++ b/SOURCES/emacs-menu.patch @@ -0,0 +1,667 @@ +This is a backport of https://github.com/emacs-mirror/emacs/commit/3f4c6d52d345999938bc2d4a53246af4c61ef176 +with a part of https://github.com/emacs-mirror/emacs/commit/5a1d858bbc5410916d764e7f9c62b4e405fab592 (everything +related to (struct x_output).toolbar_is_packed). + +Resolves: #1477745 + +diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el +index 4cbcf767c0..a7e695da2a 100644 +--- a/lisp/term/x-win.el ++++ b/lisp/term/x-win.el +@@ -1484,47 +1484,47 @@ This returns an error if any Emacs frames are X frames." + (mapcar (lambda (arg) + (cons (purecopy (car arg)) (purecopy (cdr arg)))) + '( +- ("etc/images/new" . "gtk-new") +- ("etc/images/open" . "gtk-open") ++ ("etc/images/new" . ("document-new" "gtk-new")) ++ ("etc/images/open" . ("document-open" "gtk-open")) + ("etc/images/diropen" . "n:system-file-manager") +- ("etc/images/close" . "gtk-close") +- ("etc/images/save" . "gtk-save") +- ("etc/images/saveas" . "gtk-save-as") +- ("etc/images/undo" . "gtk-undo") +- ("etc/images/cut" . "gtk-cut") +- ("etc/images/copy" . "gtk-copy") +- ("etc/images/paste" . "gtk-paste") +- ("etc/images/search" . "gtk-find") +- ("etc/images/print" . "gtk-print") +- ("etc/images/preferences" . "gtk-preferences") +- ("etc/images/help" . "gtk-help") +- ("etc/images/left-arrow" . "gtk-go-back") +- ("etc/images/right-arrow" . "gtk-go-forward") +- ("etc/images/home" . "gtk-home") +- ("etc/images/jump-to" . "gtk-jump-to") ++ ("etc/images/close" . ("window-close" "gtk-close")) ++ ("etc/images/save" . ("document-save" "gtk-save")) ++ ("etc/images/saveas" . ("document-save-as" "gtk-save-as")) ++ ("etc/images/undo" . ("edit-undo" "gtk-undo")) ++ ("etc/images/cut" . ("edit-cut" "gtk-cut")) ++ ("etc/images/copy" . ("edit-copy" "gtk-copy")) ++ ("etc/images/paste" . ("edit-paste" "gtk-paste")) ++ ("etc/images/search" . ("edit-find" "gtk-find")) ++ ("etc/images/print" . ("document-print" "gtk-print")) ++ ("etc/images/preferences" . ("preferences-system" "gtk-preferences")) ++ ("etc/images/help" . ("help-browser" "gtk-help")) ++ ("etc/images/left-arrow" . ("go-previous" "gtk-go-back")) ++ ("etc/images/right-arrow" . ("go-next" "gtk-go-forward")) ++ ("etc/images/home" . ("go-home" "gtk-home")) ++ ("etc/images/jump-to" . ("go-jump" "gtk-jump-to")) + ("etc/images/index" . "gtk-index") +- ("etc/images/search" . "gtk-find") +- ("etc/images/exit" . "gtk-quit") ++ ("etc/images/exit" . ("application-exit" "gtk-quit")) + ("etc/images/cancel" . "gtk-cancel") +- ("etc/images/info" . "gtk-info") ++ ("etc/images/info" . ("dialog-information" "gtk-info")) + ("etc/images/bookmark_add" . "n:bookmark_add") + ;; Used in Gnus and/or MH-E: + ("etc/images/attach" . "gtk-attach") + ("etc/images/connect" . "gtk-connect") + ("etc/images/contact" . "gtk-contact") +- ("etc/images/delete" . "gtk-delete") +- ("etc/images/describe" . "gtk-properties") ++ ("etc/images/delete" . ("edit-delete" "gtk-delete")) ++ ("etc/images/describe" . ("document-properties" "gtk-properties")) + ("etc/images/disconnect" . "gtk-disconnect") + ;; ("etc/images/exit" . "gtk-exit") + ("etc/images/lock-broken" . "gtk-lock_broken") + ("etc/images/lock-ok" . "gtk-lock_ok") + ("etc/images/lock" . "gtk-lock") + ("etc/images/next-page" . "gtk-next-page") +- ("etc/images/refresh" . "gtk-refresh") +- ("etc/images/sort-ascending" . "gtk-sort-ascending") ++ ("etc/images/refresh" . ("view-refresh" "gtk-refresh")) ++ ("etc/images/sort-ascending" . ("view-sort-ascending" "gtk-sort-ascending")) + ("etc/images/sort-column-ascending" . "gtk-sort-column-ascending") + ("etc/images/sort-criteria" . "gtk-sort-criteria") +- ("etc/images/sort-descending" . "gtk-sort-descending") ++ ("etc/images/sort-descending" . ("view-sort-descending" ++ "gtk-sort-descending")) + ("etc/images/sort-row-ascending" . "gtk-sort-row-ascending") + ("images/gnus/toggle-subscription" . "gtk-task-recurring") + ("images/mail/compose" . "gtk-mail-compose") +@@ -1541,8 +1541,8 @@ This returns an error if any Emacs frames are X frames." + ("images/mail/spam" . "gtk-spam") + ;; Used for GDB Graphical Interface + ("images/gud/break" . "gtk-no") +- ("images/gud/recstart" . "gtk-media-record") +- ("images/gud/recstop" . "gtk-media-stop") ++ ("images/gud/recstart" . ("media-record" "gtk-media-record")) ++ ("images/gud/recstop" . ("media-playback-stop" "gtk-media-stop")) + ;; No themed versions available: + ;; mail/preview (combining stock_mail and stock_zoom) + ;; mail/save (combining stock_mail, stock_save and stock_convert) +@@ -1551,9 +1551,12 @@ This returns an error if any Emacs frames are X frames." + Emacs must be compiled with the Gtk+ toolkit for this to have any effect. + A value that begins with n: denotes a named icon instead of a stock icon." + :version "22.2" +- :type '(choice (repeat (choice symbol +- (cons (string :tag "Emacs icon") +- (string :tag "Stock/named"))))) ++ :type '(choice (repeat ++ (choice symbol ++ (cons (string :tag "Emacs icon") ++ (choice (group (string :tag "Named") ++ (string :tag "Stock")) ++ (string :tag "Stock/named")))))) + :group 'x) + + (defcustom icon-map-list '(x-gtk-stock-map) +diff --git a/src/xmenu.c b/src/xmenu.c +index e3f1a17fbc..eb783fe507 100644 +--- a/src/xmenu.c ++++ b/src/xmenu.c +@@ -733,12 +733,6 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p) + f->output_data.x->saved_menu_event->type = 0; + } + +-#ifdef USE_GTK +- /* If we have detached menus, we must update deep so detached menus +- also gets updated. */ +- deep_p = deep_p || xg_have_tear_offs (); +-#endif +- + if (deep_p) + { + /* Make a widget-value tree representing the entire menu trees. */ +diff --git a/src/xterm.h b/src/xterm.h +index ed611f1d19..0842195f33 100644 +--- a/src/xterm.h ++++ b/src/xterm.h +@@ -474,12 +474,11 @@ struct x_output + GtkWidget *menubar_widget; + /* The tool bar in this frame */ + GtkWidget *toolbar_widget; +- /* The handle box that makes the tool bar detachable. */ +- GtkWidget *handlebox_widget; + /* Non-zero if the tool bar is detached. */ + int toolbar_detached; + /* Non-zero if tool bar is packed into the hbox widget (i.e. vertical). */ + int toolbar_in_hbox; ++ int toolbar_is_packed; + + /* The last size hints set. */ + GdkGeometry size_hints; +diff --git a/src/gtkutil.c b/src/gtkutil.c +--- a/src/gtkutil.c ++++ b/src/gtkutil.c +@@ -2428,45 +2428,6 @@ make_menu_item (const char *utf8_label, + return w; + } + +-static int xg_detached_menus; +- +-/* Return true if there are detached menus. */ +- +-bool +-xg_have_tear_offs (void) +-{ +- return xg_detached_menus > 0; +-} +- +-/* Callback invoked when a detached menu window is removed. Here we +- decrease the xg_detached_menus count. +- WIDGET is the top level window that is removed (the parent of the menu). +- CLIENT_DATA is not used. */ +- +-static void +-tearoff_remove (GtkWidget *widget, gpointer client_data) +-{ +- if (xg_detached_menus > 0) --xg_detached_menus; +-} +- +-/* Callback invoked when a menu is detached. It increases the +- xg_detached_menus count. +- WIDGET is the GtkTearoffMenuItem. +- CLIENT_DATA is not used. */ +- +-static void +-tearoff_activate (GtkWidget *widget, gpointer client_data) +-{ +- GtkWidget *menu = gtk_widget_get_parent (widget); +- if (gtk_menu_get_tearoff_state (GTK_MENU (menu))) +- { +- ++xg_detached_menus; +- g_signal_connect (G_OBJECT (gtk_widget_get_toplevel (widget)), +- "destroy", +- G_CALLBACK (tearoff_remove), 0); +- } +-} +- + + /* Create a menu item widget, and connect the callbacks. + ITEM describes the menu item. +@@ -2538,8 +2499,6 @@ xg_create_one_menuitem (widget_value *it + HIGHLIGHT_CB is the callback to call when entering/leaving menu items. + If POP_UP_P, create a popup menu. + If MENU_BAR_P, create a menu bar. +- If ADD_TEAROFF_P, add a tearoff menu item. Ignored if MENU_BAR_P. +- TOPMENU is the topmost GtkWidget that others shall be placed under. + It may be NULL, in that case we create the appropriate widget + (menu bar or menu item depending on POP_UP_P and MENU_BAR_P) + CL_DATA is the callback data we shall use for this menu, or NULL +@@ -2560,7 +2519,6 @@ create_menus (widget_value *data, + GCallback highlight_cb, + bool pop_up_p, + bool menu_bar_p, +- bool add_tearoff_p, + GtkWidget *topmenu, + xg_menu_cb_data *cl_data, + const char *name) +@@ -2611,15 +2569,6 @@ create_menus (widget_value *data, + "selection-done", deactivate_cb, 0); + } + +- if (! menu_bar_p && add_tearoff_p) +- { +- GtkWidget *tearoff = gtk_tearoff_menu_item_new (); +- gtk_menu_shell_append (GTK_MENU_SHELL (wmenu), tearoff); +- +- g_signal_connect (G_OBJECT (tearoff), "activate", +- G_CALLBACK (tearoff_activate), 0); +- } +- + for (item = data; item; item = item->next) + { + GtkWidget *w; +@@ -2633,7 +2582,6 @@ create_menus (widget_value *data, + group = NULL; + utf8_label = get_utf8_string (item->name); + +- gtk_menu_set_title (GTK_MENU (wmenu), utf8_label); + w = gtk_menu_item_new_with_label (utf8_label); + gtk_widget_set_sensitive (w, FALSE); + if (utf8_label) g_free (utf8_label); +@@ -2664,7 +2612,6 @@ create_menus (widget_value *data, + highlight_cb, + 0, + 0, +- add_tearoff_p, + 0, + cl_data, + 0); +@@ -2722,7 +2669,6 @@ xg_create_widget (const char *type, cons + highlight_cb, + pop_up_p, + menu_bar_p, +- menu_bar_p, + 0, + 0, + name); +@@ -2832,7 +2778,7 @@ xg_update_menubar (GtkWidget *menubar, + { + /* Item(s) added. Add all new items in one call. */ + create_menus (val, f, select_cb, deactivate_cb, highlight_cb, +- 0, 1, 0, menubar, cl_data, 0); ++ 0, 1, menubar, cl_data, 0); + + /* All updated. */ + val = 0; +@@ -2909,12 +2855,6 @@ xg_update_menubar (GtkWidget *menubar, + + gtk_label_set_text (wlabel, utf8_label); + +- /* If this item has a submenu that has been detached, change +- the title in the WM decorations also. */ +- if (submenu && gtk_menu_get_tearoff_state (GTK_MENU (submenu))) +- /* Set the title of the detached window. */ +- gtk_menu_set_title (GTK_MENU (submenu), utf8_label); +- + if (utf8_label) g_free (utf8_label); + iter = g_list_next (iter); + val = val->next; +@@ -2941,7 +2881,7 @@ xg_update_menubar (GtkWidget *menubar, + GtkWidget *submenu = create_menus (NULL, f, + select_cb, deactivate_cb, + highlight_cb, +- 0, 0, 0, 0, cl_data, 0); ++ 0, 0, 0, cl_data, 0); + gtk_widget_set_name (w, MENU_ITEM_NAME); + gtk_menu_shell_insert (GTK_MENU_SHELL (menubar), w, pos); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (w), submenu); +@@ -3141,15 +3081,6 @@ xg_update_submenu (GtkWidget *submenu, + { + GtkWidget *w = GTK_WIDGET (iter->data); + +- /* Skip tearoff items, they have no counterpart in val. */ +- if (GTK_IS_TEAROFF_MENU_ITEM (w)) +- { +- has_tearoff_p = 1; +- iter = g_list_next (iter); +- if (iter) w = GTK_WIDGET (iter->data); +- else break; +- } +- + /* Remember first radio button in a group. If we get a mismatch in + a radio group we must rebuild the whole group so that the connections + in GTK becomes correct. */ +@@ -3237,7 +3168,6 @@ xg_update_submenu (GtkWidget *submenu, + highlight_cb, + 0, + 0, +- ! has_tearoff_p, + submenu, + cl_data, + 0); +@@ -4026,186 +3956,6 @@ xg_get_tool_bar_widgets (GtkWidget *vb, + } + + +-/* This callback is called when a tool item should create a proxy item, +- such as for the overflow menu. Also called when the tool bar is detached. +- If we don't create a proxy menu item, the detached tool bar will be +- blank. */ +- +-static gboolean +-xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data) +-{ +- GtkButton *wbutton = GTK_BUTTON (XG_BIN_CHILD (XG_BIN_CHILD (toolitem))); +- GtkWidget *vb = XG_BIN_CHILD (wbutton); +- GtkWidget *c1; +- GtkLabel *wlbl = GTK_LABEL (xg_get_tool_bar_widgets (vb, &c1)); +- GtkImage *wimage = GTK_IMAGE (c1); +- GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label +- (wlbl ? gtk_label_get_text (wlbl) : ""); +- GtkWidget *wmenuimage; +- +- +- if (gtk_button_get_use_stock (wbutton)) +- wmenuimage = gtk_image_new_from_stock (gtk_button_get_label (wbutton), +- GTK_ICON_SIZE_MENU); +- else +- { +- GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (wbutton)); +- GtkImageType store_type = gtk_image_get_storage_type (wimage); +- +- g_object_set (G_OBJECT (settings), "gtk-menu-images", TRUE, NULL); +- +- if (store_type == GTK_IMAGE_STOCK) +- { +- gchar *stock_id; +- gtk_image_get_stock (wimage, &stock_id, NULL); +- wmenuimage = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU); +- } +- else if (store_type == GTK_IMAGE_ICON_SET) +- { +- GtkIconSet *icon_set; +- gtk_image_get_icon_set (wimage, &icon_set, NULL); +- wmenuimage = gtk_image_new_from_icon_set (icon_set, +- GTK_ICON_SIZE_MENU); +- } +- else if (store_type == GTK_IMAGE_PIXBUF) +- { +- gint width, height; +- +- if (settings && +- gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU, +- &width, &height)) +- { +- GdkPixbuf *src_pixbuf, *dest_pixbuf; +- +- src_pixbuf = gtk_image_get_pixbuf (wimage); +- dest_pixbuf = gdk_pixbuf_scale_simple (src_pixbuf, width, height, +- GDK_INTERP_BILINEAR); +- +- wmenuimage = gtk_image_new_from_pixbuf (dest_pixbuf); +- } +- else +- { +- fprintf (stderr, "internal error: GTK_IMAGE_PIXBUF failed\n"); +- emacs_abort (); +- } +- } +- else if (store_type == GTK_IMAGE_ICON_NAME) +- { +- const gchar *icon_name; +- GtkIconSize icon_size; +- +- gtk_image_get_icon_name (wimage, &icon_name, &icon_size); +- wmenuimage = gtk_image_new_from_icon_name (icon_name, +- GTK_ICON_SIZE_MENU); +- } +- else +- { +- fprintf (stderr, "internal error: store_type is %d\n", store_type); +- emacs_abort (); +- } +- } +- if (wmenuimage) +- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (wmenuitem), wmenuimage); +- +- g_signal_connect (G_OBJECT (wmenuitem), +- "activate", +- G_CALLBACK (xg_tool_bar_proxy_callback), +- user_data); +- +- +- g_object_set_data (G_OBJECT (wmenuitem), XG_TOOL_BAR_PROXY_BUTTON, +- (gpointer) wbutton); +- gtk_tool_item_set_proxy_menu_item (toolitem, "Emacs toolbar item", wmenuitem); +- gtk_widget_set_sensitive (wmenuitem, +- gtk_widget_get_sensitive (GTK_WIDGET (wbutton))); +- +- /* Use enter/leave notify to show help. We use the events +- rather than the GtkButton specific signals "enter" and +- "leave", so we can have only one callback. The event +- will tell us what kind of event it is. */ +- g_signal_connect (G_OBJECT (wmenuitem), +- "enter-notify-event", +- G_CALLBACK (xg_tool_bar_proxy_help_callback), +- user_data); +- g_signal_connect (G_OBJECT (wmenuitem), +- "leave-notify-event", +- G_CALLBACK (xg_tool_bar_proxy_help_callback), +- user_data); +- +- return TRUE; +-} +- +-/* This callback is called when a tool bar is detached. We must set +- the height of the tool bar to zero when this happens so frame sizes +- are correctly calculated. +- WBOX is the handle box widget that enables detach/attach of the tool bar. +- W is the tool bar widget. +- CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ +- +-static void +-xg_tool_bar_detach_callback (GtkHandleBox *wbox, +- GtkWidget *w, +- gpointer client_data) +-{ +- FRAME_PTR f = (FRAME_PTR) client_data; +- +- g_object_set (G_OBJECT (w), "show-arrow", !x_gtk_whole_detached_tool_bar, +- NULL); +- +- if (f) +- { +- GtkRequisition req, req2; +- FRAME_X_OUTPUT (f)->toolbar_detached = 1; +- gtk_widget_get_preferred_size (GTK_WIDGET (wbox), NULL, &req); +- gtk_widget_get_preferred_size (w, NULL, &req2); +- req.width -= req2.width; +- req.height -= req2.height; +- if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0) +- FRAME_TOOLBAR_TOP_HEIGHT (f) = req.height; +- else if (FRAME_TOOLBAR_BOTTOM_HEIGHT (f) != 0) +- FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = req.height; +- else if (FRAME_TOOLBAR_RIGHT_WIDTH (f) != 0) +- FRAME_TOOLBAR_RIGHT_WIDTH (f) = req.width; +- else if (FRAME_TOOLBAR_LEFT_WIDTH (f) != 0) +- FRAME_TOOLBAR_LEFT_WIDTH (f) = req.width; +- xg_height_or_width_changed (f); +- } +-} +- +-/* This callback is called when a tool bar is reattached. We must set +- the height of the tool bar when this happens so frame sizes +- are correctly calculated. +- WBOX is the handle box widget that enables detach/attach of the tool bar. +- W is the tool bar widget. +- CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ +- +-static void +-xg_tool_bar_attach_callback (GtkHandleBox *wbox, +- GtkWidget *w, +- gpointer client_data) +-{ +- FRAME_PTR f = (FRAME_PTR) client_data; +- g_object_set (G_OBJECT (w), "show-arrow", TRUE, NULL); +- +- if (f) +- { +- GtkRequisition req, req2; +- FRAME_X_OUTPUT (f)->toolbar_detached = 0; +- gtk_widget_get_preferred_size (GTK_WIDGET (wbox), NULL, &req); +- gtk_widget_get_preferred_size (w, NULL, &req2); +- req.width += req2.width; +- req.height += req2.height; +- if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0) +- FRAME_TOOLBAR_TOP_HEIGHT (f) = req.height; +- else if (FRAME_TOOLBAR_BOTTOM_HEIGHT (f) != 0) +- FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = req.height; +- else if (FRAME_TOOLBAR_RIGHT_WIDTH (f) != 0) +- FRAME_TOOLBAR_RIGHT_WIDTH (f) = req.width; +- else if (FRAME_TOOLBAR_LEFT_WIDTH (f) != 0) +- FRAME_TOOLBAR_LEFT_WIDTH (f) = req.width; +- xg_height_or_width_changed (f); +- } +-} + + /* This callback is called when the mouse enters or leaves a tool bar item. + It is used for displaying and hiding the help text. +@@ -4298,44 +4048,30 @@ xg_pack_tool_bar (FRAME_PTR f, Lisp_Obje + into_hbox + ? GTK_ORIENTATION_VERTICAL + : GTK_ORIENTATION_HORIZONTAL); +- if (!x->handlebox_widget) +- { +- x->handlebox_widget = gtk_handle_box_new (); +- g_signal_connect (G_OBJECT (x->handlebox_widget), "child-detached", +- G_CALLBACK (xg_tool_bar_detach_callback), f); +- g_signal_connect (G_OBJECT (x->handlebox_widget), "child-attached", +- G_CALLBACK (xg_tool_bar_attach_callback), f); +- gtk_container_add (GTK_CONTAINER (x->handlebox_widget), +- x->toolbar_widget); +- } +- + if (into_hbox) + { +- gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget), +- GTK_POS_TOP); +- gtk_box_pack_start (GTK_BOX (x->hbox_widget), x->handlebox_widget, ++ gtk_box_pack_start (GTK_BOX (x->hbox_widget), x->toolbar_widget, + FALSE, FALSE, 0); + + if (EQ (pos, Qleft)) + gtk_box_reorder_child (GTK_BOX (x->hbox_widget), +- x->handlebox_widget, ++ x->toolbar_widget, + 0); + x->toolbar_in_hbox = 1; + } + else + { + bool vbox_pos = x->menubar_widget != 0; +- gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget), +- GTK_POS_LEFT); +- gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget, ++ gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->toolbar_widget, + FALSE, FALSE, 0); + + if (EQ (pos, Qtop)) + gtk_box_reorder_child (GTK_BOX (x->vbox_widget), +- x->handlebox_widget, ++ x->toolbar_widget, + vbox_pos); + x->toolbar_in_hbox = 0; + } ++ x->toolbar_is_packed = 1; + } + + /* Create a tool bar for frame F. */ +@@ -4462,10 +4198,6 @@ xg_make_tool_item (FRAME_PTR f, + intptr_t ii = i; + gpointer gi = (gpointer) ii; + +- g_signal_connect (G_OBJECT (ti), "create-menu-proxy", +- G_CALLBACK (xg_tool_bar_menu_proxy), +- gi); +- + g_signal_connect (G_OBJECT (wb), "clicked", + G_CALLBACK (xg_tool_bar_callback), + gi); +@@ -4580,12 +4312,12 @@ xg_update_tool_bar_sizes (FRAME_PTR f) + GtkRequisition req; + int nl = 0, nr = 0, nt = 0, nb = 0; + +- gtk_widget_get_preferred_size (GTK_WIDGET (x->handlebox_widget), NULL, &req); ++ gtk_widget_get_preferred_size (GTK_WIDGET (x->toolbar_widget), NULL, &req); + if (x->toolbar_in_hbox) + { + int pos; + gtk_container_child_get (GTK_CONTAINER (x->hbox_widget), +- x->handlebox_widget, ++ x->toolbar_widget, + "position", &pos, NULL); + if (pos == 0) nl = req.width; + else nr = req.width; +@@ -4594,7 +4326,7 @@ xg_update_tool_bar_sizes (FRAME_PTR f) + { + int pos; + gtk_container_child_get (GTK_CONTAINER (x->vbox_widget), +- x->handlebox_widget, ++ x->toolbar_widget, + "position", &pos, NULL); + if (pos == 0 || (pos == 1 && x->menubar_widget)) nt = req.height; + else nb = req.height; +@@ -4665,7 +4397,6 @@ update_frame_tool_bar (FRAME_PTR f) + GtkToolbar *wtoolbar; + GtkToolItem *ti; + GtkTextDirection dir; +- bool pack_tool_bar = x->handlebox_widget == NULL; + Lisp_Object style; + bool text_image, horiz; + struct xg_frame_tb_info *tbinfo; +@@ -4924,9 +4655,9 @@ update_frame_tool_bar (FRAME_PTR f) + + if (f->n_tool_bar_items != 0) + { +- if (pack_tool_bar) ++ if (! x->toolbar_is_packed) + xg_pack_tool_bar (f, f->tool_bar_position); +- gtk_widget_show_all (GTK_WIDGET (x->handlebox_widget)); ++ gtk_widget_show_all (GTK_WIDGET (x->toolbar_widget)); + if (xg_update_tool_bar_sizes (f)) + xg_height_or_width_changed (f); + } +@@ -4945,24 +4676,21 @@ free_frame_tool_bar (FRAME_PTR f) + if (x->toolbar_widget) + { + struct xg_frame_tb_info *tbinfo; +- bool is_packed = x->handlebox_widget != 0; + block_input (); +- /* We may have created the toolbar_widget in xg_create_tool_bar, but +- not the x->handlebox_widget which is created in xg_pack_tool_bar. */ +- if (is_packed) ++ if (x->toolbar_is_packed) + { + if (x->toolbar_in_hbox) + gtk_container_remove (GTK_CONTAINER (x->hbox_widget), +- x->handlebox_widget); ++ x->toolbar_widget); + else + gtk_container_remove (GTK_CONTAINER (x->vbox_widget), +- x->handlebox_widget); ++ x->toolbar_widget); + } + else + gtk_widget_destroy (x->toolbar_widget); + + x->toolbar_widget = 0; +- x->handlebox_widget = 0; ++ x->toolbar_is_packed = 0; + FRAME_TOOLBAR_TOP_HEIGHT (f) = FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = 0; + FRAME_TOOLBAR_LEFT_WIDTH (f) = FRAME_TOOLBAR_RIGHT_WIDTH (f) = 0; + +@@ -4987,19 +4715,22 @@ xg_change_toolbar_position (FRAME_PTR f, + { + struct x_output *x = f->output_data.x; + +- if (! x->toolbar_widget || ! x->handlebox_widget) ++ if (! x->toolbar_widget) + return; + + block_input (); +- g_object_ref (x->handlebox_widget); +- if (x->toolbar_in_hbox) +- gtk_container_remove (GTK_CONTAINER (x->hbox_widget), +- x->handlebox_widget); +- else +- gtk_container_remove (GTK_CONTAINER (x->vbox_widget), +- x->handlebox_widget); ++ g_object_ref (x->toolbar_widget); ++ if (x->toolbar_is_packed) ++ { ++ if (x->toolbar_in_hbox) ++ gtk_container_remove (GTK_CONTAINER (x->hbox_widget), ++ x->toolbar_widget); ++ else ++ gtk_container_remove (GTK_CONTAINER (x->vbox_widget), ++ x->toolbar_widget); ++ } + xg_pack_tool_bar (f, pos); +- g_object_unref (x->handlebox_widget); ++ g_object_unref (x->toolbar_widget); + if (xg_update_tool_bar_sizes (f)) + xg_height_or_width_changed (f); + +@@ -5025,7 +4756,6 @@ xg_initialize (void) + + gdpy_def = NULL; + xg_ignore_gtk_scrollbar = 0; +- xg_detached_menus = 0; + xg_menu_cb_list.prev = xg_menu_cb_list.next = + xg_menu_item_cb_list.prev = xg_menu_item_cb_list.next = 0; + diff --git a/SPECS/emacs.spec b/SPECS/emacs.spec index 825204d..0737977 100644 --- a/SPECS/emacs.spec +++ b/SPECS/emacs.spec @@ -4,7 +4,7 @@ Summary: GNU Emacs text editor Name: emacs Epoch: 1 Version: 24.3 -Release: 20%{?dist} +Release: 22%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/emacs/ Group: Applications/Editors @@ -45,6 +45,12 @@ Patch26: emacs-0011-ELF-unexec-align-section-header.patch Patch27: emacs-environment-crash.patch # https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-25&id=9ad0fcc54442a9a01d41be19880250783426db70 Patch28: emacs-enriched.patch +Patch29: emacs-jpeg-detection.patch +# https://github.com/emacs-mirror/emacs/commit/3f4c6d52d345999938bc2d4a53246af4c61ef176 +# and part of https://github.com/emacs-mirror/emacs/commit/5a1d858bbc5410916d764e7f9c62b4e405fab592 +Patch30: emacs-menu.patch +Patch31: emacs-0012-New-verify-error-GnuTLS-interface-for-certificate-va.patch +Patch32: emacs-0013-gnutls.el-increase-gnutls-min-prime-bits-to-1024-by-.patch # Fix for emacs bug #13460. Patch100: emacs-24.3-hunspell.patch # Fix for emacs bug #827033 @@ -206,6 +212,10 @@ packages that add functionality to Emacs. %patch26 -p1 %patch27 -p1 %patch28 -p1 +%patch29 -p1 +%patch30 -p1 +%patch31 -p1 +%patch32 -p1 %patch100 -p1 -b .hunspell %patch101 -p1 -b .hunspell.2 @@ -510,8 +520,16 @@ update-desktop-database &> /dev/null || : %dir %{_datadir}/emacs/site-lisp/site-start.d %changelog +* Tue Sep 11 2018 Jan Synáček - 1:24.3-22 +- refix: TLS certificate warnings should be hard errors (#1403643) + +* Thu Jun 7 2018 Jan Synáček - 1:24.3-21 +- fix libjpeg detection fails with gcc7 (#1487557) +- fix Emacs GUI Toolbar icons missing (#1477745) +- fix hardening: TLS certificate warnings should be hard errors (#1403643) + * Tue Sep 12 2017 Jan Synáček - 1:24.3-20 -- fix unsafe enriched mode translations (#1490452) +- fix unsafe enriched mode translations (#1490451) * Fri Jan 6 2017 Jan Synáček - 1:24.3-19 - fix build failure on ppc64 (#1336711)