diff --git a/.emacs.metadata b/.emacs.metadata new file mode 100644 index 0000000..16502c7 --- /dev/null +++ b/.emacs.metadata @@ -0,0 +1 @@ +4f6d5907e1919ca27b70034acaec211a09a4e204 SOURCES/emacs-24.3.tar.xz diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..40dbc72 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/emacs-24.3.tar.xz diff --git a/SOURCES/default.el b/SOURCES/default.el new file mode 100644 index 0000000..b6a7591 --- /dev/null +++ b/SOURCES/default.el @@ -0,0 +1,8 @@ +;;; default.el - loaded after ".emacs" on startup +;;; +;;; Setting `inhibit-default-init' non-nil in "~/.emacs" +;;; prevents loading of this file. Also the "-q" option to emacs +;;; prevents both "~/.emacs" and this file from being loaded at startup. + +;; default to better frame titles +(setq-default frame-title-format (concat "%b - emacs@" (system-name))) diff --git a/SOURCES/dotemacs.el b/SOURCES/dotemacs.el new file mode 100644 index 0000000..e1bee17 --- /dev/null +++ b/SOURCES/dotemacs.el @@ -0,0 +1,12 @@ +;; .emacs + +(custom-set-variables + ;; uncomment to always end a file with a newline + ;'(require-final-newline t) + ;; uncomment to disable loading of "default.el" at startup + ;'(inhibit-default-init t) + ;; default to unified diffs + '(diff-switches "-u")) + +;;; uncomment for CJK utf-8 support for non-Asian users +;; (require 'un-define) diff --git a/SOURCES/emacs-0001-ppc64-fixes-prepatch.patch b/SOURCES/emacs-0001-ppc64-fixes-prepatch.patch new file mode 100644 index 0000000..55e93e7 --- /dev/null +++ b/SOURCES/emacs-0001-ppc64-fixes-prepatch.patch @@ -0,0 +1,436 @@ +From 7ffe5bd31f9cb53a37f91c5fd1a9b6ce0df51c81 Mon Sep 17 00:00:00 2001 +From: Jan Synacek +Date: Tue, 24 May 2016 09:39:42 +0200 +Subject: [PATCH 01/11] ppc64 fixes prepatch + +--- + src/unexelf.c | 210 +++++++++++++++++++++++++++++----------------------------- + 1 file changed, 105 insertions(+), 105 deletions(-) + +diff --git a/src/unexelf.c b/src/unexelf.c +index d365940..483da6e 100644 +--- a/src/unexelf.c ++++ b/src/unexelf.c +@@ -1,4 +1,4 @@ +-/* Copyright (C) 1985-1988, 1990, 1992, 1999-2013 Free Software ++/* Copyright (C) 1985-1988, 1990, 1992, 1999-2015 Free Software + Foundation, Inc. + + This file is part of GNU Emacs. +@@ -386,18 +386,19 @@ temacs: + Instead we read the whole file, modify it, and write it out. */ + + #include +-#include ++#include "unexec.h" ++#include "lisp.h" + +-extern void fatal (const char *msgid, ...); +- +-#include ++#include ++#include ++#include ++#include + #include + #include + #include +-#include +-#include ++#include + #include +-#include ++ + #if !defined (__NetBSD__) && !defined (__OpenBSD__) + #include + #endif /* not __NetBSD__ and not __OpenBSD__ */ +@@ -519,6 +520,18 @@ typedef struct { + # define ElfW(type) ElfExpandBitsW (ELFSIZE, type) + #endif + ++/* The code often converts ElfW (Half) values like e_shentsize to ptrdiff_t; ++ check that this doesn't lose information. */ ++#include ++#include ++verify ((! TYPE_SIGNED (ElfW (Half)) ++ || PTRDIFF_MIN <= TYPE_MINIMUM (ElfW (Half))) ++ && TYPE_MAXIMUM (ElfW (Half)) <= PTRDIFF_MAX); ++ ++#ifdef UNEXELF_DEBUG ++# define DEBUG_LOG(expr) fprintf (stderr, #expr " 0x%jx\n", (uintmax_t) (expr)) ++#endif ++ + /* Get the address of a particular section or program header entry, + * accounting for the size of the entries. + */ +@@ -546,17 +559,21 @@ typedef struct { + Apr 23, 1996 + */ + ++static void * ++entry_address (void *section_h, ptrdiff_t idx, ptrdiff_t entsize) ++{ ++ char *h = section_h; ++ return h + idx * entsize; ++} ++ + #define OLD_SECTION_H(n) \ +- (*(ElfW (Shdr) *) ((byte *) old_section_h + old_file_h->e_shentsize * (n))) ++ (*(ElfW (Shdr) *) entry_address (old_section_h, n, old_file_h->e_shentsize)) + #define NEW_SECTION_H(n) \ +- (*(ElfW (Shdr) *) ((byte *) new_section_h + new_file_h->e_shentsize * (n))) ++ (*(ElfW (Shdr) *) entry_address (new_section_h, n, new_file_h->e_shentsize)) + #define NEW_PROGRAM_H(n) \ +- (*(ElfW (Phdr) *) ((byte *) new_program_h + new_file_h->e_phentsize * (n))) ++ (*(ElfW (Phdr) *) entry_address (new_program_h, n, new_file_h->e_phentsize)) + +-#define PATCH_INDEX(n) \ +- do { \ +- if ((int) (n) >= old_bss_index) \ +- (n)++; } while (0) ++#define PATCH_INDEX(n) ((n) += old_bss_index <= (n)) + typedef unsigned char byte; + + /* Round X up to a multiple of Y. */ +@@ -564,7 +581,7 @@ typedef unsigned char byte; + static ElfW (Addr) + round_up (ElfW (Addr) x, ElfW (Addr) y) + { +- int rem = x % y; ++ ElfW (Addr) rem = x % y; + if (rem == 0) + return x; + return x - rem + y; +@@ -575,33 +592,28 @@ round_up (ElfW (Addr) x, ElfW (Addr) y) + about the file we are looking in. + + If we don't find the section NAME, that is a fatal error +- if NOERROR is 0; we return -1 if NOERROR is nonzero. */ ++ if NOERROR is false; return -1 if NOERROR is true. */ + +-static int ++static ptrdiff_t + find_section (const char *name, const char *section_names, const char *file_name, +- ElfW (Ehdr) *old_file_h, ElfW (Shdr) *old_section_h, int noerror) ++ ElfW (Ehdr) *old_file_h, ElfW (Shdr) *old_section_h, ++ bool noerror) + { +- int idx; ++ ptrdiff_t idx; + + for (idx = 1; idx < old_file_h->e_shnum; idx++) + { +-#ifdef DEBUG +- fprintf (stderr, "Looking for %s - found %s\n", name, +- section_names + OLD_SECTION_H (idx).sh_name); ++ char const *found_name = section_names + OLD_SECTION_H (idx).sh_name; ++#ifdef UNEXELF_DEBUG ++ fprintf (stderr, "Looking for %s - found %s\n", name, found_name); + #endif +- if (!strcmp (section_names + OLD_SECTION_H (idx).sh_name, +- name)) +- break; +- } +- if (idx == old_file_h->e_shnum) +- { +- if (noerror) +- return -1; +- else +- fatal ("Can't find %s in %s.\n", name, file_name); ++ if (strcmp (name, found_name) == 0) ++ return idx; + } + +- return idx; ++ if (! noerror) ++ fatal ("Can't find %s in %s", name, file_name); ++ return -1; + } + + /* **************************************************************** +@@ -616,11 +628,9 @@ find_section (const char *name, const char *section_names, const char *file_name + void + unexec (const char *new_name, const char *old_name) + { +- int new_file, old_file, new_file_size; +- +-#if defined (emacs) || !defined (DEBUG) ++ int new_file, old_file; ++ off_t new_file_size; + void *new_break; +-#endif + + /* Pointers to the base of the image of the two files. */ + caddr_t old_base, new_base; +@@ -647,30 +657,30 @@ unexec (const char *new_name, const char *old_name) + ElfW (Off) old_bss_offset; + ElfW (Word) new_data2_incr; + +- int n, nn; +- int old_bss_index, old_sbss_index, old_plt_index; +- int old_data_index, new_data2_index; ++ ptrdiff_t n, nn; ++ ptrdiff_t old_bss_index, old_sbss_index, old_plt_index; ++ ptrdiff_t old_data_index, new_data2_index; + #if defined _SYSTYPE_SYSV || defined __sgi +- int old_mdebug_index; ++ ptrdiff_t old_mdebug_index; + #endif + struct stat stat_buf; +- int old_file_size; ++ off_t old_file_size; + + /* Open the old file, allocate a buffer of the right size, and read + in the file contents. */ + +- old_file = open (old_name, O_RDONLY); ++ old_file = emacs_open (old_name, O_RDONLY, 0); + + if (old_file < 0) +- fatal ("Can't open %s for reading: errno %d\n", old_name, errno); ++ fatal ("Can't open %s for reading: %s", old_name, strerror (errno)); + +- if (fstat (old_file, &stat_buf) == -1) +- fatal ("Can't fstat (%s): errno %d\n", old_name, errno); ++ if (fstat (old_file, &stat_buf) != 0) ++ fatal ("Can't fstat (%s): %s", old_name, strerror (errno)); + + #if MAP_ANON == 0 +- mmap_fd = open ("/dev/zero", O_RDONLY); ++ mmap_fd = emacs_open ("/dev/zero", O_RDONLY, 0); + if (mmap_fd < 0) +- fatal ("Can't open /dev/zero for reading: errno %d\n", errno, 0); ++ fatal ("Can't open /dev/zero for reading: %s", strerror (errno)); + #endif + + /* We cannot use malloc here because that may use sbrk. If it does, +@@ -678,13 +688,15 @@ unexec (const char *new_name, const char *old_name) + extra careful to use the correct value of sbrk(0) after + allocating all buffers in the code below, which we aren't. */ + old_file_size = stat_buf.st_size; ++ if (! (0 <= old_file_size && old_file_size <= SIZE_MAX)) ++ fatal ("File size out of range"); + old_base = mmap (NULL, old_file_size, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_PRIVATE, mmap_fd, 0); + if (old_base == MAP_FAILED) +- fatal ("Can't allocate buffer for %s\n", old_name, 0); ++ fatal ("Can't allocate buffer for %s: %s", old_name, strerror (errno)); + +- if (read (old_file, old_base, stat_buf.st_size) != stat_buf.st_size) +- fatal ("Didn't read all of %s: errno %d\n", old_name, errno); ++ if (read (old_file, old_base, old_file_size) != old_file_size) ++ fatal ("Didn't read all of %s: %s", old_name, strerror (errno)); + + /* Get pointers to headers & section names */ + +@@ -755,12 +767,8 @@ unexec (const char *new_name, const char *old_name) + old_data_index = find_section (".data", old_section_names, + old_name, old_file_h, old_section_h, 0); + +-#if defined (emacs) || !defined (DEBUG) + new_break = sbrk (0); + new_bss_addr = (ElfW (Addr)) new_break; +-#else +- new_bss_addr = old_bss_addr + old_bss_size + 0x1234; +-#endif + new_data2_addr = old_bss_addr; + new_data2_size = new_bss_addr - old_bss_addr; + new_data2_offset = OLD_SECTION_H (old_data_index).sh_offset +@@ -771,38 +779,38 @@ unexec (const char *new_name, const char *old_name) + section) was unaligned. */ + new_data2_incr = new_data2_size + (new_data2_offset - old_bss_offset); + +-#ifdef DEBUG +- fprintf (stderr, "old_bss_index %d\n", old_bss_index); +- fprintf (stderr, "old_bss_addr %x\n", old_bss_addr); +- fprintf (stderr, "old_bss_size %x\n", old_bss_size); +- fprintf (stderr, "old_bss_offset %x\n", old_bss_offset); +- fprintf (stderr, "new_bss_addr %x\n", new_bss_addr); +- fprintf (stderr, "new_data2_addr %x\n", new_data2_addr); +- fprintf (stderr, "new_data2_size %x\n", new_data2_size); +- fprintf (stderr, "new_data2_offset %x\n", new_data2_offset); +- fprintf (stderr, "new_data2_incr %x\n", new_data2_incr); ++#ifdef UNEXELF_DEBUG ++ fprintf (stderr, "old_bss_index %td\n", old_bss_index); ++ DEBUG_LOG (old_bss_addr); ++ DEBUG_LOG (old_bss_size); ++ DEBUG_LOG (old_bss_offset); ++ DEBUG_LOG (new_bss_addr); ++ DEBUG_LOG (new_data2_addr); ++ DEBUG_LOG (new_data2_size); ++ DEBUG_LOG (new_data2_offset); ++ DEBUG_LOG (new_data2_incr); + #endif + +- if ((uintptr_t) new_bss_addr < (uintptr_t) old_bss_addr + old_bss_size) +- fatal (".bss shrank when undumping???\n", 0, 0); ++ if (new_bss_addr < old_bss_addr + old_bss_size) ++ fatal (".bss shrank when undumping"); + + /* Set the output file to the right size. Allocate a buffer to hold + the image of the new file. Set pointers to various interesting +- objects. stat_buf still has old_file data. */ ++ objects. */ + +- new_file = open (new_name, O_RDWR | O_CREAT, 0666); ++ new_file = emacs_open (new_name, O_RDWR | O_CREAT, 0777); + if (new_file < 0) +- fatal ("Can't creat (%s): errno %d\n", new_name, errno); ++ fatal ("Can't creat (%s): %s", new_name, strerror (errno)); + +- new_file_size = stat_buf.st_size + old_file_h->e_shentsize + new_data2_incr; ++ new_file_size = old_file_size + old_file_h->e_shentsize + new_data2_incr; + + if (ftruncate (new_file, new_file_size)) +- fatal ("Can't ftruncate (%s): errno %d\n", new_name, errno); ++ fatal ("Can't ftruncate (%s): %s", new_name, strerror (errno)); + + new_base = mmap (NULL, new_file_size, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_PRIVATE, mmap_fd, 0); + if (new_base == MAP_FAILED) +- fatal ("Can't allocate buffer for %s\n", old_name, 0); ++ fatal ("Can't allocate buffer for %s: %s", old_name, strerror (errno)); + + new_file_h = (ElfW (Ehdr) *) new_base; + new_program_h = (ElfW (Phdr) *) ((byte *) new_base + old_file_h->e_phoff); +@@ -825,11 +833,11 @@ unexec (const char *new_name, const char *old_name) + new_file_h->e_shoff += new_data2_incr; + new_file_h->e_shnum += 1; + +-#ifdef DEBUG +- fprintf (stderr, "Old section offset %x\n", old_file_h->e_shoff); +- fprintf (stderr, "Old section count %d\n", old_file_h->e_shnum); +- fprintf (stderr, "New section offset %x\n", new_file_h->e_shoff); +- fprintf (stderr, "New section count %d\n", new_file_h->e_shnum); ++#ifdef UNEXELF_DEBUG ++ DEBUG_LOG (old_file_h->e_shoff); ++ fprintf (stderr, "Old section count %td\n", (ptrdiff_t) old_file_h->e_shnum); ++ DEBUG_LOG (new_file_h->e_shoff); ++ fprintf (stderr, "New section count %td\n", (ptrdiff_t) new_file_h->e_shnum); + #endif + + /* Fix up a new program header. Extend the writable data segment so +@@ -839,7 +847,7 @@ unexec (const char *new_name, const char *old_name) + to adjust the offset and address of any segment that is above + data2, just in case we decide to allow this later. */ + +- for (n = new_file_h->e_phnum - 1; n >= 0; n--) ++ for (n = new_file_h->e_phnum; --n >= 0; ) + { + /* Compute maximum of all requirements for alignment of section. */ + ElfW (Word) alignment = (NEW_PROGRAM_H (n)).p_align; +@@ -857,7 +865,7 @@ unexec (const char *new_name, const char *old_name) + > (old_sbss_index == -1 + ? old_bss_addr + : round_up (old_bss_addr, alignment))) +- fatal ("Program segment above .bss in %s\n", old_name, 0); ++ fatal ("Program segment above .bss in %s", old_name); + + if (NEW_PROGRAM_H (n).p_type == PT_LOAD + && (round_up ((NEW_PROGRAM_H (n)).p_vaddr +@@ -867,7 +875,7 @@ unexec (const char *new_name, const char *old_name) + break; + } + if (n < 0) +- fatal ("Couldn't find segment next to .bss in %s\n", old_name, 0); ++ fatal ("Couldn't find segment next to .bss in %s", old_name); + + /* Make sure that the size includes any padding before the old .bss + section. */ +@@ -875,7 +883,7 @@ unexec (const char *new_name, const char *old_name) + NEW_PROGRAM_H (n).p_memsz = NEW_PROGRAM_H (n).p_filesz; + + #if 0 /* Maybe allow section after data2 - does this ever happen? */ +- for (n = new_file_h->e_phnum - 1; n >= 0; n--) ++ for (n = new_file_h->e_phnum; --n >= 0; ) + { + if (NEW_PROGRAM_H (n).p_vaddr + && NEW_PROGRAM_H (n).p_vaddr >= new_data2_addr) +@@ -894,7 +902,7 @@ unexec (const char *new_name, const char *old_name) + + /* Walk through all section headers, insert the new data2 section right + before the new bss section. */ +- for (n = 1, nn = 1; n < (int) old_file_h->e_shnum; n++, nn++) ++ for (n = 1, nn = 1; n < old_file_h->e_shnum; n++, nn++) + { + caddr_t src; + /* If it is (s)bss section, insert the new data2 section before it. */ +@@ -1076,8 +1084,9 @@ temacs: + if (NEW_SECTION_H (nn).sh_type == SHT_MIPS_DEBUG + && old_mdebug_index != -1) + { +- int diff = NEW_SECTION_H (nn).sh_offset +- - OLD_SECTION_H (old_mdebug_index).sh_offset; ++ ptrdiff_t new_offset = NEW_SECTION_H (nn).sh_offset; ++ ptrdiff_t old_offset = OLD_SECTION_H (old_mdebug_index).sh_offset; ++ ptrdiff_t diff = new_offset - old_offset; + HDRR *phdr = (HDRR *)(NEW_SECTION_H (nn).sh_offset + new_base); + + if (diff) +@@ -1157,7 +1166,7 @@ temacs: + || NEW_SECTION_H (nn).sh_type == SHT_DYNSYM) + { + ElfW (Shdr) *spt = &NEW_SECTION_H (nn); +- unsigned int num = spt->sh_size / spt->sh_entsize; ++ ptrdiff_t num = spt->sh_size / spt->sh_entsize; + ElfW (Sym) * sym = (ElfW (Sym) *) (NEW_SECTION_H (nn).sh_offset + + new_base); + for (; num--; sym++) +@@ -1173,7 +1182,7 @@ temacs: + } + + /* Update the symbol values of _edata and _end. */ +- for (n = new_file_h->e_shnum - 1; n; n--) ++ for (n = new_file_h->e_shnum; 0 < --n; ) + { + byte *symnames; + ElfW (Sym) *symp, *symendp; +@@ -1233,7 +1242,7 @@ temacs: + + /* This loop seeks out relocation sections for the data section, so + that it can undo relocations performed by the runtime linker. */ +- for (n = new_file_h->e_shnum - 1; n; n--) ++ for (n = new_file_h->e_shnum; 0 < --n; ) + { + ElfW (Shdr) section = NEW_SECTION_H (n); + +@@ -1293,29 +1302,20 @@ temacs: + /* Write out new_file, and free the buffers. */ + + if (write (new_file, new_base, new_file_size) != new_file_size) +- fatal ("Didn't write %d bytes to %s: errno %d\n", +- new_file_size, new_name, errno); ++ fatal ("Didn't write %lu bytes to %s: %s", ++ (unsigned long) new_file_size, new_name, strerror (errno)); + munmap (old_base, old_file_size); + munmap (new_base, new_file_size); + + /* Close the files and make the new file executable. */ + + #if MAP_ANON == 0 +- close (mmap_fd); ++ emacs_close (mmap_fd); + #endif + +- if (close (old_file)) +- fatal ("Can't close (%s): errno %d\n", old_name, errno); +- +- if (close (new_file)) +- fatal ("Can't close (%s): errno %d\n", new_name, errno); +- +- if (stat (new_name, &stat_buf) == -1) +- fatal ("Can't stat (%s): errno %d\n", new_name, errno); ++ if (emacs_close (old_file) != 0) ++ fatal ("Can't close (%s): %s", old_name, strerror (errno)); + +- n = umask (777); +- umask (n); +- stat_buf.st_mode |= 0111 & ~n; +- if (chmod (new_name, stat_buf.st_mode) == -1) +- fatal ("Can't chmod (%s): errno %d\n", new_name, errno); ++ if (emacs_close (new_file) != 0) ++ fatal ("Can't close (%s): %s", new_name, strerror (errno)); + } +-- +2.7.4 + diff --git a/SOURCES/emacs-0002-ELF-unexec-Correct-section-header-index.patch b/SOURCES/emacs-0002-ELF-unexec-Correct-section-header-index.patch new file mode 100644 index 0000000..760d934 --- /dev/null +++ b/SOURCES/emacs-0002-ELF-unexec-Correct-section-header-index.patch @@ -0,0 +1,61 @@ +From acfdfce2687342a119d4fe7cae8f5d04550a9d4a Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Sun, 8 Nov 2015 09:28:59 -0800 +Subject: [PATCH 02/11] ELF unexec: Correct section header index + +First a small fix. The code incorrectly uses "NEW_SECTION_H (n)" when +it should have been using "NEW_SECTION_H (nn)" to find the name of the +section currently being processed. Of course, before the bss +sections, n and nn have the same value, so this doesn't matter except +in the case of .sbss. For .sbss this probably meant .bss (most likely +the next section) was copied from memory. A later patch removes the +bogus .sbss handling anyway. + +* unexelf.c (unexec): Use correct index to look up names. +--- + src/unexelf.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/src/unexelf.c b/src/unexelf.c +index 483da6e..1699f31 100644 +--- a/src/unexelf.c ++++ b/src/unexelf.c +@@ -1015,12 +1015,12 @@ temacs: + /* Write out the sections. .data and .data1 (and data2, called + ".data" in the strings table) get copied from the current process + instead of the old file. */ +- if (!strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data") +- || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name), ++ if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".data") ++ || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), + ".sdata") +- || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name), ++ || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), + ".lit4") +- || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name), ++ || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), + ".lit8") + /* The conditional bit below was in Oliva's original code + (1999-08-25) and seems to have been dropped by mistake +@@ -1043,14 +1043,14 @@ temacs: + loader, but I never got anywhere with an SGI support call + seeking clues. -- fx 2002-11-29. */ + #ifdef IRIX6_5 +- || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name), ++ || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), + ".got") + #endif +- || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name), ++ || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), + ".sdata1") +- || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name), ++ || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), + ".data1") +- || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name), ++ || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), + ".sbss")) + src = (caddr_t) OLD_SECTION_H (n).sh_addr; + else +-- +2.7.4 + diff --git a/SOURCES/emacs-0003-ELF-unexec-Tidy-code.patch b/SOURCES/emacs-0003-ELF-unexec-Tidy-code.patch new file mode 100644 index 0000000..7ecaa3a --- /dev/null +++ b/SOURCES/emacs-0003-ELF-unexec-Tidy-code.patch @@ -0,0 +1,414 @@ +From c7ffdf36d7eb5ed8044818902d4c69516d09dbb2 Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Sun, 8 Nov 2015 09:28:59 -0800 +Subject: [PATCH 03/11] ELF unexec: Tidy code + +Separate out some of the more mechanical changes so following patches +are smaller. + +* unexelf.c (unexec): Rearrange initialisation of program +header vars. Use pointer vars in loops rather than indexing +section header array via macros. Simplify _OBJC_ sym code +and reloc handling code. +--- + src/unexelf.c | 210 +++++++++++++++++++++++++++------------------------------- + 1 file changed, 96 insertions(+), 114 deletions(-) + +diff --git a/src/unexelf.c b/src/unexelf.c +index 1699f31..d6c6648 100644 +--- a/src/unexelf.c ++++ b/src/unexelf.c +@@ -812,20 +812,11 @@ unexec (const char *new_name, const char *old_name) + if (new_base == MAP_FAILED) + fatal ("Can't allocate buffer for %s: %s", old_name, strerror (errno)); + +- new_file_h = (ElfW (Ehdr) *) new_base; +- new_program_h = (ElfW (Phdr) *) ((byte *) new_base + old_file_h->e_phoff); +- new_section_h = (ElfW (Shdr) *) +- ((byte *) new_base + old_file_h->e_shoff + new_data2_incr); +- + /* Make our new file, program and section headers as copies of the + originals. */ + ++ new_file_h = (ElfW (Ehdr) *) new_base; + memcpy (new_file_h, old_file_h, old_file_h->e_ehsize); +- memcpy (new_program_h, old_program_h, +- old_file_h->e_phnum * old_file_h->e_phentsize); +- +- /* Modify the e_shstrndx if necessary. */ +- PATCH_INDEX (new_file_h->e_shstrndx); + + /* Fix up file header. We'll add one section. Section header is + further away now. */ +@@ -833,6 +824,16 @@ unexec (const char *new_name, const char *old_name) + new_file_h->e_shoff += new_data2_incr; + new_file_h->e_shnum += 1; + ++ /* Modify the e_shstrndx if necessary. */ ++ PATCH_INDEX (new_file_h->e_shstrndx); ++ ++ new_program_h = (ElfW (Phdr) *) ((byte *) new_base + old_file_h->e_phoff); ++ new_section_h = (ElfW (Shdr) *) ++ ((byte *) new_base + old_file_h->e_shoff + new_data2_incr); ++ ++ memcpy (new_program_h, old_program_h, ++ old_file_h->e_phnum * old_file_h->e_phentsize); ++ + #ifdef UNEXELF_DEBUG + DEBUG_LOG (old_file_h->e_shoff); + fprintf (stderr, "Old section count %td\n", (ptrdiff_t) old_file_h->e_shnum); +@@ -905,32 +906,35 @@ unexec (const char *new_name, const char *old_name) + for (n = 1, nn = 1; n < old_file_h->e_shnum; n++, nn++) + { + caddr_t src; ++ ElfW (Shdr) *old_shdr = &OLD_SECTION_H (n); ++ ElfW (Shdr) *new_shdr = &NEW_SECTION_H (nn); ++ + /* If it is (s)bss section, insert the new data2 section before it. */ + /* new_data2_index is the index of either old_sbss or old_bss, that was + chosen as a section for new_data2. */ + if (n == new_data2_index) + { + /* Steal the data section header for this data2 section. */ +- memcpy (&NEW_SECTION_H (nn), &OLD_SECTION_H (old_data_index), ++ memcpy (new_shdr, &OLD_SECTION_H (old_data_index), + new_file_h->e_shentsize); + +- NEW_SECTION_H (nn).sh_addr = new_data2_addr; +- NEW_SECTION_H (nn).sh_offset = new_data2_offset; +- NEW_SECTION_H (nn).sh_size = new_data2_size; ++ new_shdr->sh_addr = new_data2_addr; ++ new_shdr->sh_offset = new_data2_offset; ++ new_shdr->sh_size = new_data2_size; + /* Use the bss section's alignment. This will assure that the + new data2 section always be placed in the same spot as the old + bss section by any other application. */ +- NEW_SECTION_H (nn).sh_addralign = OLD_SECTION_H (n).sh_addralign; ++ new_shdr->sh_addralign = old_shdr->sh_addralign; + + /* Now copy over what we have in the memory now. */ +- memcpy (NEW_SECTION_H (nn).sh_offset + new_base, +- (caddr_t) OLD_SECTION_H (n).sh_addr, ++ memcpy (new_shdr->sh_offset + new_base, ++ (caddr_t) old_shdr->sh_addr, + new_data2_size); + nn++; ++ new_shdr++; + } + +- memcpy (&NEW_SECTION_H (nn), &OLD_SECTION_H (n), +- old_file_h->e_shentsize); ++ memcpy (new_shdr, old_shdr, old_file_h->e_shentsize); + + if (n == old_bss_index + /* The new bss and sbss section's size is zero, and its file offset +@@ -939,13 +943,13 @@ unexec (const char *new_name, const char *old_name) + ) + { + /* NN should be `old_s?bss_index + 1' at this point. */ +- NEW_SECTION_H (nn).sh_offset = new_data2_offset + new_data2_size; +- NEW_SECTION_H (nn).sh_addr = new_data2_addr + new_data2_size; ++ new_shdr->sh_offset = new_data2_offset + new_data2_size; ++ new_shdr->sh_addr = new_data2_addr + new_data2_size; + /* Let the new bss section address alignment be the same as the + section address alignment followed the old bss section, so + this section will be placed in exactly the same place. */ +- NEW_SECTION_H (nn).sh_addralign = OLD_SECTION_H (nn).sh_addralign; +- NEW_SECTION_H (nn).sh_size = 0; ++ new_shdr->sh_addralign = OLD_SECTION_H (nn).sh_addralign; ++ new_shdr->sh_size = 0; + } + else + { +@@ -975,53 +979,50 @@ temacs: + 25 1709 0x4 0x10 + */ + +- if (NEW_SECTION_H (nn).sh_offset >= old_bss_offset +- || (NEW_SECTION_H (nn).sh_offset + NEW_SECTION_H (nn).sh_size ++ if (new_shdr->sh_offset >= old_bss_offset ++ || (new_shdr->sh_offset + new_shdr->sh_size + > new_data2_offset)) +- NEW_SECTION_H (nn).sh_offset += new_data2_incr; ++ new_shdr->sh_offset += new_data2_incr; + + /* Any section that was originally placed after the section + header table should now be off by the size of one section + header table entry. */ +- if (NEW_SECTION_H (nn).sh_offset > new_file_h->e_shoff) +- NEW_SECTION_H (nn).sh_offset += new_file_h->e_shentsize; ++ if (new_shdr->sh_offset > new_file_h->e_shoff) ++ new_shdr->sh_offset += new_file_h->e_shentsize; + } + + /* If any section hdr refers to the section after the new .data + section, make it refer to next one because we have inserted + a new section in between. */ + +- PATCH_INDEX (NEW_SECTION_H (nn).sh_link); ++ PATCH_INDEX (new_shdr->sh_link); + /* For symbol tables, info is a symbol table index, + so don't change it. */ +- if (NEW_SECTION_H (nn).sh_type != SHT_SYMTAB +- && NEW_SECTION_H (nn).sh_type != SHT_DYNSYM) +- PATCH_INDEX (NEW_SECTION_H (nn).sh_info); ++ if (new_shdr->sh_type != SHT_SYMTAB ++ && new_shdr->sh_type != SHT_DYNSYM) ++ PATCH_INDEX (new_shdr->sh_info); + + if (old_sbss_index != -1) +- if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".sbss")) ++ if (!strcmp (old_section_names + new_shdr->sh_name, ".sbss")) + { +- NEW_SECTION_H (nn).sh_offset = +- round_up (NEW_SECTION_H (nn).sh_offset, +- NEW_SECTION_H (nn).sh_addralign); +- NEW_SECTION_H (nn).sh_type = SHT_PROGBITS; ++ new_shdr->sh_offset = ++ round_up (new_shdr->sh_offset, ++ new_shdr->sh_addralign); ++ new_shdr->sh_type = SHT_PROGBITS; + } + + /* Now, start to copy the content of sections. */ +- if (NEW_SECTION_H (nn).sh_type == SHT_NULL +- || NEW_SECTION_H (nn).sh_type == SHT_NOBITS) ++ if (new_shdr->sh_type == SHT_NULL ++ || new_shdr->sh_type == SHT_NOBITS) + continue; + + /* Write out the sections. .data and .data1 (and data2, called + ".data" in the strings table) get copied from the current process + instead of the old file. */ +- if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".data") +- || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), +- ".sdata") +- || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), +- ".lit4") +- || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), +- ".lit8") ++ if (!strcmp (old_section_names + new_shdr->sh_name, ".data") ++ || !strcmp (old_section_names + new_shdr->sh_name, ".sdata") ++ || !strcmp (old_section_names + new_shdr->sh_name, ".lit4") ++ || !strcmp (old_section_names + new_shdr->sh_name, ".lit8") + /* The conditional bit below was in Oliva's original code + (1999-08-25) and seems to have been dropped by mistake + subsequently. It prevents a crash at startup under X in +@@ -1043,28 +1044,22 @@ temacs: + loader, but I never got anywhere with an SGI support call + seeking clues. -- fx 2002-11-29. */ + #ifdef IRIX6_5 +- || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), +- ".got") ++ || !strcmp (old_section_names + new_shdr->sh_name, ".got") + #endif +- || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), +- ".sdata1") +- || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), +- ".data1") +- || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), +- ".sbss")) +- src = (caddr_t) OLD_SECTION_H (n).sh_addr; ++ || !strcmp (old_section_names + new_shdr->sh_name, ".sdata1") ++ || !strcmp (old_section_names + new_shdr->sh_name, ".data1") ++ || !strcmp (old_section_names + new_shdr->sh_name, ".sbss")) ++ src = (caddr_t) old_shdr->sh_addr; + else +- src = old_base + OLD_SECTION_H (n).sh_offset; ++ src = old_base + old_shdr->sh_offset; + +- memcpy (NEW_SECTION_H (nn).sh_offset + new_base, src, +- NEW_SECTION_H (nn).sh_size); ++ memcpy (new_shdr->sh_offset + new_base, src, new_shdr->sh_size); + + #if defined __alpha__ && !defined __OpenBSD__ + /* Update Alpha COFF symbol table: */ +- if (strcmp (old_section_names + OLD_SECTION_H (n).sh_name, ".mdebug") +- == 0) ++ if (strcmp (old_section_names + old_shdr->sh_name, ".mdebug") == 0) + { +- pHDRR symhdr = (pHDRR) (NEW_SECTION_H (nn).sh_offset + new_base); ++ pHDRR symhdr = (pHDRR) (new_shdr->sh_offset + new_base); + + symhdr->cbLineOffset += new_data2_size; + symhdr->cbDnOffset += new_data2_size; +@@ -1081,13 +1076,13 @@ temacs: + #endif /* __alpha__ && !__OpenBSD__ */ + + #if defined (_SYSTYPE_SYSV) +- if (NEW_SECTION_H (nn).sh_type == SHT_MIPS_DEBUG ++ if (new_shdr->sh_type == SHT_MIPS_DEBUG + && old_mdebug_index != -1) + { +- ptrdiff_t new_offset = NEW_SECTION_H (nn).sh_offset; ++ ptrdiff_t new_offset = new_shdr->sh_offset; + ptrdiff_t old_offset = OLD_SECTION_H (old_mdebug_index).sh_offset; + ptrdiff_t diff = new_offset - old_offset; +- HDRR *phdr = (HDRR *)(NEW_SECTION_H (nn).sh_offset + new_base); ++ HDRR *phdr = (HDRR *) (new_shdr->sh_offset + new_base); + + if (diff) + { +@@ -1123,8 +1118,8 @@ temacs: + n_phdrr->__fileaddr += movement; \ + } + +- HDRR * o_phdrr = (HDRR *)((byte *)old_base + OLD_SECTION_H (n).sh_offset); +- HDRR * n_phdrr = (HDRR *)((byte *)new_base + NEW_SECTION_H (nn).sh_offset); ++ HDRR *o_phdrr = (HDRR *) ((byte *) old_base + old_shdr->sh_offset); ++ HDRR *n_phdrr = (HDRR *) ((byte *) new_base + new_shdr->sh_offset); + unsigned movement = new_data2_size; + + MDEBUGADJUST (idnMax, cbDnOffset); +@@ -1141,8 +1136,8 @@ temacs: + requires special handling. */ + if (n_phdrr->cbLine > 0) + { +- if (o_phdrr->cbLineOffset > (OLD_SECTION_H (n).sh_offset +- + OLD_SECTION_H (n).sh_size)) ++ if (o_phdrr->cbLineOffset > (old_shdr->sh_offset ++ + old_shdr->sh_size)) + { + /* line data is in a hole in elf. do special copy and adjust + for this ld mistake. +@@ -1162,13 +1157,11 @@ temacs: + #endif /* __sgi */ + + /* If it is the symbol table, its st_shndx field needs to be patched. */ +- if (NEW_SECTION_H (nn).sh_type == SHT_SYMTAB +- || NEW_SECTION_H (nn).sh_type == SHT_DYNSYM) ++ if (new_shdr->sh_type == SHT_SYMTAB ++ || new_shdr->sh_type == SHT_DYNSYM) + { +- ElfW (Shdr) *spt = &NEW_SECTION_H (nn); +- ptrdiff_t num = spt->sh_size / spt->sh_entsize; +- ElfW (Sym) * sym = (ElfW (Sym) *) (NEW_SECTION_H (nn).sh_offset + +- new_base); ++ ptrdiff_t num = new_shdr->sh_size / new_shdr->sh_entsize; ++ ElfW (Sym) *sym = (ElfW (Sym) *) (new_shdr->sh_offset + new_base); + for (; num--; sym++) + { + if ((sym->st_shndx == SHN_UNDEF) +@@ -1186,15 +1179,16 @@ temacs: + { + byte *symnames; + ElfW (Sym) *symp, *symendp; ++ ElfW (Shdr) *sym_shdr = &NEW_SECTION_H (n); + +- if (NEW_SECTION_H (n).sh_type != SHT_DYNSYM +- && NEW_SECTION_H (n).sh_type != SHT_SYMTAB) ++ if (sym_shdr->sh_type != SHT_DYNSYM ++ && sym_shdr->sh_type != SHT_SYMTAB) + continue; + + symnames = ((byte *) new_base +- + NEW_SECTION_H (NEW_SECTION_H (n).sh_link).sh_offset); +- symp = (ElfW (Sym) *) (NEW_SECTION_H (n).sh_offset + new_base); +- symendp = (ElfW (Sym) *) ((byte *)symp + NEW_SECTION_H (n).sh_size); ++ + NEW_SECTION_H (sym_shdr->sh_link).sh_offset); ++ symp = (ElfW (Sym) *) (sym_shdr->sh_offset + new_base); ++ symendp = (ElfW (Sym) *) ((byte *) symp + sym_shdr->sh_size); + + for (; symp < symendp; symp ++) + { +@@ -1218,22 +1212,21 @@ temacs: + if (strncmp ((char *) (symnames + symp->st_name), + "_OBJC_", sizeof ("_OBJC_") - 1) == 0) + { +- caddr_t old, new; ++ ElfW (Shdr) *new_shdr = &NEW_SECTION_H (symp->st_shndx); ++ ptrdiff_t reladdr = symp->st_value - new_shdr->sh_addr; ++ ptrdiff_t newoff = reladdr + new_shdr->sh_offset; + +- new = ((symp->st_value - NEW_SECTION_H (symp->st_shndx).sh_addr) +- + NEW_SECTION_H (symp->st_shndx).sh_offset + new_base); + /* "Unpatch" index. */ + nn = symp->st_shndx; + if (nn > old_bss_index) + nn--; + if (nn == old_bss_index) +- memset (new, 0, symp->st_size); ++ memset (new_base + newoff, 0, symp->st_size); + else + { +- old = ((symp->st_value +- - NEW_SECTION_H (symp->st_shndx).sh_addr) +- + OLD_SECTION_H (nn).sh_offset + old_base); +- memcpy (new, old, symp->st_size); ++ ElfW (Shdr) *old_shdr = &OLD_SECTION_H (nn); ++ ptrdiff_t oldoff = reladdr + old_shdr->sh_offset; ++ memcpy (new_base + newoff, old_base + oldoff, symp->st_size); + } + } + #endif +@@ -1244,13 +1237,10 @@ temacs: + that it can undo relocations performed by the runtime linker. */ + for (n = new_file_h->e_shnum; 0 < --n; ) + { +- ElfW (Shdr) section = NEW_SECTION_H (n); +- +- /* Cause a compilation error if anyone uses n instead of nn below. */ +- #define n ((void) 0); +- n /* Prevent 'macro "n" is not used' warnings. */ ++ ElfW (Shdr) *rel_shdr = &NEW_SECTION_H (n); ++ ElfW (Shdr) *shdr; + +- switch (section.sh_type) ++ switch (rel_shdr->sh_type) + { + default: + break; +@@ -1259,28 +1249,22 @@ temacs: + /* This code handles two different size structs, but there should + be no harm in that provided that r_offset is always the first + member. */ +- nn = section.sh_info; +- if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".data") +- || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), +- ".sdata") +- || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), +- ".lit4") +- || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), +- ".lit8") ++ shdr = &NEW_SECTION_H (rel_shdr->sh_info); ++ if (!strcmp (old_section_names + shdr->sh_name, ".data") ++ || !strcmp (old_section_names + shdr->sh_name, ".sdata") ++ || !strcmp (old_section_names + shdr->sh_name, ".lit4") ++ || !strcmp (old_section_names + shdr->sh_name, ".lit8") + #ifdef IRIX6_5 /* see above */ +- || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), +- ".got") ++ || !strcmp (old_section_names + shdr->sh_name, ".got") + #endif +- || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), +- ".sdata1") +- || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), +- ".data1")) ++ || !strcmp (old_section_names + shdr->sh_name, ".sdata1") ++ || !strcmp (old_section_names + shdr->sh_name, ".data1")) + { +- ElfW (Addr) offset = (NEW_SECTION_H (nn).sh_addr +- - NEW_SECTION_H (nn).sh_offset); +- caddr_t reloc = old_base + section.sh_offset, end; +- for (end = reloc + section.sh_size; reloc < end; +- reloc += section.sh_entsize) ++ ElfW (Addr) offset = shdr->sh_addr - shdr->sh_offset; ++ caddr_t reloc = old_base + rel_shdr->sh_offset, end; ++ for (end = reloc + rel_shdr->sh_size; ++ reloc < end; ++ reloc += rel_shdr->sh_entsize) + { + ElfW (Addr) addr = ((ElfW (Rel) *) reloc)->r_offset - offset; + #ifdef __alpha__ +@@ -1295,8 +1279,6 @@ temacs: + } + break; + } +- +- #undef n + } + + /* Write out new_file, and free the buffers. */ +-- +2.7.4 + diff --git a/SOURCES/emacs-0004-ELF-unexec-Merge-Alpha-and-MIPS-COFF-debug-handling.patch b/SOURCES/emacs-0004-ELF-unexec-Merge-Alpha-and-MIPS-COFF-debug-handling.patch new file mode 100644 index 0000000..1a58328 --- /dev/null +++ b/SOURCES/emacs-0004-ELF-unexec-Merge-Alpha-and-MIPS-COFF-debug-handling.patch @@ -0,0 +1,166 @@ +From 14e5f5be6a45f6d238a47b117d9dc9e3eb36a380 Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Sun, 8 Nov 2015 09:28:59 -0800 +Subject: [PATCH 04/11] ELF unexec: Merge Alpha and MIPS COFF debug handling + +* unexelf.c (unexec): Merge Alpha and MIPS COFF debug handling. +Don't find .mdebug section index, find the section in the loop. +Allow for unlikely possibility that .mdebug is located at sh_offset +before bss segment, by calculating move from difference in +sh_offset rather than just assuming new_data2_size. Simplify +cbLineOffset handling. +--- + src/unexelf.c | 96 ++++++++++++++++++----------------------------------------- + 1 file changed, 29 insertions(+), 67 deletions(-) + +diff --git a/src/unexelf.c b/src/unexelf.c +index d6c6648..0065491 100644 +--- a/src/unexelf.c ++++ b/src/unexelf.c +@@ -660,9 +660,6 @@ unexec (const char *new_name, const char *old_name) + ptrdiff_t n, nn; + ptrdiff_t old_bss_index, old_sbss_index, old_plt_index; + ptrdiff_t old_data_index, new_data2_index; +-#if defined _SYSTYPE_SYSV || defined __sgi +- ptrdiff_t old_mdebug_index; +-#endif + struct stat stat_buf; + off_t old_file_size; + +@@ -706,13 +703,6 @@ unexec (const char *new_name, const char *old_name) + old_section_names = (char *) old_base + + OLD_SECTION_H (old_file_h->e_shstrndx).sh_offset; + +- /* Find the mdebug section, if any. */ +- +-#if defined _SYSTYPE_SYSV || defined __sgi +- old_mdebug_index = find_section (".mdebug", old_section_names, +- old_name, old_file_h, old_section_h, 1); +-#endif +- + /* Find the old .bss section. Figure out parameters of the new + data2 and bss sections. */ + +@@ -1055,51 +1045,31 @@ temacs: + + memcpy (new_shdr->sh_offset + new_base, src, new_shdr->sh_size); + +-#if defined __alpha__ && !defined __OpenBSD__ +- /* Update Alpha COFF symbol table: */ +- if (strcmp (old_section_names + old_shdr->sh_name, ".mdebug") == 0) +- { +- pHDRR symhdr = (pHDRR) (new_shdr->sh_offset + new_base); +- +- symhdr->cbLineOffset += new_data2_size; +- symhdr->cbDnOffset += new_data2_size; +- symhdr->cbPdOffset += new_data2_size; +- symhdr->cbSymOffset += new_data2_size; +- symhdr->cbOptOffset += new_data2_size; +- symhdr->cbAuxOffset += new_data2_size; +- symhdr->cbSsOffset += new_data2_size; +- symhdr->cbSsExtOffset += new_data2_size; +- symhdr->cbFdOffset += new_data2_size; +- symhdr->cbRfdOffset += new_data2_size; +- symhdr->cbExtOffset += new_data2_size; +- } +-#endif /* __alpha__ && !__OpenBSD__ */ +- +-#if defined (_SYSTYPE_SYSV) +- if (new_shdr->sh_type == SHT_MIPS_DEBUG +- && old_mdebug_index != -1) ++#if (defined __alpha__ && !defined __OpenBSD__) || defined _SYSTYPE_SYSV ++ /* Update Alpha and MIPS COFF debug symbol table. */ ++ if (strcmp (old_section_names + new_shdr->sh_name, ".mdebug") == 0 ++ && new_shdr->sh_offset - old_shdr->sh_offset != 0 ++#if defined _SYSTYPE_SYSV ++ && new_shdr->sh_type == SHT_MIPS_DEBUG ++#endif ++ ) + { +- ptrdiff_t new_offset = new_shdr->sh_offset; +- ptrdiff_t old_offset = OLD_SECTION_H (old_mdebug_index).sh_offset; +- ptrdiff_t diff = new_offset - old_offset; ++ ptrdiff_t diff = new_shdr->sh_offset - old_shdr->sh_offset; + HDRR *phdr = (HDRR *) (new_shdr->sh_offset + new_base); + +- if (diff) +- { +- phdr->cbLineOffset += diff; +- phdr->cbDnOffset += diff; +- phdr->cbPdOffset += diff; +- phdr->cbSymOffset += diff; +- phdr->cbOptOffset += diff; +- phdr->cbAuxOffset += diff; +- phdr->cbSsOffset += diff; +- phdr->cbSsExtOffset += diff; +- phdr->cbFdOffset += diff; +- phdr->cbRfdOffset += diff; +- phdr->cbExtOffset += diff; +- } ++ phdr->cbLineOffset += diff; ++ phdr->cbDnOffset += diff; ++ phdr->cbPdOffset += diff; ++ phdr->cbSymOffset += diff; ++ phdr->cbOptOffset += diff; ++ phdr->cbAuxOffset += diff; ++ phdr->cbSsOffset += diff; ++ phdr->cbSsExtOffset += diff; ++ phdr->cbFdOffset += diff; ++ phdr->cbRfdOffset += diff; ++ phdr->cbExtOffset += diff; + } +-#endif /* _SYSTYPE_SYSV */ ++#endif /* __alpha__ || _SYSTYPE_SYSV */ + + #if __sgi + /* Adjust the HDRR offsets in .mdebug and copy the +@@ -1110,7 +1080,8 @@ temacs: + the ld bug that gets the line table in a hole in the + elf file rather than in the .mdebug section proper. + David Anderson. davea@sgi.com Jan 16,1994. */ +- if (n == old_mdebug_index) ++ if (strcmp (old_section_names + new_shdr->sh_name, ".mdebug") == 0 ++ && new_shdr->sh_offset - old_shdr->sh_offset != 0) + { + #define MDEBUGADJUST(__ct,__fileaddr) \ + if (n_phdrr->__ct > 0) \ +@@ -1120,7 +1091,7 @@ temacs: + + HDRR *o_phdrr = (HDRR *) ((byte *) old_base + old_shdr->sh_offset); + HDRR *n_phdrr = (HDRR *) ((byte *) new_base + new_shdr->sh_offset); +- unsigned movement = new_data2_size; ++ ptrdiff_t movement = new_shdr->sh_offset - old_shdr->sh_offset; + + MDEBUGADJUST (idnMax, cbDnOffset); + MDEBUGADJUST (ipdMax, cbPdOffset); +@@ -1136,22 +1107,13 @@ temacs: + requires special handling. */ + if (n_phdrr->cbLine > 0) + { ++ n_phdrr->cbLineOffset += movement; ++ + if (o_phdrr->cbLineOffset > (old_shdr->sh_offset + + old_shdr->sh_size)) +- { +- /* line data is in a hole in elf. do special copy and adjust +- for this ld mistake. +- */ +- n_phdrr->cbLineOffset += movement; +- +- memcpy (n_phdrr->cbLineOffset + new_base, +- o_phdrr->cbLineOffset + old_base, n_phdrr->cbLine); +- } +- else +- { +- /* somehow line data is in .mdebug as it is supposed to be. */ +- MDEBUGADJUST (cbLine, cbLineOffset); +- } ++ /* If not covered by section, it hasn't yet been copied. */ ++ memcpy (n_phdrr->cbLineOffset + new_base, ++ o_phdrr->cbLineOffset + old_base, n_phdrr->cbLine); + } + } + #endif /* __sgi */ +-- +2.7.4 + diff --git a/SOURCES/emacs-0005-ELF-unexec-Symbol-table-patching.patch b/SOURCES/emacs-0005-ELF-unexec-Symbol-table-patching.patch new file mode 100644 index 0000000..14e07f7 --- /dev/null +++ b/SOURCES/emacs-0005-ELF-unexec-Symbol-table-patching.patch @@ -0,0 +1,42 @@ +From b99e034e9696f745d8da4742251bb538e0841f63 Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Sun, 8 Nov 2015 09:29:00 -0800 +Subject: [PATCH 05/11] ELF unexec: Symbol table patching + +No st_shndx value larger than SHN_LORESERVE should be changed. +* unexelf.c (unexec): Don't adjust any st_shndx larger than +SHN_LORESERVE. Error on SHN_XINDEX. +--- + src/unexelf.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/src/unexelf.c b/src/unexelf.c +index 0065491..286ba2e 100644 +--- a/src/unexelf.c ++++ b/src/unexelf.c +@@ -1118,7 +1118,7 @@ temacs: + } + #endif /* __sgi */ + +- /* If it is the symbol table, its st_shndx field needs to be patched. */ ++ /* Patch st_shndx field of symbol table. */ + if (new_shdr->sh_type == SHT_SYMTAB + || new_shdr->sh_type == SHT_DYNSYM) + { +@@ -1126,9 +1126,10 @@ temacs: + ElfW (Sym) *sym = (ElfW (Sym) *) (new_shdr->sh_offset + new_base); + for (; num--; sym++) + { +- if ((sym->st_shndx == SHN_UNDEF) +- || (sym->st_shndx == SHN_ABS) +- || (sym->st_shndx == SHN_COMMON)) ++ if (sym->st_shndx == SHN_XINDEX) ++ fatal ("SHT_SYMTAB_SHNDX unsupported"); ++ if (sym->st_shndx == SHN_UNDEF ++ || sym->st_shndx >= SHN_LORESERVE) + continue; + + PATCH_INDEX (sym->st_shndx); +-- +2.7.4 + diff --git a/SOURCES/emacs-0006-ELF-unexec-_OBJC_-symbols-in-bss-sections.patch b/SOURCES/emacs-0006-ELF-unexec-_OBJC_-symbols-in-bss-sections.patch new file mode 100644 index 0000000..bc6e417 --- /dev/null +++ b/SOURCES/emacs-0006-ELF-unexec-_OBJC_-symbols-in-bss-sections.patch @@ -0,0 +1,62 @@ +From 8c30fba366c6814c7bb1795fdda16265eb48efb0 Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Sun, 8 Nov 2015 09:29:00 -0800 +Subject: [PATCH 06/11] ELF unexec: _OBJC_ symbols in bss sections + +This code assumed that there was only one bss section. Rather than +checking for a particular index, check the section type. Also, handle +the possibility that the section was SHT_NOBITS originally and is +unchanged, in which case no clearing is needed (and sh_offset isn't +necessarily valid, which can lead to a wild memset). + +* unexelf.c (unexec): Properly handle _OBJC_ symbols in bss sections. +--- + src/unexelf.c | 31 ++++++++++++++++++------------- + 1 file changed, 18 insertions(+), 13 deletions(-) + +diff --git a/src/unexelf.c b/src/unexelf.c +index 286ba2e..df99f92 100644 +--- a/src/unexelf.c ++++ b/src/unexelf.c +@@ -1176,20 +1176,25 @@ temacs: + "_OBJC_", sizeof ("_OBJC_") - 1) == 0) + { + ElfW (Shdr) *new_shdr = &NEW_SECTION_H (symp->st_shndx); +- ptrdiff_t reladdr = symp->st_value - new_shdr->sh_addr; +- ptrdiff_t newoff = reladdr + new_shdr->sh_offset; +- +- /* "Unpatch" index. */ +- nn = symp->st_shndx; +- if (nn > old_bss_index) +- nn--; +- if (nn == old_bss_index) +- memset (new_base + newoff, 0, symp->st_size); +- else ++ if (new_shdr->sh_type != SHT_NOBITS) + { +- ElfW (Shdr) *old_shdr = &OLD_SECTION_H (nn); +- ptrdiff_t oldoff = reladdr + old_shdr->sh_offset; +- memcpy (new_base + newoff, old_base + oldoff, symp->st_size); ++ ElfW (Shdr) *old_shdr; ++ ptrdiff_t reladdr = symp->st_value - new_shdr->sh_addr; ++ ptrdiff_t newoff = reladdr + new_shdr->sh_offset; ++ ++ /* "Unpatch" index. */ ++ nn = symp->st_shndx; ++ if (nn > old_bss_index) ++ nn--; ++ old_shdr = &OLD_SECTION_H (nn); ++ if (old_shdr->sh_type == SHT_NOBITS) ++ memset (new_base + newoff, 0, symp->st_size); ++ else ++ { ++ ptrdiff_t oldoff = reladdr + old_shdr->sh_offset; ++ memcpy (new_base + newoff, old_base + oldoff, ++ symp->st_size); ++ } + } + } + #endif +-- +2.7.4 + diff --git a/SOURCES/emacs-0007-ELF-unexec-R_-_NONE-relocs.patch b/SOURCES/emacs-0007-ELF-unexec-R_-_NONE-relocs.patch new file mode 100644 index 0000000..fd39f28 --- /dev/null +++ b/SOURCES/emacs-0007-ELF-unexec-R_-_NONE-relocs.patch @@ -0,0 +1,50 @@ +From c00b42d59c296ef9b0660afd7b31e1d3c10972e7 Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Sun, 8 Nov 2015 09:29:00 -0800 +Subject: [PATCH 07/11] ELF unexec: R_*_NONE relocs + +These should be ignored on all targets. + +* unexelf.c (unexec): Ignore R_*_NONE relocs for any target, +not just Alpha. Comment on reloc size assumption. +--- + src/unexelf.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/src/unexelf.c b/src/unexelf.c +index df99f92..15a4cde 100644 +--- a/src/unexelf.c ++++ b/src/unexelf.c +@@ -1202,7 +1202,7 @@ temacs: + } + + /* This loop seeks out relocation sections for the data section, so +- that it can undo relocations performed by the runtime linker. */ ++ that it can undo relocations performed by the runtime loader. */ + for (n = new_file_h->e_shnum; 0 < --n; ) + { + ElfW (Shdr) *rel_shdr = &NEW_SECTION_H (n); +@@ -1235,14 +1235,14 @@ temacs: + reloc += rel_shdr->sh_entsize) + { + ElfW (Addr) addr = ((ElfW (Rel) *) reloc)->r_offset - offset; +-#ifdef __alpha__ +- /* The Alpha ELF binutils currently have a bug that +- sometimes results in relocs that contain all +- zeroes. Work around this for now... */ ++ /* Ignore R_*_NONE relocs. */ + if (((ElfW (Rel) *) reloc)->r_offset == 0) + continue; +-#endif +- memcpy (new_base + addr, old_base + addr, sizeof (ElfW (Addr))); ++ /* Assume reloc applies to a word. ++ ??? This is not always true, eg. TLS module/index ++ pair in .got which occupies two words. */ ++ memcpy (new_base + addr, old_base + addr, ++ sizeof (ElfW (Addr))); + } + } + break; +-- +2.7.4 + diff --git a/SOURCES/emacs-0008-ELF-unexec-Drive-from-PT_LOAD-header-rather-than-sec.patch b/SOURCES/emacs-0008-ELF-unexec-Drive-from-PT_LOAD-header-rather-than-sec.patch new file mode 100644 index 0000000..b64e361 --- /dev/null +++ b/SOURCES/emacs-0008-ELF-unexec-Drive-from-PT_LOAD-header-rather-than-sec.patch @@ -0,0 +1,473 @@ +From a2085a540975a1e6660dbc3b0c092789f002703e Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Sun, 8 Nov 2015 09:29:00 -0800 +Subject: [PATCH 08/11] ELF unexec: Drive from PT_LOAD header rather than + sections + +This rewrites bss handling in the ELF unexec code. Finding bss +sections by name results in complicated code that +- does not account for all names of possible bss sections, +- assumes specific ordering of bss sections, +- can wrongly choose a SHT_NOBITS section not in the bss segment, +- incorrectly calculates bss size (no accounting for alignment gaps), +- assumes .data and .bss are in the same segment. + +All of these problems and more are solved by finding the bss segment +in PT_LOAD headers, ie. the address range included in p_memsz but not +p_filesz of the last PT_LOAD header, then matching SHT_NOBITS sections +in that address range. + +* unexelf.c: Delete old ppc comment. +(OLD_PROGRAM_H): Define. +(round_up): Delete. +(unexec): Don't search for bss style sections by name. Instead, +use the last PT_LOAD header address range covered by p_memsz +but not p_filesz and match any SHT_NOBITS section in that +address range. Simplify initialisation of section header vars. +Don't assume that section headers are above bss segment. Move +copying of bss area out of section loop. Align .data2 section +to 1, since it now covers the entire bss area. For SHT_NOBITS +sections in the bss segment, leave sh_addr and sh_addralign +unchanged, but correct sh_offset. Clear memory corresponding +to SHT_NOBITS .plt section. Delete comment and hacks for +sections partly overlapping bss range now that the full range +is properly calculated. Delete now dead .sbss code. +(Bug#20614) +--- + src/unexelf.c | 290 ++++++++++++++++------------------------------------------ + 1 file changed, 77 insertions(+), 213 deletions(-) + +diff --git a/src/unexelf.c b/src/unexelf.c +index 15a4cde..4e9c50d 100644 +--- a/src/unexelf.c ++++ b/src/unexelf.c +@@ -535,29 +535,6 @@ verify ((! TYPE_SIGNED (ElfW (Half)) + /* Get the address of a particular section or program header entry, + * accounting for the size of the entries. + */ +-/* +- On PPC Reference Platform running Solaris 2.5.1 +- the plt section is also of type NOBI like the bss section. +- (not really stored) and therefore sections after the bss +- section start at the plt offset. The plt section is always +- the one just before the bss section. +- Thus, we modify the test from +- if (NEW_SECTION_H (nn).sh_offset >= new_data2_offset) +- to +- if (NEW_SECTION_H (nn).sh_offset >= +- OLD_SECTION_H (old_bss_index-1).sh_offset) +- This is just a hack. We should put the new data section +- before the .plt section. +- And we should not have this routine at all but use +- the libelf library to read the old file and create the new +- file. +- The changed code is minimal and depends on prep set in m/prep.h +- Erik Deumens +- Quantum Theory Project +- University of Florida +- deumens@qtp.ufl.edu +- Apr 23, 1996 +- */ + + static void * + entry_address (void *section_h, ptrdiff_t idx, ptrdiff_t entsize) +@@ -570,23 +547,14 @@ entry_address (void *section_h, ptrdiff_t idx, ptrdiff_t entsize) + (*(ElfW (Shdr) *) entry_address (old_section_h, n, old_file_h->e_shentsize)) + #define NEW_SECTION_H(n) \ + (*(ElfW (Shdr) *) entry_address (new_section_h, n, new_file_h->e_shentsize)) ++#define OLD_PROGRAM_H(n) \ ++ (*(ElfW (Phdr) *) entry_address (old_program_h, n, old_file_h->e_phentsize)) + #define NEW_PROGRAM_H(n) \ + (*(ElfW (Phdr) *) entry_address (new_program_h, n, new_file_h->e_phentsize)) + + #define PATCH_INDEX(n) ((n) += old_bss_index <= (n)) + typedef unsigned char byte; + +-/* Round X up to a multiple of Y. */ +- +-static ElfW (Addr) +-round_up (ElfW (Addr) x, ElfW (Addr) y) +-{ +- ElfW (Addr) rem = x % y; +- if (rem == 0) +- return x; +- return x - rem + y; +-} +- + /* Return the index of the section named NAME. + SECTION_NAMES, FILE_NAME and FILE_H give information + about the file we are looking in. +@@ -650,16 +618,15 @@ unexec (const char *new_name, const char *old_name) + /* Point to the section name table in the old file. */ + char *old_section_names; + ++ ElfW (Phdr) *old_bss_seg, *new_bss_seg; + ElfW (Addr) old_bss_addr, new_bss_addr; + ElfW (Word) old_bss_size, new_data2_size; + ElfW (Off) new_data2_offset; + ElfW (Addr) new_data2_addr; + ElfW (Off) old_bss_offset; +- ElfW (Word) new_data2_incr; + + ptrdiff_t n, nn; +- ptrdiff_t old_bss_index, old_sbss_index, old_plt_index; +- ptrdiff_t old_data_index, new_data2_index; ++ ptrdiff_t old_bss_index, old_data_index; + struct stat stat_buf; + off_t old_file_size; + +@@ -703,54 +670,40 @@ unexec (const char *new_name, const char *old_name) + old_section_names = (char *) old_base + + OLD_SECTION_H (old_file_h->e_shstrndx).sh_offset; + +- /* Find the old .bss section. Figure out parameters of the new +- data2 and bss sections. */ +- +- old_bss_index = find_section (".bss", old_section_names, +- old_name, old_file_h, old_section_h, 0); +- +- old_sbss_index = find_section (".sbss", old_section_names, +- old_name, old_file_h, old_section_h, 1); +- if (old_sbss_index != -1) +- if (OLD_SECTION_H (old_sbss_index).sh_type != SHT_NOBITS) +- old_sbss_index = -1; +- +- /* PowerPC64 has .plt in the BSS section. */ +- old_plt_index = find_section (".plt", old_section_names, +- old_name, old_file_h, old_section_h, 1); +- if (old_plt_index != -1) +- if (OLD_SECTION_H (old_plt_index).sh_type != SHT_NOBITS) +- old_plt_index = -1; +- +- if (old_sbss_index == -1 && old_plt_index == -1) +- { +- old_bss_addr = OLD_SECTION_H (old_bss_index).sh_addr; +- old_bss_size = OLD_SECTION_H (old_bss_index).sh_size; +- old_bss_offset = OLD_SECTION_H (old_bss_index).sh_offset; +- new_data2_index = old_bss_index; +- } +- else if (old_plt_index != -1 +- && (old_sbss_index == -1 +- || (OLD_SECTION_H (old_sbss_index).sh_addr +- > OLD_SECTION_H (old_plt_index).sh_addr))) ++ /* Find the PT_LOAD header covering the highest address. This ++ segment will be where bss sections are located, past p_filesz. */ ++ old_bss_seg = 0; ++ for (n = old_file_h->e_phnum; --n >= 0; ) + { +- old_bss_addr = OLD_SECTION_H (old_plt_index).sh_addr; +- old_bss_size = OLD_SECTION_H (old_bss_index).sh_size +- + OLD_SECTION_H (old_plt_index).sh_size; +- if (old_sbss_index != -1) +- old_bss_size += OLD_SECTION_H (old_sbss_index).sh_size; +- old_bss_offset = OLD_SECTION_H (old_plt_index).sh_offset; +- new_data2_index = old_plt_index; ++ ElfW (Phdr) *seg = &OLD_PROGRAM_H (n); ++ if (seg->p_type == PT_LOAD ++ && (old_bss_seg == 0 ++ || seg->p_vaddr > old_bss_seg->p_vaddr)) ++ old_bss_seg = seg; + } +- else ++ ++ /* Note that old_bss_addr may be lower than the first bss section ++ address, since the section may need aligning. */ ++ old_bss_addr = old_bss_seg->p_vaddr + old_bss_seg->p_filesz; ++ old_bss_offset = old_bss_seg->p_offset + old_bss_seg->p_filesz; ++ old_bss_size = old_bss_seg->p_memsz - old_bss_seg->p_filesz; ++ ++ /* Find the first bss style section in the bss segment range. */ ++ old_bss_index = -1; ++ for (n = old_file_h->e_shnum; --n > 0; ) + { +- old_bss_addr = OLD_SECTION_H (old_sbss_index).sh_addr; +- old_bss_size = OLD_SECTION_H (old_bss_index).sh_size +- + OLD_SECTION_H (old_sbss_index).sh_size; +- old_bss_offset = OLD_SECTION_H (old_sbss_index).sh_offset; +- new_data2_index = old_sbss_index; ++ ElfW (Shdr) *shdr = &OLD_SECTION_H (n); ++ if (shdr->sh_type == SHT_NOBITS ++ && shdr->sh_addr >= old_bss_addr ++ && shdr->sh_addr + shdr->sh_size <= old_bss_addr + old_bss_size ++ && (old_bss_index == -1 ++ || OLD_SECTION_H (old_bss_index).sh_addr > shdr->sh_addr)) ++ old_bss_index = n; + } + ++ if (old_bss_index == -1) ++ fatal ("no bss section found"); ++ + /* Find the old .data section. Figure out parameters of + the new data2 and bss sections. */ + +@@ -761,13 +714,7 @@ unexec (const char *new_name, const char *old_name) + new_bss_addr = (ElfW (Addr)) new_break; + new_data2_addr = old_bss_addr; + new_data2_size = new_bss_addr - old_bss_addr; +- new_data2_offset = OLD_SECTION_H (old_data_index).sh_offset +- + (new_data2_addr - OLD_SECTION_H (old_data_index).sh_addr); +- /* This is the amount by which the sections following the bss sections +- must be shifted in the image. It can differ from new_data2_size if +- the end of the old .data section (and thus the offset of the .bss +- section) was unaligned. */ +- new_data2_incr = new_data2_size + (new_data2_offset - old_bss_offset); ++ new_data2_offset = old_bss_offset; + + #ifdef UNEXELF_DEBUG + fprintf (stderr, "old_bss_index %td\n", old_bss_index); +@@ -778,7 +725,6 @@ unexec (const char *new_name, const char *old_name) + DEBUG_LOG (new_data2_addr); + DEBUG_LOG (new_data2_size); + DEBUG_LOG (new_data2_offset); +- DEBUG_LOG (new_data2_incr); + #endif + + if (new_bss_addr < old_bss_addr + old_bss_size) +@@ -792,7 +738,7 @@ unexec (const char *new_name, const char *old_name) + if (new_file < 0) + fatal ("Can't creat (%s): %s", new_name, strerror (errno)); + +- new_file_size = old_file_size + old_file_h->e_shentsize + new_data2_incr; ++ new_file_size = old_file_size + old_file_h->e_shentsize + new_data2_size; + + if (ftruncate (new_file, new_file_size)) + fatal ("Can't ftruncate (%s): %s", new_name, strerror (errno)); +@@ -811,15 +757,15 @@ unexec (const char *new_name, const char *old_name) + /* Fix up file header. We'll add one section. Section header is + further away now. */ + +- new_file_h->e_shoff += new_data2_incr; ++ if (new_file_h->e_shoff >= old_bss_offset) ++ new_file_h->e_shoff += new_data2_size; + new_file_h->e_shnum += 1; + + /* Modify the e_shstrndx if necessary. */ + PATCH_INDEX (new_file_h->e_shstrndx); + +- new_program_h = (ElfW (Phdr) *) ((byte *) new_base + old_file_h->e_phoff); +- new_section_h = (ElfW (Shdr) *) +- ((byte *) new_base + old_file_h->e_shoff + new_data2_incr); ++ new_program_h = (ElfW (Phdr) *) ((byte *) new_base + new_file_h->e_phoff); ++ new_section_h = (ElfW (Shdr) *) ((byte *) new_base + new_file_h->e_shoff); + + memcpy (new_program_h, old_program_h, + old_file_h->e_phnum * old_file_h->e_phentsize); +@@ -831,65 +777,21 @@ unexec (const char *new_name, const char *old_name) + fprintf (stderr, "New section count %td\n", (ptrdiff_t) new_file_h->e_shnum); + #endif + +- /* Fix up a new program header. Extend the writable data segment so +- that the bss area is covered too. Find that segment by looking +- for a segment that ends just before the .bss area. Make sure +- that no segments are above the new .data2. Put a loop at the end +- to adjust the offset and address of any segment that is above +- data2, just in case we decide to allow this later. */ ++ /* Fix up program header. Extend the writable data segment so ++ that the bss area is covered too. */ + +- for (n = new_file_h->e_phnum; --n >= 0; ) +- { +- /* Compute maximum of all requirements for alignment of section. */ +- ElfW (Word) alignment = (NEW_PROGRAM_H (n)).p_align; +- if ((OLD_SECTION_H (old_bss_index)).sh_addralign > alignment) +- alignment = OLD_SECTION_H (old_bss_index).sh_addralign; +- +-#ifdef __sgi +- /* According to r02kar@x4u2.desy.de (Karsten Kuenne) +- and oliva@gnu.org (Alexandre Oliva), on IRIX 5.2, we +- always get "Program segment above .bss" when dumping +- when the executable doesn't have an sbss section. */ +- if (old_sbss_index != -1) +-#endif /* __sgi */ +- if (NEW_PROGRAM_H (n).p_vaddr + NEW_PROGRAM_H (n).p_filesz +- > (old_sbss_index == -1 +- ? old_bss_addr +- : round_up (old_bss_addr, alignment))) +- fatal ("Program segment above .bss in %s", old_name); +- +- if (NEW_PROGRAM_H (n).p_type == PT_LOAD +- && (round_up ((NEW_PROGRAM_H (n)).p_vaddr +- + (NEW_PROGRAM_H (n)).p_filesz, +- alignment) +- == round_up (old_bss_addr, alignment))) +- break; +- } +- if (n < 0) +- fatal ("Couldn't find segment next to .bss in %s", old_name); +- +- /* Make sure that the size includes any padding before the old .bss +- section. */ +- NEW_PROGRAM_H (n).p_filesz = new_bss_addr - NEW_PROGRAM_H (n).p_vaddr; +- NEW_PROGRAM_H (n).p_memsz = NEW_PROGRAM_H (n).p_filesz; +- +-#if 0 /* Maybe allow section after data2 - does this ever happen? */ +- for (n = new_file_h->e_phnum; --n >= 0; ) +- { +- if (NEW_PROGRAM_H (n).p_vaddr +- && NEW_PROGRAM_H (n).p_vaddr >= new_data2_addr) +- NEW_PROGRAM_H (n).p_vaddr += new_data2_size - old_bss_size; ++ new_bss_seg = new_program_h + (old_bss_seg - old_program_h); ++ new_bss_seg->p_filesz = new_bss_addr - new_bss_seg->p_vaddr; ++ new_bss_seg->p_memsz = new_bss_seg->p_filesz; + +- if (NEW_PROGRAM_H (n).p_offset >= new_data2_offset) +- NEW_PROGRAM_H (n).p_offset += new_data2_incr; +- } +-#endif ++ /* Copy over what we have in memory now for the bss area. */ ++ memcpy (new_base + new_data2_offset, (caddr_t) old_bss_addr, new_data2_size); + + /* Fix up section headers based on new .data2 section. Any section + whose offset or virtual address is after the new .data2 section +- gets its value adjusted. .bss size becomes zero and new address +- is set. data2 section header gets added by copying the existing +- .data header and modifying the offset, address and size. */ ++ gets its value adjusted. .bss size becomes zero. data2 section ++ header gets added by copying the existing .data header and ++ modifying the offset, address and size. */ + + /* Walk through all section headers, insert the new data2 section right + before the new bss section. */ +@@ -900,9 +802,7 @@ unexec (const char *new_name, const char *old_name) + ElfW (Shdr) *new_shdr = &NEW_SECTION_H (nn); + + /* If it is (s)bss section, insert the new data2 section before it. */ +- /* new_data2_index is the index of either old_sbss or old_bss, that was +- chosen as a section for new_data2. */ +- if (n == new_data2_index) ++ if (n == old_bss_index) + { + /* Steal the data section header for this data2 section. */ + memcpy (new_shdr, &OLD_SECTION_H (old_data_index), +@@ -911,68 +811,43 @@ unexec (const char *new_name, const char *old_name) + new_shdr->sh_addr = new_data2_addr; + new_shdr->sh_offset = new_data2_offset; + new_shdr->sh_size = new_data2_size; +- /* Use the bss section's alignment. This will assure that the +- new data2 section always be placed in the same spot as the old +- bss section by any other application. */ +- new_shdr->sh_addralign = old_shdr->sh_addralign; +- +- /* Now copy over what we have in the memory now. */ +- memcpy (new_shdr->sh_offset + new_base, +- (caddr_t) old_shdr->sh_addr, +- new_data2_size); ++ new_shdr->sh_addralign = 1; + nn++; + new_shdr++; + } + + memcpy (new_shdr, old_shdr, old_file_h->e_shentsize); + +- if (n == old_bss_index +- /* The new bss and sbss section's size is zero, and its file offset +- and virtual address should be off by NEW_DATA2_SIZE. */ +- || n == old_sbss_index || n == old_plt_index +- ) ++ if (new_shdr->sh_type == SHT_NOBITS ++ && new_shdr->sh_addr >= old_bss_addr ++ && (new_shdr->sh_addr + new_shdr->sh_size ++ <= old_bss_addr + old_bss_size)) + { +- /* NN should be `old_s?bss_index + 1' at this point. */ +- new_shdr->sh_offset = new_data2_offset + new_data2_size; +- new_shdr->sh_addr = new_data2_addr + new_data2_size; +- /* Let the new bss section address alignment be the same as the +- section address alignment followed the old bss section, so +- this section will be placed in exactly the same place. */ +- new_shdr->sh_addralign = OLD_SECTION_H (nn).sh_addralign; ++ /* SHT_NOBITS sections do not need a valid sh_offset, so it ++ might be incorrect. Write the correct value. */ ++ new_shdr->sh_offset = (new_shdr->sh_addr - new_bss_seg->p_vaddr ++ + new_bss_seg->p_offset); ++ ++ /* If this is was a SHT_NOBITS .plt section, then it is ++ probably a PowerPC PLT. If it is PowerPC64 ELFv1 then ++ glibc ld.so doesn't initialize the toc pointer word. A ++ non-zero toc pointer word can defeat Power7 thread safety ++ during lazy update of a PLT entry. This only matters if ++ emacs becomes multi-threaded. */ ++ if (strcmp (old_section_names + new_shdr->sh_name, ".plt") == 0) ++ memset (new_shdr->sh_offset + new_base, 0, new_shdr->sh_size); ++ ++ /* Set the new bss and sbss section's size to zero, because ++ we've already covered this address range by .data2. */ + new_shdr->sh_size = 0; + } + else + { + /* Any section that was originally placed after the .bss +- section should now be off by NEW_DATA2_INCR. If a +- section overlaps the .bss section, consider it to be +- placed after the .bss section. Overlap can occur if the +- section just before .bss has less-strict alignment; this +- was observed between .symtab and .bss on Solaris 2.5.1 +- (sparc) with GCC snapshot 960602. ++ section should now be off by NEW_DATA2_SIZE. */ + +-> dump -h temacs +- +-temacs: +- +- **** SECTION HEADER TABLE **** +-[No] Type Flags Addr Offset Size Name +- Link Info Adralgn Entsize +- +-[22] 1 3 0x335150 0x315150 0x4 .data.rel.local +- 0 0 0x4 0 +- +-[23] 8 3 0x335158 0x315158 0x42720 .bss +- 0 0 0x8 0 +- +-[24] 2 0 0 0x315154 0x1c9d0 .symtab +- 25 1709 0x4 0x10 +- */ +- +- if (new_shdr->sh_offset >= old_bss_offset +- || (new_shdr->sh_offset + new_shdr->sh_size +- > new_data2_offset)) +- new_shdr->sh_offset += new_data2_incr; ++ if (new_shdr->sh_offset >= old_bss_offset) ++ new_shdr->sh_offset += new_data2_size; + + /* Any section that was originally placed after the section + header table should now be off by the size of one section +@@ -992,23 +867,13 @@ temacs: + && new_shdr->sh_type != SHT_DYNSYM) + PATCH_INDEX (new_shdr->sh_info); + +- if (old_sbss_index != -1) +- if (!strcmp (old_section_names + new_shdr->sh_name, ".sbss")) +- { +- new_shdr->sh_offset = +- round_up (new_shdr->sh_offset, +- new_shdr->sh_addralign); +- new_shdr->sh_type = SHT_PROGBITS; +- } +- + /* Now, start to copy the content of sections. */ + if (new_shdr->sh_type == SHT_NULL + || new_shdr->sh_type == SHT_NOBITS) + continue; + +- /* Write out the sections. .data and .data1 (and data2, called +- ".data" in the strings table) get copied from the current process +- instead of the old file. */ ++ /* Some sections are copied from the current process instead of ++ the old file. */ + if (!strcmp (old_section_names + new_shdr->sh_name, ".data") + || !strcmp (old_section_names + new_shdr->sh_name, ".sdata") + || !strcmp (old_section_names + new_shdr->sh_name, ".lit4") +@@ -1037,8 +902,7 @@ temacs: + || !strcmp (old_section_names + new_shdr->sh_name, ".got") + #endif + || !strcmp (old_section_names + new_shdr->sh_name, ".sdata1") +- || !strcmp (old_section_names + new_shdr->sh_name, ".data1") +- || !strcmp (old_section_names + new_shdr->sh_name, ".sbss")) ++ || !strcmp (old_section_names + new_shdr->sh_name, ".data1")) + src = (caddr_t) old_shdr->sh_addr; + else + src = old_base + old_shdr->sh_offset; +-- +2.7.4 + diff --git a/SOURCES/emacs-0009-ELF-unexec-Don-t-insert-a-new-section.patch b/SOURCES/emacs-0009-ELF-unexec-Don-t-insert-a-new-section.patch new file mode 100644 index 0000000..db4bb4b --- /dev/null +++ b/SOURCES/emacs-0009-ELF-unexec-Don-t-insert-a-new-section.patch @@ -0,0 +1,697 @@ +From 76b336e1655c8eacaf17a362c3c59d6103357c09 Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Sun, 8 Nov 2015 09:29:00 -0800 +Subject: [PATCH 09/11] ELF unexec: Don't insert a new section + +Reuse the .bss section instead, making it SHT_PROGBITS. This way we +don't need to mess with symbol st_shndx, or section sh_link and +sh_info. + +This does lead to eu-elflint complaints about symbols defined in .bss +with a needed version, because normally it is undefined symbols that +have needed versions; Defined symbols have version definitions. +The exception is symbols defined by the linker in .dynbss for +variables copied from a shared library in order to avoid text +relocations, with copy relocs to copy their initial values from the +shared library. These symbols are both defined and have needed +versions, and eu-elflink only expects to see them in SHT_NOBITS +sections. Of course there is no real problem with having such symbols +in SHT_PROGBITS sections. glibc ld.so handles them fine. + +* unexelf.c: Delete outdated comments. +(PATCH_INDEX): Delete. +(find_section): Delete. +(unexec): Don't add a new section. Instead reuse the last bss +section, extending it to cover dumped data. Make bss sections +SHT_PROGBITS. Remove all patching of sh_link, sh_info and +st_shndx. Rename bss sections. +--- + src/unexelf.c | 524 ++++++---------------------------------------------------- + 1 file changed, 50 insertions(+), 474 deletions(-) + +diff --git a/src/unexelf.c b/src/unexelf.c +index 4e9c50d..85ed934 100644 +--- a/src/unexelf.c ++++ b/src/unexelf.c +@@ -40,347 +40,6 @@ what you give them. Help stamp out software-hoarding! */ + * On some machines, an existing old_name file is required. + * + */ +- +-/* Even more heavily modified by james@bigtex.cactus.org of Dell Computer Co. +- * ELF support added. +- * +- * Basic theory: the data space of the running process needs to be +- * dumped to the output file. Normally we would just enlarge the size +- * of .data, scooting everything down. But we can't do that in ELF, +- * because there is often something between the .data space and the +- * .bss space. +- * +- * In the temacs dump below, notice that the Global Offset Table +- * (.got) and the Dynamic link data (.dynamic) come between .data1 and +- * .bss. It does not work to overlap .data with these fields. +- * +- * The solution is to create a new .data segment. This segment is +- * filled with data from the current process. Since the contents of +- * various sections refer to sections by index, the new .data segment +- * is made the last in the table to avoid changing any existing index. +- +- * This is an example of how the section headers are changed. "Addr" +- * is a process virtual address. "Offset" is a file offset. +- +-raid:/nfs/raid/src/dist-18.56/src> dump -h temacs +- +-temacs: +- +- **** SECTION HEADER TABLE **** +- [No] Type Flags Addr Offset Size Name +- Link Info Adralgn Entsize +- +- [1] 1 2 0x80480d4 0xd4 0x13 .interp +- 0 0 0x1 0 +- +- [2] 5 2 0x80480e8 0xe8 0x388 .hash +- 3 0 0x4 0x4 +- +- [3] 11 2 0x8048470 0x470 0x7f0 .dynsym +- 4 1 0x4 0x10 +- +- [4] 3 2 0x8048c60 0xc60 0x3ad .dynstr +- 0 0 0x1 0 +- +- [5] 9 2 0x8049010 0x1010 0x338 .rel.plt +- 3 7 0x4 0x8 +- +- [6] 1 6 0x8049348 0x1348 0x3 .init +- 0 0 0x4 0 +- +- [7] 1 6 0x804934c 0x134c 0x680 .plt +- 0 0 0x4 0x4 +- +- [8] 1 6 0x80499cc 0x19cc 0x3c56f .text +- 0 0 0x4 0 +- +- [9] 1 6 0x8085f3c 0x3df3c 0x3 .fini +- 0 0 0x4 0 +- +- [10] 1 2 0x8085f40 0x3df40 0x69c .rodata +- 0 0 0x4 0 +- +- [11] 1 2 0x80865dc 0x3e5dc 0xd51 .rodata1 +- 0 0 0x4 0 +- +- [12] 1 3 0x8088330 0x3f330 0x20afc .data +- 0 0 0x4 0 +- +- [13] 1 3 0x80a8e2c 0x5fe2c 0x89d .data1 +- 0 0 0x4 0 +- +- [14] 1 3 0x80a96cc 0x606cc 0x1a8 .got +- 0 0 0x4 0x4 +- +- [15] 6 3 0x80a9874 0x60874 0x80 .dynamic +- 4 0 0x4 0x8 +- +- [16] 8 3 0x80a98f4 0x608f4 0x449c .bss +- 0 0 0x4 0 +- +- [17] 2 0 0 0x608f4 0x9b90 .symtab +- 18 371 0x4 0x10 +- +- [18] 3 0 0 0x6a484 0x8526 .strtab +- 0 0 0x1 0 +- +- [19] 3 0 0 0x729aa 0x93 .shstrtab +- 0 0 0x1 0 +- +- [20] 1 0 0 0x72a3d 0x68b7 .comment +- 0 0 0x1 0 +- +- raid:/nfs/raid/src/dist-18.56/src> dump -h xemacs +- +- xemacs: +- +- **** SECTION HEADER TABLE **** +- [No] Type Flags Addr Offset Size Name +- Link Info Adralgn Entsize +- +- [1] 1 2 0x80480d4 0xd4 0x13 .interp +- 0 0 0x1 0 +- +- [2] 5 2 0x80480e8 0xe8 0x388 .hash +- 3 0 0x4 0x4 +- +- [3] 11 2 0x8048470 0x470 0x7f0 .dynsym +- 4 1 0x4 0x10 +- +- [4] 3 2 0x8048c60 0xc60 0x3ad .dynstr +- 0 0 0x1 0 +- +- [5] 9 2 0x8049010 0x1010 0x338 .rel.plt +- 3 7 0x4 0x8 +- +- [6] 1 6 0x8049348 0x1348 0x3 .init +- 0 0 0x4 0 +- +- [7] 1 6 0x804934c 0x134c 0x680 .plt +- 0 0 0x4 0x4 +- +- [8] 1 6 0x80499cc 0x19cc 0x3c56f .text +- 0 0 0x4 0 +- +- [9] 1 6 0x8085f3c 0x3df3c 0x3 .fini +- 0 0 0x4 0 +- +- [10] 1 2 0x8085f40 0x3df40 0x69c .rodata +- 0 0 0x4 0 +- +- [11] 1 2 0x80865dc 0x3e5dc 0xd51 .rodata1 +- 0 0 0x4 0 +- +- [12] 1 3 0x8088330 0x3f330 0x20afc .data +- 0 0 0x4 0 +- +- [13] 1 3 0x80a8e2c 0x5fe2c 0x89d .data1 +- 0 0 0x4 0 +- +- [14] 1 3 0x80a96cc 0x606cc 0x1a8 .got +- 0 0 0x4 0x4 +- +- [15] 6 3 0x80a9874 0x60874 0x80 .dynamic +- 4 0 0x4 0x8 +- +- [16] 8 3 0x80c6800 0x7d800 0 .bss +- 0 0 0x4 0 +- +- [17] 2 0 0 0x7d800 0x9b90 .symtab +- 18 371 0x4 0x10 +- +- [18] 3 0 0 0x87390 0x8526 .strtab +- 0 0 0x1 0 +- +- [19] 3 0 0 0x8f8b6 0x93 .shstrtab +- 0 0 0x1 0 +- +- [20] 1 0 0 0x8f949 0x68b7 .comment +- 0 0 0x1 0 +- +- [21] 1 3 0x80a98f4 0x608f4 0x1cf0c .data +- 0 0 0x4 0 +- +- * This is an example of how the file header is changed. "Shoff" is +- * the section header offset within the file. Since that table is +- * after the new .data section, it is moved. "Shnum" is the number of +- * sections, which we increment. +- * +- * "Phoff" is the file offset to the program header. "Phentsize" and +- * "Shentsz" are the program and section header entries sizes respectively. +- * These can be larger than the apparent struct sizes. +- +- raid:/nfs/raid/src/dist-18.56/src> dump -f temacs +- +- temacs: +- +- **** ELF HEADER **** +- Class Data Type Machine Version +- Entry Phoff Shoff Flags Ehsize +- Phentsize Phnum Shentsz Shnum Shstrndx +- +- 1 1 2 3 1 +- 0x80499cc 0x34 0x792f4 0 0x34 +- 0x20 5 0x28 21 19 +- +- raid:/nfs/raid/src/dist-18.56/src> dump -f xemacs +- +- xemacs: +- +- **** ELF HEADER **** +- Class Data Type Machine Version +- Entry Phoff Shoff Flags Ehsize +- Phentsize Phnum Shentsz Shnum Shstrndx +- +- 1 1 2 3 1 +- 0x80499cc 0x34 0x96200 0 0x34 +- 0x20 5 0x28 22 19 +- +- * These are the program headers. "Offset" is the file offset to the +- * segment. "Vaddr" is the memory load address. "Filesz" is the +- * segment size as it appears in the file, and "Memsz" is the size in +- * memory. Below, the third segment is the code and the fourth is the +- * data: the difference between Filesz and Memsz is .bss +- +- raid:/nfs/raid/src/dist-18.56/src> dump -o temacs +- +- temacs: +- ***** PROGRAM EXECUTION HEADER ***** +- Type Offset Vaddr Paddr +- Filesz Memsz Flags Align +- +- 6 0x34 0x8048034 0 +- 0xa0 0xa0 5 0 +- +- 3 0xd4 0 0 +- 0x13 0 4 0 +- +- 1 0x34 0x8048034 0 +- 0x3f2f9 0x3f2f9 5 0x1000 +- +- 1 0x3f330 0x8088330 0 +- 0x215c4 0x25a60 7 0x1000 +- +- 2 0x60874 0x80a9874 0 +- 0x80 0 7 0 +- +- raid:/nfs/raid/src/dist-18.56/src> dump -o xemacs +- +- xemacs: +- ***** PROGRAM EXECUTION HEADER ***** +- Type Offset Vaddr Paddr +- Filesz Memsz Flags Align +- +- 6 0x34 0x8048034 0 +- 0xa0 0xa0 5 0 +- +- 3 0xd4 0 0 +- 0x13 0 4 0 +- +- 1 0x34 0x8048034 0 +- 0x3f2f9 0x3f2f9 5 0x1000 +- +- 1 0x3f330 0x8088330 0 +- 0x3e4d0 0x3e4d0 7 0x1000 +- +- 2 0x60874 0x80a9874 0 +- 0x80 0 7 0 +- +- +- */ +- +-/* Modified by wtien@urbana.mcd.mot.com of Motorola Inc. +- * +- * The above mechanism does not work if the unexeced ELF file is being +- * re-layout by other applications (such as `strip'). All the applications +- * that re-layout the internal of ELF will layout all sections in ascending +- * order of their file offsets. After the re-layout, the data2 section will +- * still be the LAST section in the section header vector, but its file offset +- * is now being pushed far away down, and causes part of it not to be mapped +- * in (ie. not covered by the load segment entry in PHDR vector), therefore +- * causes the new binary to fail. +- * +- * The solution is to modify the unexec algorithm to insert the new data2 +- * section header right before the new bss section header, so their file +- * offsets will be in the ascending order. Since some of the section's (all +- * sections AFTER the bss section) indexes are now changed, we also need to +- * modify some fields to make them point to the right sections. This is done +- * by macro PATCH_INDEX. All the fields that need to be patched are: +- * +- * 1. ELF header e_shstrndx field. +- * 2. section header sh_link and sh_info field. +- * 3. symbol table entry st_shndx field. +- * +- * The above example now should look like: +- +- **** SECTION HEADER TABLE **** +- [No] Type Flags Addr Offset Size Name +- Link Info Adralgn Entsize +- +- [1] 1 2 0x80480d4 0xd4 0x13 .interp +- 0 0 0x1 0 +- +- [2] 5 2 0x80480e8 0xe8 0x388 .hash +- 3 0 0x4 0x4 +- +- [3] 11 2 0x8048470 0x470 0x7f0 .dynsym +- 4 1 0x4 0x10 +- +- [4] 3 2 0x8048c60 0xc60 0x3ad .dynstr +- 0 0 0x1 0 +- +- [5] 9 2 0x8049010 0x1010 0x338 .rel.plt +- 3 7 0x4 0x8 +- +- [6] 1 6 0x8049348 0x1348 0x3 .init +- 0 0 0x4 0 +- +- [7] 1 6 0x804934c 0x134c 0x680 .plt +- 0 0 0x4 0x4 +- +- [8] 1 6 0x80499cc 0x19cc 0x3c56f .text +- 0 0 0x4 0 +- +- [9] 1 6 0x8085f3c 0x3df3c 0x3 .fini +- 0 0 0x4 0 +- +- [10] 1 2 0x8085f40 0x3df40 0x69c .rodata +- 0 0 0x4 0 +- +- [11] 1 2 0x80865dc 0x3e5dc 0xd51 .rodata1 +- 0 0 0x4 0 +- +- [12] 1 3 0x8088330 0x3f330 0x20afc .data +- 0 0 0x4 0 +- +- [13] 1 3 0x80a8e2c 0x5fe2c 0x89d .data1 +- 0 0 0x4 0 +- +- [14] 1 3 0x80a96cc 0x606cc 0x1a8 .got +- 0 0 0x4 0x4 +- +- [15] 6 3 0x80a9874 0x60874 0x80 .dynamic +- 4 0 0x4 0x8 +- +- [16] 1 3 0x80a98f4 0x608f4 0x1cf0c .data +- 0 0 0x4 0 +- +- [17] 8 3 0x80c6800 0x7d800 0 .bss +- 0 0 0x4 0 +- +- [18] 2 0 0 0x7d800 0x9b90 .symtab +- 19 371 0x4 0x10 +- +- [19] 3 0 0 0x87390 0x8526 .strtab +- 0 0 0x1 0 +- +- [20] 3 0 0 0x8f8b6 0x93 .shstrtab +- 0 0 0x1 0 +- +- [21] 1 0 0 0x8f949 0x68b7 .comment +- 0 0 0x1 0 +- +- */ + + /* We do not use mmap because that fails with NFS. + Instead we read the whole file, modify it, and write it out. */ +@@ -552,45 +211,15 @@ entry_address (void *section_h, ptrdiff_t idx, ptrdiff_t entsize) + #define NEW_PROGRAM_H(n) \ + (*(ElfW (Phdr) *) entry_address (new_program_h, n, new_file_h->e_phentsize)) + +-#define PATCH_INDEX(n) ((n) += old_bss_index <= (n)) + typedef unsigned char byte; + +-/* Return the index of the section named NAME. +- SECTION_NAMES, FILE_NAME and FILE_H give information +- about the file we are looking in. +- +- If we don't find the section NAME, that is a fatal error +- if NOERROR is false; return -1 if NOERROR is true. */ +- +-static ptrdiff_t +-find_section (const char *name, const char *section_names, const char *file_name, +- ElfW (Ehdr) *old_file_h, ElfW (Shdr) *old_section_h, +- bool noerror) +-{ +- ptrdiff_t idx; +- +- for (idx = 1; idx < old_file_h->e_shnum; idx++) +- { +- char const *found_name = section_names + OLD_SECTION_H (idx).sh_name; +-#ifdef UNEXELF_DEBUG +- fprintf (stderr, "Looking for %s - found %s\n", name, found_name); +-#endif +- if (strcmp (name, found_name) == 0) +- return idx; +- } +- +- if (! noerror) +- fatal ("Can't find %s in %s", name, file_name); +- return -1; +-} +- + /* **************************************************************** + * unexec + * + * driving logic. + * +- * In ELF, this works by replacing the old .bss section with a new +- * .data section, and inserting an empty .bss immediately afterwards. ++ * In ELF, this works by replacing the old bss SHT_NOBITS section with ++ * a new, larger, SHT_PROGBITS section. + * + */ + void +@@ -615,18 +244,16 @@ unexec (const char *new_name, const char *old_name) + ElfW (Phdr) *old_program_h, *new_program_h; + ElfW (Shdr) *old_section_h, *new_section_h; + +- /* Point to the section name table in the old file. */ +- char *old_section_names; ++ /* Point to the section name table. */ ++ char *old_section_names, *new_section_names; + + ElfW (Phdr) *old_bss_seg, *new_bss_seg; + ElfW (Addr) old_bss_addr, new_bss_addr; + ElfW (Word) old_bss_size, new_data2_size; +- ElfW (Off) new_data2_offset; +- ElfW (Addr) new_data2_addr; +- ElfW (Off) old_bss_offset; ++ ElfW (Off) old_bss_offset, new_data2_offset; + +- ptrdiff_t n, nn; +- ptrdiff_t old_bss_index, old_data_index; ++ ptrdiff_t n; ++ ptrdiff_t old_bss_index; + struct stat stat_buf; + off_t old_file_size; + +@@ -688,7 +315,7 @@ unexec (const char *new_name, const char *old_name) + old_bss_offset = old_bss_seg->p_offset + old_bss_seg->p_filesz; + old_bss_size = old_bss_seg->p_memsz - old_bss_seg->p_filesz; + +- /* Find the first bss style section in the bss segment range. */ ++ /* Find the last bss style section in the bss segment range. */ + old_bss_index = -1; + for (n = old_file_h->e_shnum; --n > 0; ) + { +@@ -697,22 +324,15 @@ unexec (const char *new_name, const char *old_name) + && shdr->sh_addr >= old_bss_addr + && shdr->sh_addr + shdr->sh_size <= old_bss_addr + old_bss_size + && (old_bss_index == -1 +- || OLD_SECTION_H (old_bss_index).sh_addr > shdr->sh_addr)) ++ || OLD_SECTION_H (old_bss_index).sh_addr < shdr->sh_addr)) + old_bss_index = n; + } + + if (old_bss_index == -1) + fatal ("no bss section found"); + +- /* Find the old .data section. Figure out parameters of +- the new data2 and bss sections. */ +- +- old_data_index = find_section (".data", old_section_names, +- old_name, old_file_h, old_section_h, 0); +- + new_break = sbrk (0); + new_bss_addr = (ElfW (Addr)) new_break; +- new_data2_addr = old_bss_addr; + new_data2_size = new_bss_addr - old_bss_addr; + new_data2_offset = old_bss_offset; + +@@ -722,7 +342,6 @@ unexec (const char *new_name, const char *old_name) + DEBUG_LOG (old_bss_size); + DEBUG_LOG (old_bss_offset); + DEBUG_LOG (new_bss_addr); +- DEBUG_LOG (new_data2_addr); + DEBUG_LOG (new_data2_size); + DEBUG_LOG (new_data2_offset); + #endif +@@ -738,7 +357,7 @@ unexec (const char *new_name, const char *old_name) + if (new_file < 0) + fatal ("Can't creat (%s): %s", new_name, strerror (errno)); + +- new_file_size = old_file_size + old_file_h->e_shentsize + new_data2_size; ++ new_file_size = old_file_size + new_data2_size; + + if (ftruncate (new_file, new_file_size)) + fatal ("Can't ftruncate (%s): %s", new_name, strerror (errno)); +@@ -754,21 +373,18 @@ unexec (const char *new_name, const char *old_name) + new_file_h = (ElfW (Ehdr) *) new_base; + memcpy (new_file_h, old_file_h, old_file_h->e_ehsize); + +- /* Fix up file header. We'll add one section. Section header is +- further away now. */ ++ /* Fix up file header. Section header is further away now. */ + + if (new_file_h->e_shoff >= old_bss_offset) + new_file_h->e_shoff += new_data2_size; +- new_file_h->e_shnum += 1; +- +- /* Modify the e_shstrndx if necessary. */ +- PATCH_INDEX (new_file_h->e_shstrndx); + + new_program_h = (ElfW (Phdr) *) ((byte *) new_base + new_file_h->e_phoff); + new_section_h = (ElfW (Shdr) *) ((byte *) new_base + new_file_h->e_shoff); + + memcpy (new_program_h, old_program_h, + old_file_h->e_phnum * old_file_h->e_phentsize); ++ memcpy (new_section_h, old_section_h, ++ old_file_h->e_shnum * old_file_h->e_shentsize); + + #ifdef UNEXELF_DEBUG + DEBUG_LOG (old_file_h->e_shoff); +@@ -787,42 +403,21 @@ unexec (const char *new_name, const char *old_name) + /* Copy over what we have in memory now for the bss area. */ + memcpy (new_base + new_data2_offset, (caddr_t) old_bss_addr, new_data2_size); + +- /* Fix up section headers based on new .data2 section. Any section +- whose offset or virtual address is after the new .data2 section +- gets its value adjusted. .bss size becomes zero. data2 section +- header gets added by copying the existing .data header and +- modifying the offset, address and size. */ +- +- /* Walk through all section headers, insert the new data2 section right +- before the new bss section. */ +- for (n = 1, nn = 1; n < old_file_h->e_shnum; n++, nn++) ++ /* Walk through all section headers, copying data and updating. */ ++ for (n = 1; n < old_file_h->e_shnum; n++) + { + caddr_t src; + ElfW (Shdr) *old_shdr = &OLD_SECTION_H (n); +- ElfW (Shdr) *new_shdr = &NEW_SECTION_H (nn); +- +- /* If it is (s)bss section, insert the new data2 section before it. */ +- if (n == old_bss_index) +- { +- /* Steal the data section header for this data2 section. */ +- memcpy (new_shdr, &OLD_SECTION_H (old_data_index), +- new_file_h->e_shentsize); +- +- new_shdr->sh_addr = new_data2_addr; +- new_shdr->sh_offset = new_data2_offset; +- new_shdr->sh_size = new_data2_size; +- new_shdr->sh_addralign = 1; +- nn++; +- new_shdr++; +- } +- +- memcpy (new_shdr, old_shdr, old_file_h->e_shentsize); ++ ElfW (Shdr) *new_shdr = &NEW_SECTION_H (n); + + if (new_shdr->sh_type == SHT_NOBITS + && new_shdr->sh_addr >= old_bss_addr + && (new_shdr->sh_addr + new_shdr->sh_size + <= old_bss_addr + old_bss_size)) + { ++ /* This section now has file backing. */ ++ new_shdr->sh_type = SHT_PROGBITS; ++ + /* SHT_NOBITS sections do not need a valid sh_offset, so it + might be incorrect. Write the correct value. */ + new_shdr->sh_offset = (new_shdr->sh_addr - new_bss_seg->p_vaddr +@@ -837,35 +432,20 @@ unexec (const char *new_name, const char *old_name) + if (strcmp (old_section_names + new_shdr->sh_name, ".plt") == 0) + memset (new_shdr->sh_offset + new_base, 0, new_shdr->sh_size); + +- /* Set the new bss and sbss section's size to zero, because +- we've already covered this address range by .data2. */ +- new_shdr->sh_size = 0; +- } +- else +- { +- /* Any section that was originally placed after the .bss +- section should now be off by NEW_DATA2_SIZE. */ ++ /* Extend the size of the last bss section to cover dumped ++ data. */ ++ if (n == old_bss_index) ++ new_shdr->sh_size = new_bss_addr - new_shdr->sh_addr; + +- if (new_shdr->sh_offset >= old_bss_offset) +- new_shdr->sh_offset += new_data2_size; +- +- /* Any section that was originally placed after the section +- header table should now be off by the size of one section +- header table entry. */ +- if (new_shdr->sh_offset > new_file_h->e_shoff) +- new_shdr->sh_offset += new_file_h->e_shentsize; ++ /* We have already copied this section from the current ++ process. */ ++ continue; + } + +- /* If any section hdr refers to the section after the new .data +- section, make it refer to next one because we have inserted +- a new section in between. */ +- +- PATCH_INDEX (new_shdr->sh_link); +- /* For symbol tables, info is a symbol table index, +- so don't change it. */ +- if (new_shdr->sh_type != SHT_SYMTAB +- && new_shdr->sh_type != SHT_DYNSYM) +- PATCH_INDEX (new_shdr->sh_info); ++ /* Any section that was originally placed after the .bss ++ section should now be offset by NEW_DATA2_SIZE. */ ++ if (new_shdr->sh_offset >= old_bss_offset) ++ new_shdr->sh_offset += new_data2_size; + + /* Now, start to copy the content of sections. */ + if (new_shdr->sh_type == SHT_NULL +@@ -981,24 +561,6 @@ unexec (const char *new_name, const char *old_name) + } + } + #endif /* __sgi */ +- +- /* Patch st_shndx field of symbol table. */ +- if (new_shdr->sh_type == SHT_SYMTAB +- || new_shdr->sh_type == SHT_DYNSYM) +- { +- ptrdiff_t num = new_shdr->sh_size / new_shdr->sh_entsize; +- ElfW (Sym) *sym = (ElfW (Sym) *) (new_shdr->sh_offset + new_base); +- for (; num--; sym++) +- { +- if (sym->st_shndx == SHN_XINDEX) +- fatal ("SHT_SYMTAB_SHNDX unsupported"); +- if (sym->st_shndx == SHN_UNDEF +- || sym->st_shndx >= SHN_LORESERVE) +- continue; +- +- PATCH_INDEX (sym->st_shndx); +- } +- } + } + + /* Update the symbol values of _edata and _end. */ +@@ -1042,15 +604,10 @@ unexec (const char *new_name, const char *old_name) + ElfW (Shdr) *new_shdr = &NEW_SECTION_H (symp->st_shndx); + if (new_shdr->sh_type != SHT_NOBITS) + { +- ElfW (Shdr) *old_shdr; ++ ElfW (Shdr) *old_shdr = &OLD_SECTION_H (symp->st_shndx); + ptrdiff_t reladdr = symp->st_value - new_shdr->sh_addr; + ptrdiff_t newoff = reladdr + new_shdr->sh_offset; + +- /* "Unpatch" index. */ +- nn = symp->st_shndx; +- if (nn > old_bss_index) +- nn--; +- old_shdr = &OLD_SECTION_H (nn); + if (old_shdr->sh_type == SHT_NOBITS) + memset (new_base + newoff, 0, symp->st_size); + else +@@ -1065,6 +622,25 @@ unexec (const char *new_name, const char *old_name) + } + } + ++ /* Modify the names of sections we changed from SHT_NOBITS to ++ SHT_PROGBITS. This is really just cosmetic, but some tools that ++ (wrongly) operate on section names rather than types might be ++ confused by a SHT_PROGBITS .bss section. */ ++ new_section_names = ((char *) new_base ++ + NEW_SECTION_H (new_file_h->e_shstrndx).sh_offset); ++ for (n = new_file_h->e_shnum; 0 < --n; ) ++ { ++ ElfW (Shdr) *old_shdr = &OLD_SECTION_H (n); ++ ElfW (Shdr) *new_shdr = &NEW_SECTION_H (n); ++ ++ /* Replace the leading '.' with ','. When .shstrtab is string ++ merged this will rename both .bss and .rela.bss to ,bss and ++ .rela,bss. */ ++ if (old_shdr->sh_type == SHT_NOBITS ++ && new_shdr->sh_type == SHT_PROGBITS) ++ *(new_section_names + new_shdr->sh_name) = ','; ++ } ++ + /* This loop seeks out relocation sections for the data section, so + that it can undo relocations performed by the runtime loader. */ + for (n = new_file_h->e_shnum; 0 < --n; ) +-- +2.7.4 + diff --git a/SOURCES/emacs-0010-src-unexelf.c-NEW_PROGRAM_H-Remove-unused-macro-Bug-.patch b/SOURCES/emacs-0010-src-unexelf.c-NEW_PROGRAM_H-Remove-unused-macro-Bug-.patch new file mode 100644 index 0000000..7aa9324 --- /dev/null +++ b/SOURCES/emacs-0010-src-unexelf.c-NEW_PROGRAM_H-Remove-unused-macro-Bug-.patch @@ -0,0 +1,35 @@ +From b9df09624d31c34bb214a4df6f24aef3c3c37d1c Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Sun, 8 Nov 2015 09:36:14 -0800 +Subject: [PATCH 10/11] * src/unexelf.c (NEW_PROGRAM_H): Remove unused macro + (Bug#20614). + +--- + src/unexelf.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/src/unexelf.c b/src/unexelf.c +index 85ed934..c10c7f2 100644 +--- a/src/unexelf.c ++++ b/src/unexelf.c +@@ -208,8 +208,6 @@ entry_address (void *section_h, ptrdiff_t idx, ptrdiff_t entsize) + (*(ElfW (Shdr) *) entry_address (new_section_h, n, new_file_h->e_shentsize)) + #define OLD_PROGRAM_H(n) \ + (*(ElfW (Phdr) *) entry_address (old_program_h, n, old_file_h->e_phentsize)) +-#define NEW_PROGRAM_H(n) \ +- (*(ElfW (Phdr) *) entry_address (new_program_h, n, new_file_h->e_phentsize)) + + typedef unsigned char byte; + +@@ -250,7 +248,7 @@ unexec (const char *new_name, const char *old_name) + ElfW (Phdr) *old_bss_seg, *new_bss_seg; + ElfW (Addr) old_bss_addr, new_bss_addr; + ElfW (Word) old_bss_size, new_data2_size; +- ElfW (Off) old_bss_offset, new_data2_offset; ++ ElfW (Off) old_bss_offset, new_data2_offset; + + ptrdiff_t n; + ptrdiff_t old_bss_index; +-- +2.7.4 + diff --git a/SOURCES/emacs-0011-ELF-unexec-align-section-header.patch b/SOURCES/emacs-0011-ELF-unexec-align-section-header.patch new file mode 100644 index 0000000..c379805 --- /dev/null +++ b/SOURCES/emacs-0011-ELF-unexec-align-section-header.patch @@ -0,0 +1,56 @@ +From cb83c302eb77748a99940fa41026d5f373976478 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Mon, 16 Nov 2015 17:48:08 -0800 +Subject: [PATCH 11/11] ELF unexec: align section header +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This ports the recent unexelf.c changes to Fedora x86-64 +when configured with GCC’s -fsanitize=undefined option. +* src/unexelf.c (unexec): Align new_data2_size to a multiple +of ElfW (Shdr)’s alignment, so that NEW_SECTION_H returns a +pointer aligned appropriately for its type. +--- + src/unexelf.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/src/unexelf.c b/src/unexelf.c +index c10c7f2..03e6daf 100644 +--- a/src/unexelf.c ++++ b/src/unexelf.c +@@ -247,7 +247,7 @@ unexec (const char *new_name, const char *old_name) + + ElfW (Phdr) *old_bss_seg, *new_bss_seg; + ElfW (Addr) old_bss_addr, new_bss_addr; +- ElfW (Word) old_bss_size, new_data2_size; ++ ElfW (Word) old_bss_size, bss_size_growth, new_data2_size; + ElfW (Off) old_bss_offset, new_data2_offset; + + ptrdiff_t n; +@@ -331,7 +331,11 @@ unexec (const char *new_name, const char *old_name) + + new_break = sbrk (0); + new_bss_addr = (ElfW (Addr)) new_break; +- new_data2_size = new_bss_addr - old_bss_addr; ++ bss_size_growth = new_bss_addr - old_bss_addr; ++ new_data2_size = bss_size_growth; ++ new_data2_size += alignof (ElfW (Shdr)) - 1; ++ new_data2_size -= new_data2_size % alignof (ElfW (Shdr)); ++ + new_data2_offset = old_bss_offset; + + #ifdef UNEXELF_DEBUG +@@ -399,7 +403,8 @@ unexec (const char *new_name, const char *old_name) + new_bss_seg->p_memsz = new_bss_seg->p_filesz; + + /* Copy over what we have in memory now for the bss area. */ +- memcpy (new_base + new_data2_offset, (caddr_t) old_bss_addr, new_data2_size); ++ memcpy (new_base + new_data2_offset, (caddr_t) old_bss_addr, ++ bss_size_growth); + + /* Walk through all section headers, copying data and updating. */ + for (n = 1; n < old_file_h->e_shnum; n++) +-- +2.7.4 + 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-24.3-hunspell.2.patch b/SOURCES/emacs-24.3-hunspell.2.patch new file mode 100644 index 0000000..892bab0 --- /dev/null +++ b/SOURCES/emacs-24.3-hunspell.2.patch @@ -0,0 +1,13 @@ +diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el +index 7167dc9..c8f2cd7 100644 +--- a/lisp/textmodes/ispell.el ++++ b/lisp/textmodes/ispell.el +@@ -1177,7 +1177,7 @@ aspell is used along with Emacs).") + ;; Unless default dict, re-add "-d" option with the mapped value + (if dict-name + (if dict-equiv +- (nconc ispell-args (list "-d" dict-equiv)) ++ (setq ispell-args (nconc ispell-args (list "-d" dict-equiv))) + (message + "ispell-set-spellchecker-params: Missing hunspell equiv for \"%s\". Skipping." + dict-name) diff --git a/SOURCES/emacs-24.3-hunspell.patch b/SOURCES/emacs-24.3-hunspell.patch new file mode 100644 index 0000000..174c2e5 --- /dev/null +++ b/SOURCES/emacs-24.3-hunspell.patch @@ -0,0 +1,103 @@ +diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el +index 1daec44..7167dc9 100644 +--- a/lisp/textmodes/ispell.el ++++ b/lisp/textmodes/ispell.el +@@ -574,6 +574,40 @@ re-start Emacs." + (coding-system :tag "Coding System"))) + :group 'ispell) + ++(defvar ispell-hunspell-dictionary-equivs-alist ++ '(("american" "en_US") ++ ("brasileiro" "pt_BR") ++ ("british" "en_GB") ++ ("castellano" "es_ES") ++ ("castellano8" "es_ES") ++ ("czech" "cs_CZ") ++ ("dansk" "da_DK") ++ ("deutsch" "de_DE") ++ ("deutsch8" "de_DE") ++ ("english" "en_US") ++ ("esperanto" "eo") ++ ("esperanto-tex" "eo") ++ ("finnish" "fi_FI") ++ ("francais7" "fr_FR") ++ ("francais" "fr_FR") ++ ("francais-tex" "fr_FR") ++ ("german" "de_DE") ++ ("german8" "de_DE") ++ ("italiano" "it_IT") ++ ("nederlands" "nl_NL") ++ ("nederlands8" "nl_NL") ++ ("norsk" "nn_NO") ++ ("norsk7-tex" "nn_NO") ++ ("polish" "pl_PL") ++ ("portugues" "pt_PT") ++ ("russian" "ru_RU") ++ ("russianw" "ru_RU") ++ ("slovak" "sk_SK") ++ ("slovenian" "sl_SI") ++ ("svenska" "sv_SE") ++ ("hebrew" "he_IL")) ++ "Alist with matching hunspell dict names for standard dict names in ++ `ispell-dictionary-base-alist'.") + + (defvar ispell-dictionary-base-alist + '((nil ; default +@@ -1112,9 +1146,57 @@ aspell is used along with Emacs).") + ispell-encoding8-command) + ispell-aspell-dictionary-alist + nil)) ++ (ispell-dictionary-base-alist ispell-dictionary-base-alist) + ispell-base-dicts-override-alist ; Override only base-dicts-alist + all-dicts-alist) + ++ ;; While ispell and aspell (through aliases) use the traditional ++ ;; dict naming originally expected by ispell.el, hunspell ++ ;; uses locale based names with no alias. We need to map ++ ;; standard names to locale based names to make default dict ++ ;; definitions available for hunspell. ++ (if ispell-really-hunspell ++ (let (tmp-dicts-alist) ++ (dolist (adict ispell-dictionary-base-alist) ++ (let* ((dict-name (nth 0 adict)) ++ (dict-equiv ++ (cadr (assoc dict-name ++ ispell-hunspell-dictionary-equivs-alist))) ++ (ispell-args (nth 5 adict)) ++ (ispell-args-has-d (member "-d" ispell-args)) ++ skip-dict) ++ ;; Remove "-d" option from `ispell-args' if present ++ (if ispell-args-has-d ++ (let ((ispell-args-after-d ++ (cdr (cdr ispell-args-has-d))) ++ (ispell-args-before-d ++ (butlast ispell-args (length ispell-args-has-d)))) ++ (setq ispell-args ++ (nconc ispell-args-before-d ++ ispell-args-after-d)))) ++ ;; Unless default dict, re-add "-d" option with the mapped value ++ (if dict-name ++ (if dict-equiv ++ (nconc ispell-args (list "-d" dict-equiv)) ++ (message ++ "ispell-set-spellchecker-params: Missing hunspell equiv for \"%s\". Skipping." ++ dict-name) ++ (setq skip-dict t))) ++ ++ (unless skip-dict ++ (add-to-list 'tmp-dicts-alist ++ (list ++ dict-name ; dict name ++ (nth 1 adict) ; casechars ++ (nth 2 adict) ; not-casechars ++ (nth 3 adict) ; otherchars ++ (nth 4 adict) ; many-otherchars-p ++ ispell-args ; ispell-args ++ (nth 6 adict) ; extended-character-mode ++ (nth 7 adict) ; dict encoding ++ )))) ++ (setq ispell-dictionary-base-alist tmp-dicts-alist)))) ++ + (run-hooks 'ispell-initialize-spellchecker-hook) + + ;; Add dicts to ``ispell-dictionary-alist'' unless already present. diff --git a/SOURCES/emacs-bell-dont-work.patch b/SOURCES/emacs-bell-dont-work.patch new file mode 100644 index 0000000..d742290 --- /dev/null +++ b/SOURCES/emacs-bell-dont-work.patch @@ -0,0 +1,39 @@ +diff --git a/configure.ac b/configure.ac +index 62f53a3..a6f2f04 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1874,6 +1874,7 @@ if test "${HAVE_X11}" = "yes"; then + AC_MSG_RESULT($emacs_xkb) + if test $emacs_xkb = yes; then + AC_DEFINE(HAVE_XKBGETKEYBOARD, 1, [Define to 1 if you have the XkbGetKeyboard function.]) ++ AC_DEFINE(HAVE_XKB, 1, [Define to 1 if you have the Xkb extension.]) + fi + + AC_CHECK_FUNCS(XrmSetDatabase XScreenResourceString \ +diff --git a/src/xterm.c b/src/xterm.c +index fb407c8..f47141d 100644 +--- a/src/xterm.c ++++ b/src/xterm.c +@@ -130,6 +130,10 @@ extern void _XEditResCheckMessages (Widget, XtPointer, XEvent *, Boolean *); + + #include "bitmaps/gray.xbm" + ++#ifdef HAVE_XKB ++#include ++#endif ++ + /* Default to using XIM if available. */ + #ifdef USE_XIM + int use_xim = 1; +@@ -3243,7 +3247,11 @@ XTring_bell (struct frame *f) + else + { + block_input (); ++#ifdef HAVE_XKB ++ XkbBell (FRAME_X_DISPLAY (f), None, 0, None); ++#else + XBell (FRAME_X_DISPLAY (f), 0); ++#endif + XFlush (FRAME_X_DISPLAY (f)); + unblock_input (); + } diff --git a/SOURCES/emacs-enriched.patch b/SOURCES/emacs-enriched.patch new file mode 100644 index 0000000..b67c583 --- /dev/null +++ b/SOURCES/emacs-enriched.patch @@ -0,0 +1,77 @@ +commit 9ad0fcc54442a9a01d41be19880250783426db70 +Author: Lars Ingebrigtsen +Date: Fri Sep 8 20:23:31 2017 -0700 + + Remove unsafe enriched mode translations + + * lisp/gnus/mm-view.el (mm-inline-text): + Do not worry about enriched or richtext type. + * lisp/textmodes/enriched.el (enriched-translations): + Remove translations for FUNCTION, display (Bug#28350). + (enriched-handle-display-prop, enriched-decode-display-prop): Remove. + +diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el +index e5859d002c..77ad271d1d 100644 +--- a/lisp/gnus/mm-view.el ++++ b/lisp/gnus/mm-view.el +@@ -383,10 +383,6 @@ + (goto-char (point-max)))) + (save-restriction + (narrow-to-region b (point)) +- (when (member type '("enriched" "richtext")) +- (set-text-properties (point-min) (point-max) nil) +- (ignore-errors +- (enriched-decode (point-min) (point-max)))) + (mm-handle-set-undisplayer + handle + `(lambda () +diff --git a/lisp/textmodes/enriched.el b/lisp/textmodes/enriched.el +index beb6c6dda3..a8f0d3891a 100644 +--- a/lisp/textmodes/enriched.el ++++ b/lisp/textmodes/enriched.el +@@ -117,12 +117,7 @@ expression, which is evaluated to get the string to insert.") + (full "flushboth") + (center "center")) + (PARAMETER (t "param")) ; Argument of preceding annotation +- ;; The following are not part of the standard: +- (FUNCTION (enriched-decode-foreground "x-color") +- (enriched-decode-background "x-bg-color") +- (enriched-decode-display-prop "x-display")) + (read-only (t "x-read-only")) +- (display (nil enriched-handle-display-prop)) + (unknown (nil format-annotate-value)) + ; (font-size (2 "bigger") ; unimplemented + ; (-2 "smaller")) +@@ -477,32 +472,5 @@ Return value is \(begin end name positive-p), or nil if none was found." + (message "Warning: no color specified for ") + nil)) + +-;;; Handling the `display' property. +- +- +-(defun enriched-handle-display-prop (old new) +- "Return a list of annotations for a change in the `display' property. +-OLD is the old value of the property, NEW is the new value. Value +-is a list `(CLOSE OPEN)', where CLOSE is a list of annotations to +-close and OPEN a list of annotations to open. Each of these lists +-has the form `(ANNOTATION PARAM ...)'." +- (let ((annotation "x-display") +- (param (prin1-to-string (or old new)))) +- (if (null old) +- (cons nil (list (list annotation param))) +- (cons (list (list annotation param)) nil)))) +- +-(defun enriched-decode-display-prop (start end &optional param) +- "Decode a `display' property for text between START and END. +-PARAM is a `' found for the property. +-Value is a list `(START END SYMBOL VALUE)' with START and END denoting +-the range of text to assign text property SYMBOL with value VALUE." +- (let ((prop (when (stringp param) +- (condition-case () +- (car (read-from-string param)) +- (error nil))))) +- (unless prop +- (message "Warning: invalid parameter %s" param)) +- (list start end 'display prop))) + + ;;; enriched.el ends here diff --git a/SOURCES/emacs-environment-crash.patch b/SOURCES/emacs-environment-crash.patch new file mode 100644 index 0000000..a164d9e --- /dev/null +++ b/SOURCES/emacs-environment-crash.patch @@ -0,0 +1,94 @@ +Upstream report: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13054 +Upstream commit: 21e54a94d7527e07ddc37066c8cb488f478339c9 +Resolves: #1308518 + +--- emacs-24.3/src/callproc.c 2013-02-02 04:20:04.000000000 +0100 ++++ emacs-24.3-new/src/callproc.c 2016-02-29 08:24:53.628487375 +0100 +@@ -491,9 +491,6 @@ usage: (call-process PROGRAM &optional I + } + + { +- /* child_setup must clobber environ in systems with true vfork. +- Protect it from permanent change. */ +- register char **save_environ = environ; + register int fd1 = fd[1]; + int fd_error = fd1; + +@@ -640,8 +637,6 @@ usage: (call-process PROGRAM &optional I + emacs_close (fd_error); + #endif /* not MSDOS */ + +- environ = save_environ; +- + /* Close most of our fd's, but not fd[0] + since we will use that to read input from. */ + emacs_close (filefd); +@@ -1098,10 +1093,6 @@ add_env (char **env, char **new_env, cha + Initialize inferior's priority, pgrp, connected dir and environment. + then exec another program based on new_argv. + +- This function may change environ for the superior process. +- Therefore, the superior process must save and restore the value +- of environ around the vfork and the call to this function. +- + If SET_PGRP, put the subprocess into a separate process group. + + CURRENT_DIR is an elisp string giving the path of the current +@@ -1308,11 +1299,7 @@ child_setup (int in, int out, int err, c + /* setpgrp_of_tty is incorrect here; it uses input_fd. */ + tcsetpgrp (0, pid); + +- /* execvp does not accept an environment arg so the only way +- to pass this environment is to set environ. Our caller +- is responsible for restoring the ambient value of environ. */ +- environ = env; +- execvp (new_argv[0], new_argv); ++ execve (new_argv[0], new_argv, env); + + emacs_write (1, "Can't exec program: ", 20); + emacs_write (1, new_argv[0], strlen (new_argv[0])); +--- emacs-24.3/src/process.c 2013-01-01 21:37:17.000000000 +0100 ++++ emacs-24.3-new/src/process.c 2016-02-29 08:23:23.218671832 +0100 +@@ -1606,9 +1606,6 @@ create_process (Lisp_Object process, cha + volatile int pty_flag = 0; + volatile Lisp_Object lisp_pty_name = Qnil; + volatile Lisp_Object encoded_current_dir; +-#if HAVE_WORKING_VFORK +- char **volatile save_environ; +-#endif + + inchannel = outchannel = -1; + +@@ -1728,12 +1725,6 @@ create_process (Lisp_Object process, cha + pthread_sigmask (SIG_BLOCK, &blocked, 0); + #endif + +-#if HAVE_WORKING_VFORK +- /* child_setup must clobber environ on systems with true vfork. +- Protect it from permanent change. */ +- save_environ = environ; +-#endif +- + #ifndef WINDOWSNT + pid = vfork (); + if (pid == 0) +@@ -1875,10 +1866,6 @@ create_process (Lisp_Object process, cha + + /* Back in the parent process. */ + +-#if HAVE_WORKING_VFORK +- environ = save_environ; +-#endif +- + XPROCESS (process)->pid = pid; + + /* Stop blocking signals in the parent. */ +@@ -1928,7 +1915,7 @@ create_process (Lisp_Object process, cha + /* Wait for child_setup to complete in case that vfork is + actually defined as fork. The descriptor wait_child_setup[1] + of a pipe is closed at the child side either by close-on-exec +- on successful execvp or the _exit call in child_setup. */ ++ on successful execve or the _exit call in child_setup. */ + { + char dummy; + diff --git a/SOURCES/emacs-gtk-warning.patch b/SOURCES/emacs-gtk-warning.patch new file mode 100644 index 0000000..b01f2cf --- /dev/null +++ b/SOURCES/emacs-gtk-warning.patch @@ -0,0 +1,43 @@ +diff --git a/src/gtkutil.c b/src/gtkutil.c +index 44f828c..d434a48 100644 +--- a/src/gtkutil.c ++++ b/src/gtkutil.c +@@ -784,6 +784,14 @@ xg_hide_tooltip (FRAME_PTR f) + General functions for creating widgets, resizing, events, e.t.c. + ***********************************************************************/ + ++static void ++my_log_handler (const gchar *log_domain, GLogLevelFlags log_level, ++ const gchar *msg, gpointer user_data) ++{ ++ if (!strstr (msg, "visible children")) ++ fprintf (stderr, "XX %s-WARNING **: %s\n", log_domain, msg); ++} ++ + /* Make a geometry string and pass that to GTK. It seems this is the + only way to get geometry position right if the user explicitly + asked for a position when starting Emacs. +@@ -799,6 +807,7 @@ xg_set_geometry (FRAME_PTR f) + int top = f->top_pos; + int yneg = f->size_hint_flags & YNegative; + char geom_str[sizeof "=x--" + 4 * INT_STRLEN_BOUND (int)]; ++ guint id; + + if (xneg) + left = -left; +@@ -811,9 +820,15 @@ xg_set_geometry (FRAME_PTR f) + (xneg ? '-' : '+'), left, + (yneg ? '-' : '+'), top); + ++ /* Silence warning about visible children. */ ++ id = g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL ++ | G_LOG_FLAG_RECURSION, my_log_handler, NULL); ++ + if (!gtk_window_parse_geometry (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), + geom_str)) + fprintf (stderr, "Failed to parse: '%s'\n", geom_str); ++ ++ g_log_remove_handler ("Gtk", id); + } + } + diff --git a/SOURCES/emacs-help-update.patch b/SOURCES/emacs-help-update.patch new file mode 100644 index 0000000..b0aa0ce --- /dev/null +++ b/SOURCES/emacs-help-update.patch @@ -0,0 +1,40 @@ +diff --git a/doc/man/emacs.1 b/doc/man/emacs.1 +index 4f7f8d2..50d8038 100644 +--- a/doc/man/emacs.1 ++++ b/doc/man/emacs.1 +@@ -61,6 +61,9 @@ The following options are of general interest: + Edit + .IR file . + .TP ++.BI \-\-chdir " directory\fR\fP " ++Change to directory ++.TP + .BI \-\-file " file\fR,\fP " \-\-find-file " file\fR,\fP " \-\-visit " file" + The same as specifying + .I file +@@ -82,9 +85,15 @@ and + .BR \-q ", " \-\-no\-init\-file + Do not load an init file. + .TP ++.BR \-nl ", " \-\-no\-shared\-memory ++Do not use shared memory ++.TP + .B \-\-no\-site\-file + Do not load the site-wide startup file. + .TP ++.BR \-nsl ", " \-\-no\-site\-list ++Do not add site-lisp directories to load-path ++.TP + .B \-\-no\-desktop + Do not load a saved desktop. + .TP +@@ -325,6 +334,9 @@ in iconified state. + .BR \-nbc ", " \-\-no\-blinking\-cursor + Disable blinking cursor. + .TP ++.BR \-\-parent-id " xid\fR\fP " ++Set parent window ++.TP + .BR \-nw ", " \-\-no\-window\-system + Tell + .I Emacs 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/SOURCES/emacs-remove-memory-warning.patch b/SOURCES/emacs-remove-memory-warning.patch new file mode 100644 index 0000000..03ef15e --- /dev/null +++ b/SOURCES/emacs-remove-memory-warning.patch @@ -0,0 +1,13 @@ +diff --git a/src/vm-limit.c b/src/vm-limit.c +index ca7ac4f..78fa702 100644 +--- a/src/vm-limit.c ++++ b/src/vm-limit.c +@@ -292,7 +292,7 @@ memory_warnings (POINTER start, void (*warnfun) (const char *)) + else + data_space_start = start_of_data (); + +- warn_function = warnfun; ++ warn_function = NULL; + __after_morecore_hook = check_memory_limits; + + /* Force data limit to be recalculated on each run. */ diff --git a/SOURCES/emacs-spellchecker.patch b/SOURCES/emacs-spellchecker.patch new file mode 100644 index 0000000..24e1d3c --- /dev/null +++ b/SOURCES/emacs-spellchecker.patch @@ -0,0 +1,16 @@ +diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el +index 1d28de7..1daec44 100644 +--- a/lisp/textmodes/ispell.el ++++ b/lisp/textmodes/ispell.el +@@ -351,9 +351,9 @@ Must be greater than 1." + :group 'ispell) + + (defcustom ispell-program-name +- (or (executable-find "aspell") ++ (or (executable-find "hunspell") ++ (executable-find "aspell") + (executable-find "ispell") +- (executable-find "hunspell") + "ispell") + "Program invoked by \\[ispell-word] and \\[ispell-region] commands." + :type 'string diff --git a/SOURCES/emacs-style-change-cb.patch b/SOURCES/emacs-style-change-cb.patch new file mode 100644 index 0000000..382e7fb --- /dev/null +++ b/SOURCES/emacs-style-change-cb.patch @@ -0,0 +1,15 @@ +diff --git a/src/gtkutil.c b/src/gtkutil.c +index e76b0a7..b3aa335 100644 +--- a/src/gtkutil.c ++++ b/src/gtkutil.c +@@ -1079,7 +1079,9 @@ style_changed_cb (GObject *go, + FOR_EACH_FRAME (rest, frame) + { + FRAME_PTR f = XFRAME (frame); +- if (FRAME_X_DISPLAY (f) == dpy) ++ if (FRAME_LIVE_P (f) ++ && FRAME_X_P (f) ++ && FRAME_X_DISPLAY (f) == dpy) + { + x_set_scroll_bar_default_width (f); + xg_frame_set_char_size (f, FRAME_COLS (f), FRAME_LINES (f)); diff --git a/SOURCES/emacs-terminal.desktop b/SOURCES/emacs-terminal.desktop new file mode 100644 index 0000000..3c12470 --- /dev/null +++ b/SOURCES/emacs-terminal.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=Emacs Terminal +GenericName=Emacs Terminal +Comment=Emacs Terminal Mode +Exec=emacs-terminal +Icon=utilities-terminal +Type=Application +Terminal=false +Categories=Application;Utility;X-Red-Hat-Base;GTK;TerminalEmulator; +Encoding=UTF-8 +StartupWMClass=Emacs diff --git a/SOURCES/emacs-terminal.sh b/SOURCES/emacs-terminal.sh new file mode 100644 index 0000000..bc0592a --- /dev/null +++ b/SOURCES/emacs-terminal.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +exec /usr/bin/emacs -Q --eval '(term "/bin/bash")' diff --git a/SOURCES/emacs.desktop b/SOURCES/emacs.desktop new file mode 100644 index 0000000..a239a0e --- /dev/null +++ b/SOURCES/emacs.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Name=Emacs +GenericName=Text Editor +Comment=Edit text +Comment[zh_TW]=編輯文字 +MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; +Exec=emacs %f +Icon=emacs +Type=Application +Terminal=false +Categories=Application;Utility;TextEditor;X-Red-Hat-Base; +Encoding=UTF-8 +StartupWMClass=Emacs diff --git a/SOURCES/emacsclient.desktop b/SOURCES/emacsclient.desktop new file mode 100644 index 0000000..7e9cc1d --- /dev/null +++ b/SOURCES/emacsclient.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Name=Emacs Client +GenericName=Text Editor +Comment=Edit text +MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; +Exec=emacsclient -c --alternate-editor="" %f +Icon=emacs +Type=Application +Terminal=false +Categories=Application;Utility;TextEditor;X-Red-Hat-Base; +Encoding=UTF-8 +StartupWMClass=Emacs diff --git a/SOURCES/site-start.el b/SOURCES/site-start.el new file mode 100644 index 0000000..efbb75b --- /dev/null +++ b/SOURCES/site-start.el @@ -0,0 +1,9 @@ +;;; loaded before user's ".emacs" file and default.el + +;; load *.el and *.elc in /usr/share/emacs/site-lisp/site-start.d on startup +(mapc + 'load + (delete-dups + (mapcar 'file-name-sans-extension + (directory-files + "/usr/share/emacs/site-lisp/site-start.d" t "\\.elc?\\'")))) diff --git a/SPECS/emacs.spec b/SPECS/emacs.spec new file mode 100644 index 0000000..0737977 --- /dev/null +++ b/SPECS/emacs.spec @@ -0,0 +1,2055 @@ +%undefine _hardened_build +# This file is encoded in UTF-8. -*- coding: utf-8 -*- +Summary: GNU Emacs text editor +Name: emacs +Epoch: 1 +Version: 24.3 +Release: 22%{?dist} +License: GPLv3+ +URL: http://www.gnu.org/software/emacs/ +Group: Applications/Editors +Source0: ftp://ftp.gnu.org/gnu/emacs/emacs-%{version}.tar.xz +Source1: emacs.desktop +Source2: emacsclient.desktop +Source3: dotemacs.el +Source4: site-start.el +Source5: default.el +# Emacs Terminal Mode, #551949, #617355 +Source6: emacs-terminal.desktop +Source7: emacs-terminal.sh +# rhbz#713600 +Patch7: emacs-spellchecker.patch +# Fix for emacs bug #922519 +Patch10: emacs-style-change-cb.patch +# Fix for emacs bug #562719 +Patch11: emacs-bell-dont-work.patch +# Fix for emacs bug #929353 +Patch12: emacs-gtk-warning.patch +# Fix for emacs bug #948838 +Patch13: emacs-help-update.patch +# Fix for emacs counts used memory incorrectly #107836 +Patch14: emacs-remove-memory-warning.patch +# Fix for emacs building under ppc64le +Patch16: emacs-0001-ppc64-fixes-prepatch.patch +Patch17: emacs-0002-ELF-unexec-Correct-section-header-index.patch +Patch18: emacs-0003-ELF-unexec-Tidy-code.patch +Patch19: emacs-0004-ELF-unexec-Merge-Alpha-and-MIPS-COFF-debug-handling.patch +Patch20: emacs-0005-ELF-unexec-Symbol-table-patching.patch +Patch21: emacs-0006-ELF-unexec-_OBJC_-symbols-in-bss-sections.patch +Patch22: emacs-0007-ELF-unexec-R_-_NONE-relocs.patch +Patch23: emacs-0008-ELF-unexec-Drive-from-PT_LOAD-header-rather-than-sec.patch +Patch24: emacs-0009-ELF-unexec-Don-t-insert-a-new-section.patch +Patch25: emacs-0010-src-unexelf.c-NEW_PROGRAM_H-Remove-unused-macro-Bug-.patch +Patch26: emacs-0011-ELF-unexec-align-section-header.patch +# Fix for #1308518, upstreamed +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 +Patch101: emacs-24.3-hunspell.2.patch + + +BuildRequires: atk-devel cairo-devel freetype-devel fontconfig-devel dbus-devel giflib-devel glibc-devel libpng-devel +BuildRequires: libjpeg-devel libtiff-devel libX11-devel libXau-devel libXdmcp-devel libXrender-devel libXt-devel +BuildRequires: libXpm-devel ncurses-devel xorg-x11-proto-devel zlib-devel gnutls-devel +BuildRequires: librsvg2-devel m17n-lib-devel libotf-devel ImageMagick-devel libselinux-devel +BuildRequires: GConf2-devel alsa-lib-devel gpm-devel liblockfile-devel libxml2-devel +BuildRequires: bzip2 cairo texinfo gzip desktop-file-utils +%if 0%{?rhel} == 6 +BuildRequires: gtk2-devel +%else +%if 0%{?rhel} == 7 +BuildRequires: gtk3-devel +BuildRequires: python2-devel +# Buildrequire both python2 and python3 on systems containing both, +# since below we turn off the brp-python-bytecompile script +%else +BuildRequires: gtk3-devel +BuildRequires: python2-devel +BuildRequires: python3-devel +%endif +%endif + +%ifarch %{ix86} +BuildRequires: util-linux +%endif + +# Emacs doesn't run without dejavu-sans-mono-fonts, rhbz#732422 +Requires: desktop-file-utils dejavu-sans-mono-fonts +Requires(preun): %{_sbindir}/alternatives +Requires(posttrans): %{_sbindir}/alternatives +Requires: emacs-common = %{epoch}:%{version}-%{release} +Provides: emacs(bin) = %{epoch}:%{version}-%{release} + +%if 0%{!?rhel:1} +# Turn off the brp-python-bytecompile script since this script doesn't +# properly dtect the correct python runtime for the files emacs2.py and +# emacs3.py +%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') +%endif + +%define paranoid 1 +%if 0%{?fedora} +%define expurgate 0 +%else +%define expurgate 1 +%endif + +%define site_lisp %{_datadir}/emacs/site-lisp +%define site_start_d %{site_lisp}/site-start.d +%define bytecompargs -batch --no-init-file --no-site-file -f batch-byte-compile +%define pkgconfig %{_datadir}/pkgconfig +%define emacs_libexecdir %{_libexecdir}/emacs/%{version}/%{_host} + +%description +Emacs is a powerful, customizable, self-documenting, modeless text +editor. Emacs contains special code editing features, a scripting +language (elisp), and the capability to read mail, news, and more +without leaving the editor. + +This package provides an emacs binary with support for X windows. + +%package nox +Summary: GNU Emacs text editor without X support +Group: Applications/Editors +Requires(preun): %{_sbindir}/alternatives +Requires(posttrans): %{_sbindir}/alternatives +Requires: emacs-common = %{epoch}:%{version}-%{release} +Provides: emacs(bin) = %{epoch}:%{version}-%{release} + +%description nox +Emacs is a powerful, customizable, self-documenting, modeless text +editor. Emacs contains special code editing features, a scripting +language (elisp), and the capability to read mail, news, and more +without leaving the editor. + +This package provides an emacs binary with no X windows support for running +on a terminal. + +%package common +Summary: Emacs common files +# The entire source code is GPLv3+ except lib-src/etags.c which is +# also BSD. Manual (info) is GFDL. +License: GPLv3+ and GFDL and BSD +Group: Applications/Editors +Requires(preun): /sbin/install-info +Requires(preun): %{_sbindir}/alternatives +Requires(posttrans): %{_sbindir}/alternatives +Requires(post): /sbin/install-info +Requires: %{name}-filesystem + +%description common +Emacs is a powerful, customizable, self-documenting, modeless text +editor. Emacs contains special code editing features, a scripting +language (elisp), and the capability to read mail, news, and more +without leaving the editor. + +This package contains all the common files needed by emacs or emacs-nox. + +%package el +Summary: Lisp source files included with GNU Emacs +Group: Applications/Editors +Requires: %{name}-filesystem +BuildArch: noarch + +%description el +Emacs-el contains the emacs-elisp sources for many of the elisp +programs included with the main Emacs text editor package. + +You need to install emacs-el only if you intend to modify any of the +Emacs packages or see some elisp examples. + +%package terminal +Summary: A desktop menu item for GNU Emacs terminal. +Group: Applications/Editors +Requires: emacs = %{epoch}:%{version}-%{release} +BuildArch: noarch + +%description terminal +Contains a desktop menu item running GNU Emacs terminal. Install +emacs-terminal if you need a terminal with Malayalam support. + +Please note that emacs-terminal is a temporary package and it will be +removed when another terminal becomes capable of handling Malayalam. + +%package filesystem +Summary: Emacs filesystem layout +Group: Applications/Editors +BuildArch: noarch + +%description filesystem +This package provides some directories which are required by other +packages that add functionality to Emacs. + +%prep +%setup -q + +%patch7 -p1 -b .spellchecker + +%patch10 -p1 -b .style-change-cb.patch +%patch11 -p1 -b .bell-dont-work.patch +%patch12 -p1 -b .gtk-warning.patch +%patch13 -p1 -b .help-update.patch +%patch14 -p1 -b .remove-warning.patch +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 +%patch22 -p1 +%patch23 -p1 +%patch24 -p1 +%patch25 -p1 +%patch26 -p1 +%patch27 -p1 +%patch28 -p1 +%patch29 -p1 +%patch30 -p1 +%patch31 -p1 +%patch32 -p1 + +%patch100 -p1 -b .hunspell +%patch101 -p1 -b .hunspell.2 +if test configure.ac -nt aclocal.m4 -o m4/gnulib-comp.m4 -nt aclocal.m4 ; then + sleep 1 + touch aclocal.m4 +fi +if test configure.ac -nt configure -o aclocal.m4 -nt configure ; then + sleep 1 + touch configure +fi +if test configure.ac -nt src/stamp-h.in -o aclocal.m4 -nt src/stamp-h.in ; then + sleep 1 + touch src/stamp-h.in +fi +if test aclocal.m4 -nt lib/Makefile.in -o lib/Makefile.am -nt lib/Makefile.in -o lib/gnulib.mk -nt lib/Makefile.in ; then + sleep 1 + touch lib/Makefile.in +fi +if test -s autogen.sh ; then + mv autogen.sh autogen.sh.no + ln -sf /bin/true autogen.sh +fi + +# We prefer our emacs.desktop file +cp %SOURCE1 etc/emacs.desktop + +grep -v "tetris.elc" lisp/Makefile.in > lisp/Makefile.in.new \ + && mv lisp/Makefile.in.new lisp/Makefile.in + +# Avoid trademark issues +%if %{paranoid} +rm -f lisp/play/tetris.el lisp/play/tetris.elc +%endif + +%if %{expurgate} +rm -f etc/sex.6 etc/condom.1 etc/celibacy.1 etc/COOKIES etc/future-bug etc/JOKES +%endif + +info_files="ada-mode auth autotype bovine calc ccmode cl dbus dired-x ebrowse ede ediff edt efaq eieio eintr elisp emacs-gnutls emacs-mime emacs epa erc ert eshell eudc flymake forms gnus htmlfontify idlwave info mairix-el message mh-e newsticker nxml-mode org pcl-cvs pgg rcirc reftex remember sasl sc semantic ses sieve smtpmail speedbar srecode tramp url vip viper widget wisent woman" + +cd info +for f in $(ls -1 *.info); do + f=`echo $f | sed 's/\.info//g'` + if [ ! -z "${info_files##*$f*}" ] ;then + echo Please update info_files. $f is missing.>&2 + exit 1 + fi +done +cd .. + +%ifarch %{ix86} +%define setarch setarch %{_arch} -R +%else +%define setarch %{nil} +%endif + +# Avoid duplicating doc files in the common subpackage +ln -s ../../%{name}/%{version}/etc/COPYING doc +ln -s ../../%{name}/%{version}/etc/NEWS doc + +%build +# Remove unpatched files as all files in the lisp directory are +# installed. +rm lisp/textmodes/ispell.el.hunspell +rm lisp/textmodes/ispell.el.hunspell.2 +rm lisp/textmodes/ispell.el.spellchecker + +# don't compile with -O2 on arm, it can lead to segfault +%ifarch aarch64 +export CFLAGS="-DMAIL_USE_LOCKF $RPM_OPT_FLAGS -O0" +%else +export CFLAGS="-DMAIL_USE_LOCKF $RPM_OPT_FLAGS" +%endif + +%if 0%{?rhel} == 6 +%define toolkit gtk +%else +%define toolkit gtk3 +%endif + +%configure --with-dbus --with-gif --with-jpeg --with-png --with-rsvg \ + --with-tiff --with-xft --with-xpm --with-x-toolkit=%{toolkit} --with-gpm=no +make bootstrap +%{setarch} make %{?_smp_mflags} +cp src/emacs emacs-gtk +make distclean + +%configure --with-x=no +%{setarch} make %{?_smp_mflags} +cp src/emacs emacs-nox + +# Create pkgconfig file +cat > emacs.pc << EOF +sitepkglispdir=%{site_lisp} +sitestartdir=%{site_start_d} + +Name: emacs +Description: GNU Emacs text editor +Version: %{epoch}:%{version} +EOF + +# Create macros.emacs RPM macro file +cat > macros.emacs << EOF +%%_emacs_version %{version} +%%_emacs_ev %{?epoch:%{epoch}:}%{version} +%%_emacs_evr %{?epoch:%{epoch}:}%{version}-%{release} +%%_emacs_sitelispdir %{site_lisp} +%%_emacs_sitestartdir %{site_start_d} +%%_emacs_bytecompile /usr/bin/emacs -batch --no-init-file --no-site-file --eval '(progn (setq load-path (cons "." load-path)))' -f batch-byte-compile +EOF + +%install +make install INSTALL="%{__install} -p" DESTDIR=%{buildroot} + +# Let alternatives manage the symlink +rm %{buildroot}%{_bindir}/emacs +touch %{buildroot}%{_bindir}/emacs + +# Do not compress the files which implement compression itself (#484830) +gunzip %{buildroot}%{_datadir}/emacs/%{version}/lisp/jka-compr.el.gz +gunzip %{buildroot}%{_datadir}/emacs/%{version}/lisp/jka-cmpr-hook.el.gz + +# Install the emacs with GTK support +install -p -m 1755 emacs-gtk %{buildroot}%{_bindir}/emacs-%{version} + +# Install the emacs without X +install -p -m 0755 emacs-nox %{buildroot}%{_bindir}/emacs-%{version}-nox + +# Make sure movemail isn't setgid +chmod 755 %{buildroot}%{emacs_libexecdir}/movemail + +mkdir -p %{buildroot}%{site_lisp} +install -p -m 0644 %SOURCE4 %{buildroot}%{site_lisp}/site-start.el +install -p -m 0644 %SOURCE5 %{buildroot}%{site_lisp} + +# This solves bz#474958, "update-directory-autoloads" now finally +# works the path is different each version, so we'll generate it here +echo "(setq source-directory \"%{_datadir}/emacs/%{version}/\")" \ + >> %{buildroot}%{site_lisp}/site-start.el + +mv %{buildroot}%{_bindir}/{etags,etags.emacs} +mv %{buildroot}%{_mandir}/man1/{ctags.1.gz,gctags.1.gz} +mv %{buildroot}%{_mandir}/man1/{etags.1.gz,etags.emacs.1.gz} +mv %{buildroot}%{_bindir}/{ctags,gctags} +# BZ 927996 +mv %{buildroot}%{_infodir}/{info.info.gz,info.gz} + +mkdir -p %{buildroot}%{site_lisp}/site-start.d + +# Default initialization file +mkdir -p %{buildroot}%{_sysconfdir}/skel +install -p -m 0644 %SOURCE3 %{buildroot}%{_sysconfdir}/skel/.emacs + +# Install pkgconfig file +mkdir -p %{buildroot}/%{pkgconfig} +install -p -m 0644 emacs.pc %{buildroot}/%{pkgconfig} + +# Install emacsclient desktop file +install -p -m 0644 %SOURCE2 %{buildroot}/%{_datadir}/applications/emacsclient.desktop + +# Install rpm macro definition file +mkdir -p %{buildroot}%{_sysconfdir}/rpm +install -p -m 0644 macros.emacs %{buildroot}%{_sysconfdir}/rpm/ + +# Installing emacs-terminal binary +install -p -m 755 %SOURCE7 %{buildroot}%{_bindir}/emacs-terminal + +# After everything is installed, remove info dir +rm -f %{buildroot}%{_infodir}/dir +rm %{buildroot}%{_localstatedir}/games/emacs/* + +# Install desktop files +mkdir -p %{buildroot}%{_datadir}/applications +desktop-file-install --dir=%{buildroot}%{_datadir}/applications \ + %SOURCE1 +desktop-file-install --dir=%{buildroot}%{_datadir}/applications \ + %SOURCE6 + +# Byte compile emacs*.py with correct python interpreters +%if 0%{?rhel:1} +rm -f %{buildroot}%{_datadir}/%{name}/%{version}/etc/emacs3.py +%else +%py_byte_compile %{__python} %{buildroot}%{_datadir}/%{name}/%{version}/etc/emacs.py +%py_byte_compile %{__python} %{buildroot}%{_datadir}/%{name}/%{version}/etc/emacs2.py +%py_byte_compile %{__python3} %{buildroot}%{_datadir}/%{name}/%{version}/etc/emacs3.py +%endif + +# +# Create file lists +# +rm -f *-filelist {common,el}-*-files + +( TOPDIR=${PWD} + cd %{buildroot} + + find .%{_datadir}/emacs/%{version}/lisp \ + .%{_datadir}/emacs/%{version}/leim \ + .%{_datadir}/emacs/site-lisp \( -type f -name '*.elc' -fprint $TOPDIR/common-lisp-none-elc-files \) -o \( -type d -fprintf $TOPDIR/common-lisp-dir-files "%%%%dir %%p\n" \) -o \( -name '*.el.gz' -fprint $TOPDIR/el-bytecomped-files -o -fprint $TOPDIR/common-not-comped-files \) + +) + +# Put the lists together after filtering ./usr to /usr +sed -i -e "s|\.%{_prefix}|%{_prefix}|" *-files +cat common-*-files > common-filelist +cat el-*-files common-lisp-dir-files > el-filelist + +%post +update-desktop-database &> /dev/null || : +touch --no-create %{_datadir}/icons/hicolor +if [ -x %{_bindir}/gtk-update-icon-cache ] ; then + %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || : +fi + +%preun +%{_sbindir}/alternatives --remove emacs %{_bindir}/emacs-%{version} + +%postun +update-desktop-database &> /dev/null || : +touch --no-create %{_datadir}/icons/hicolor +if [ -x %{_bindir}/gtk-update-icon-cache ] ; then + %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || : +fi + +%posttrans +%{_sbindir}/alternatives --install %{_bindir}/emacs emacs %{_bindir}/emacs-%{version} 80 + +%preun nox +%{_sbindir}/alternatives --remove emacs %{_bindir}/emacs-%{version}-nox + +%posttrans nox +%{_sbindir}/alternatives --install %{_bindir}/emacs emacs %{_bindir}/emacs-%{version}-nox 70 + +%post common +for f in %{info_files}; do + /sbin/install-info %{_infodir}/$f.info.gz %{_infodir}/dir 2> /dev/null || : +done + +%preun common +%{_sbindir}/alternatives --remove emacs.etags %{_bindir}/etags.emacs +if [ "$1" = 0 ]; then + for f in %{info_files}; do + /sbin/install-info --delete %{_infodir}/$f.info.gz %{_infodir}/dir 2> /dev/null || : + done +fi + +%posttrans common +%{_sbindir}/alternatives --install %{_bindir}/etags emacs.etags %{_bindir}/etags.emacs 80 \ + --slave %{_mandir}/man1/etags.1.gz emacs.etags.man %{_mandir}/man1/etags.emacs.1.gz + +%post terminal +update-desktop-database &> /dev/null || : + +%postun terminal +update-desktop-database &> /dev/null || : + +%files +%{_bindir}/emacs-%{version} +%attr(0755,-,-) %ghost %{_bindir}/emacs +%{_datadir}/applications/emacs.desktop +%{_datadir}/applications/emacsclient.desktop +%{_datadir}/icons/hicolor/*/apps/emacs.png +#%{_datadir}/icons/hicolor/*/apps/emacs22.png +%{_datadir}/icons/hicolor/scalable/apps/emacs.svg +%{_datadir}/icons/hicolor/scalable/mimetypes/emacs-document.svg + +%files nox +%{_bindir}/emacs-%{version}-nox +%attr(0755,-,-) %ghost %{_bindir}/emacs + +%files -f common-filelist common +%config(noreplace) %{_sysconfdir}/skel/.emacs +%{_sysconfdir}/rpm/macros.emacs +%doc doc/NEWS BUGS README doc/COPYING +%{_bindir}/ebrowse +%{_bindir}/emacsclient +%{_bindir}/etags.emacs +%{_bindir}/gctags +%{_bindir}/grep-changelog +#%{_bindir}/rcs-checkin +%{_mandir}/*/* +%{_infodir}/* +%dir %{_datadir}/emacs/%{version} +%{_datadir}/emacs/%{version}/etc +%{_datadir}/emacs/%{version}/site-lisp +%{_libexecdir}/emacs +%attr(0644,root,root) %config(noreplace) %{_datadir}/emacs/site-lisp/default.el +%attr(0644,root,root) %config %{_datadir}/emacs/site-lisp/site-start.el + +%files -f el-filelist el +%{pkgconfig}/emacs.pc +%doc etc/COPYING +%dir %{_datadir}/emacs/%{version} + +%files terminal +%{_bindir}/emacs-terminal +%{_datadir}/applications/emacs-terminal.desktop + +%files filesystem +%dir %{_datadir}/emacs +%dir %{_datadir}/emacs/site-lisp +%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 (#1490451) + +* Fri Jan 6 2017 Jan Synáček - 1:24.3-19 +- fix build failure on ppc64 (#1336711) +- fix emacs crashes (#1308518) + +* Wed Oct 07 2015 Petr Hracek - 1:24.3-18 +- Fix for sbit on emacs binary +- Related: #1223033 + +* Wed Oct 07 2015 Petr Hracek - 1:24.3-17 +- emacs on ppc64le fails to build from source when RELRO is enabled +- Related: #1223033 + +* Fri Sep 18 2015 Petr Hracek - 1:24.3-16 +- emacs on ppc64le fails to build from source when RELRO is enabled +- Resolves: #1223033 + +* Tue Sep 15 2015 Petr Hracek - 1:24.3-15 +- Updated texts in patch and SPEC file +- Resolves: #1223033 + +* Wed Jul 15 2015 Petr Hracek - 1:24.3-14 +- texinfo not reading all of /usr/share/info content +- Resolves: #1192538 + +* Thu May 21 2015 Petr Hracek - 1:24.3-13 +- Resolves: #1077836 emacs counts used memory incorrectly + +* Thu Oct 23 2014 jchaloup - 1:24.3-12 +- Disable opmitization for arm architecture + resolves: #1155952 + +* Fri Jan 24 2014 Daniel Mach - 1:24.3-11 +- Mass rebuild 2014-01-24 + +* Fri Dec 27 2013 Daniel Mach - 1:24.3-10 +- Mass rebuild 2013-12-27 + +* Tue Apr 09 2013 Petr Hracek - 1:24.3-9 +- Help and man page corrections (#948838) + +* Tue Apr 09 2013 Petr Hracek - 1:24.3-8 +- Rebuild with new file package + +* Mon Apr 08 2013 Petr Hracek - 1:24.3-7 +- Spell checking broken by non-default dictionary (#827033) + +* Thu Apr 04 2013 Petr Hracek - 1:24.3-6 +- Rebuild with new ImageMagick + +* Thu Apr 04 2013 Petr Hracek - 1:24.3-5 +- Fix for Gtk-Warning (#929353) + +* Wed Apr 03 2013 Petr Hracek - 1:24.3-4 +- Fix for info page. info.info.gz page was renamed to info.gz (#927996) + +* Thu Mar 28 2013 Petr Hracek - 1:24.3-3 +- Fix for emacs bug 112144, style_changed_cb (#922519) +- Fix for emacs bug 112131, bell does not work (#562719) + +* Mon Mar 18 2013 Petr Hracek - 1:24.3-2 +- fix #927996 correcting bug. Info pages were not delivered + +* Mon Mar 18 2013 Petr Hracek - 1:24.3-1 +- Updated to the newest upstream release +- solved problem with distribution flag in case of rhel +- rcs-checking not availble anymore +- emacs22.png are not installed anymore + +* Mon Mar 18 2013 Rex Dieter 1:24.2-12 +- rebuild (ImageMagick) + +* Fri Mar 08 2013 Ralf Corsépius - 1:24.2-11 +- Remove %%config from %%{_sysconfdir}/rpm/macros.* + (https://fedorahosted.org/fpc/ticket/259). +- Fix broken spec-file changelog entry. + +* Wed Mar 6 2013 Tomáš Mráz - 1:24.2-10 +- Rebuild with new gnutls + +* Mon Jan 21 2013 Jochen Schmitt - 1:24.2-9 +- Fix for emacs bug #13460, ispell-change dictionary hunspell issue (#903151) + +* Fri Jan 18 2013 Adam Tkac - 1:24.2-8 +- rebuild due to "jpeg8-ABI" feature drop + +* Tue Nov 06 2012 Sergio Durigan Junior - 1:24.2-7 +- Fix for Emacs bug #11580, 'Fix querying BBDB for entries without a last + name'. + +* Mon Oct 22 2012 Karel Klíč - 1:24.2-6 +- Change xorg-x11-fonts-misc dependency to dejavu-sans-mono-fonts, rhbz#732422 + +* Thu Sep 20 2012 Karel Klíč - 1:24.2-5 +- Add BSD to emacs-common licenses because of etags. + +* Fri Sep 14 2012 Karel Klíč - 1:24.2-4 +- Moved RPM spec mode to a separate package (rhbz#857865) + +* Fri Sep 14 2012 Karel Klíč - 1:24.2-3 +- Removed patch glibc-open-macro, which seems to be no longer necessary + +* Thu Sep 13 2012 Karel Klíč - 1:24.2-2 +- Removed focus-init.el which used to set focus-follows-mouse to nil. + It is set to nil by default in Emacs 24.2. + +* Thu Sep 13 2012 Karel Klíč - 1:24.2-1 +- Updated to the newest upstream release +- Switched from bz2 upstream package to xz +- Make the spec file usable on EL6 +- Removed the nogets and CVE-2012-3479 patches, because the upstream + package fixes the associated issues +- Added GFDL license to emacs-common package + +* Mon Aug 13 2012 Karel Klíč - 1:24.1-6 +- Fix CVE-2012-3479: Evaluation of 'eval' forms in file-local variable + sections, when 'enable-local-variables' set to ':safe' + +* Wed Jul 18 2012 Fedora Release Engineering - 1:24.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Fri Jul 13 2012 Karel Klíč - 1:24.1-4 +- Remove php-mode from the main package. It should be packaged separately. rhbz#751749 + +* Wed Jul 11 2012 Karel Klíč - 1:24.1-3 +- Fix org-mode to work without emacs-el installed. rhbz#830162 +- Fix building without gets function, which is removed from recent version of glibc. + +* Wed Jul 11 2012 Ville Skyttä - 1:24.1-2 +- Build -el, -terminal, and -filesystem as noarch (rhbz#834907). + +* Mon Jun 18 2012 Karel Klíč - 1:24.1-1 +- New upstream release +- Switch from GTK 2 to GTK 3 + +* Fri Jun 8 2012 Karel Klíč - 1:24.1-0.rc1 +- New upstream prerelease +- Cleanup of the %%changelog section + +* Mon May 21 2012 Karel Klíč - 1:24.0.97-1 +- Newest prerelease + +* Fri Apr 6 2012 Karel Klíč - 1:24.0.95-1 +- New upstream prerelease + +* Mon Mar 19 2012 Karel Klíč - 1:24.0.94-3 +- Another rebuild for ImageMagick update + +* Fri Mar 2 2012 Karel Klíč - 1:24.0.94-2 +- Rebuild for ImageMagick update + +* Mon Feb 27 2012 Karel Klíč - 1:24.0.94-1 +- Update to the newest prerelease +- Remove unpatched files in the lisp directory, where all files are + installed + +* Tue Feb 21 2012 Dan Horák - 1:24.0.93-4 +- add upstream fix for emacs bug 10780, revert the workaround + +* Mon Feb 13 2012 Dan Horák - 1:24.0.93-3 +- workaround build failure on ppc and s390 + (http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10780) + +* Wed Feb 8 2012 Kay Sievers - 1:24.0.93-2 +- Drop dependency on 'dev' package; it is gone since many years + +* Mon Feb 6 2012 Karel Klíč - 1:24.0.93-1 +- Update to newer pre-release version + +* Thu Jan 19 2012 Karel Klíč - 1:24.0.92-1 +- Upstream pre-release + +* Thu Jan 12 2012 Karel Klíč - 1:23.3-19 +- Added patch to handle CVE-2012-0035: CEDET global-ede-mode file loading vulnerability (rhbz#773024) + +* Sun Nov 27 2011 Ville Skyttä - 1:23.3-18 +- Apply upstream Subversion >= 1.7 dir structure fix for vc-svn.el. + +* Fri Nov 25 2011 Karel Klíč - 1:23.3-17 +- Add a new command rpm-goto-add-change-log-entry (C-c C-w) to + rpm-spec mode (Jaroslav Skarvada) + +* Fri Nov 25 2011 Karel Klíč - 1:23.3-16 +- Initialize xgselect in function xg_select when + gfds_size == 0 (rhbz#751154) + +* Wed Nov 23 2011 Karel Klíč - 1:23.3-15 +- Check for _NET_WM_STATE_HIDDEN (rhbz#711739) + +* Tue Nov 22 2011 Karel Klíč - 1:23.3-14 +- Build Gtk+ version without gpm + +* Wed Nov 16 2011 Karel Klíč - 1:23.3-13 +- Check the presence of hunspell before checking for aspell (rhbz#713600) + +* Mon Nov 14 2011 Karel Klíč - 1:23.3-12 +- Rebuild (rhbz#751154, rhbz#752936) + +* Sat Oct 22 2011 Ville Skyttä - 1:23.3-11 +- Build with gpm and liblockfile support. +- Drop ssl.el (superseded by tls.el). +- Update php-mode to 1.5.0. + +* Tue Sep 27 2011 Karel Klíč - 1:23.3-10 +- Keep COPYING and NEWS in the etc subdir, and symlinks in the docs (rhbz#714212) + Author: fedora.dm0@gmail.com + +* Tue Sep 27 2011 Karel Klíč - 1:23.3-9 +- Added dependency on xorg-x11-fonts-misc (rhbz#732422) + +* Mon Aug 8 2011 Karel Klíč - 1:23.3-8 +- Updated release archive to 23.3a, which includes grammar files that are + necessary to modify Semantic parsers + +* Thu Jun 30 2011 Ville Skyttä - 1:23.3-7 +- Use custom-set-variables for customizable variables in .emacs (#716440). +- Move frame-title-format default from .emacs to default.el (#716443). + +* Thu May 26 2011 Karel Klíč - 1:23.3-6 +- Enumerate binaries in emacs-common to avoid packaging single binary + multiple times by accident + +* Mon May 23 2011 Karel Klíč - 1:23.3-5 +- Removed %%defattr from %%files sections, as RPM no longer needs it +- Removed %%dir %%{_libexecdir}/emacs and similar from emacs and + emacs-nox packages, as the directories are used and present only in + emacs-common (rhbz#704067) + +* Tue Mar 22 2011 Karel Klic - 1:23.3-4 +- Rebuild to fix an RPM issue (rhbz689182) + +* Tue Mar 15 2011 Ville Skyttä - 1:23.3-3 +- Use UTC timestamps in rpm-spec-mode changelog entries by default (rhbz#672350) +- Consider *.elc in addition to *.el when loading files from site-start.d (rhbz#672324) + +* Tue Mar 15 2011 Karel Klic - 1:23.3-2 +- Another attempt to fix the handling of alternatives (rhbz#684447) + The current process loses alternatives preference on every upgrade, + but there seems to be no elegant way how to prevent this while + having versioned binaries (/bin/emacs-%%{version}) at the same time. +- Removed 'rm -rf %%{buildroot}' from %%install section + +* Thu Mar 10 2011 Karel Klic - 1:23.3-1 +- New upstream release +- Depend on util-linux directly, as the package no longer provides setarch + +* Tue Feb 08 2011 Fedora Release Engineering - 1:23.2-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Mon Jan 10 2011 Karel Klic - 1:23.2-17 +- Added filesystem subpackage (rhbz#661866) +- Added emacsclient desktop file (rhbz#665362) + +* Fri Jan 7 2011 Karel Klic - 1:23.2-16 +- Removed dependency on both hunspell and aspell. Emacs does not + _require_ spell checker, e.g. if user wants to uninstall one, there + is no reason why Emacs should also be uninstalled. Emacs can run one + like it can run GDB, pychecker, (La)TeX, make, gcc, and all VCSs out + there. +- Removed conflict with old gettext package +- Cleaned spec file header +- Removed gcc-4.5.0 specific CFLAGS + +* Fri Jan 7 2011 Karel Klic - 1:23.2-15 +- The emacs-terminal package now requires emacs package + +* Thu Jan 6 2011 Karel Klic - 1:23.2-14 +- Patch emacs-terminal to use /usr/bin/emacs (rhbz#635213) + +* Mon Sep 6 2010 Karel Klic - 1:23.2-13 +- Removed transient-mark-mode suggestion from dotemacs.el, as this + minor mode is enabled by default in recent versions of Emacs + +* Thu Aug 19 2010 Karel Klic - 1:23.2-12 +- Mention xdg-open in browse-url-default-browser docstring (rhbz#624359) + Updates emacs-23.1-xdg.patch + +* Tue Aug 17 2010 Karel Klic - 1:23.2-11 +- Own /usr/bin/emacs (rhbz#614935) +- Updated the handling of alternatives to match + https://fedoraproject.org/wiki/Packaging:Alternatives + +* Mon Aug 16 2010 Karel Klic - 1:23.2-10 +- Removed the png extension from the Icon entry in emacs.desktop (rhbz#507231) + +* Wed Aug 4 2010 Karel Klic - 1:23.2-9 +- Added Fedora conditionals + +* Mon Aug 2 2010 Karel Klic - 1:23.2-8 +- Moved the terminal desktop menu item to a separate package (rhbz#617355) + +* Thu Jul 8 2010 Karel Klic - 1:23.2-7 +- Added workaround for an GCC 4.5.0 bug + +* Thu Jul 8 2010 Karel Klic - 1:23.2-6 +- Removed Obsoletes: emacs-nxml-mode, it was obsoleted in F-11 +- Added COPYING to emacs-el, moved COPYING in emacs-common to %%doc + +* Thu Jun 3 2010 Karel Klic - 1:23.2-5 +- Fixed handling of dual spacing fonts rhbz#599437 + +* Thu May 27 2010 Karel Klíč - 1:23.2-4 +- Add patch to fix rhbz#595546 hideshow library matches wrong parenthesis + under certain circumstances +- Removed %%clean section + +* Wed May 19 2010 Naveen Kumar - 1:23.2-3 +- Added a desktop file for adding terminal mode to menu (RHBZ #551949) + +* Tue May 11 2010 Karel Klic - 1:23.2-2 +- Added a patch fixing m17n and libotf version checking (m17ncheck) + +* Mon May 10 2010 Karel Klic - 1:23.2-1 +- Updated the prerelase to final version + +* Sun Apr 25 2010 Jonathan G. Underwood - 1:23.1.96-3 +- Add BuildRequires for GConf2-devel to build in Gconf2 support (RHBZ #585447) + +* Sun Apr 25 2010 Jonathan G. Underwood - 1:23.1.96-2 +- Remove po-mode files since they are now packaged separately as a sub-package + of gettext (RHBZ #579452) + +* Tue Apr 20 2010 Karel Klic - 1:23.1.96-1 +- Updated to the newest prerelease +- Remove -movemail patch as it has been merged by upstream + +* Thu Apr 1 2010 Jonathan G. Underwood - 1:23.1.94-6 +- Add patch to fix RHBZ #578272 - security vulnerability with movemail + (CVE-2010-0825) + +* Tue Mar 30 2010 Jonathan G. Underwood - 1:23.1.94-5 +- Fix typo in spec file changelog +- Use standard %%patch macro to apply all patches to silent rpmlint warnings + +* Tue Mar 30 2010 Jonathan G. Underwood - 1:23.1.94-4 +- Remove unnecessary buildroot tag +- Remove explicit dependency on librsvg2 (but keep BuildRequires for + librsvg2-devel) +- Add properly versioned Provides for emacs(bin) +- Remove long unneeded Obsoletes for emacs-leim +- Fix summary for emacs-el + +* Tue Mar 30 2010 Jonathan G. Underwood - 1:23.1.94-3 +- Use out of tree builds so that we can build multibple versions in the + %%build section + +* Tue Mar 23 2010 Jonathan G. Underwood - 1:23.1.94-2 +- Remove checks for old version of Emacs in postrtrans + +* Mon Mar 22 2010 Karel Klic - 1:23.1.94-1 +- Update to 23.2 pretest version +- Removed patches applied by upstream + +* Fri Mar 19 2010 Jonathan G. Underwood - 1:23.1-26 +- Fix broken byte compilation of emacs2.py and emacs3.py with the relevant + python binaries - requires turning off brp-python-bytecompile script + +* Mon Mar 15 2010 Jonathan G. Underwood - 1:23.1-25 +- Add --eval '(progn (setq load-path (cons "." load-path)))' to byte + compilation macro for packaging add-ons + +* Tue Feb 9 2010 Karel Klic 1:23.1-24 +- Added a comment about alternatives(8) in %%posttrans to the spec file + +* Thu Jan 14 2010 Jonathan G. Underwood 1:23.1-23 +- Add patch to fix rhbz#547566 (from Juanma Barranquero) + +* Tue Jan 12 2010 Karel Klic 1:23.1-22 +- Removed invalid URL for rpm-spec-mode.el. This mode is no longer + found on Internet in this version. + +* Thu Jan 7 2010 Karel Klic 1:23.1-21 +- Removed PreReq from spec file + +* Thu Jan 7 2010 Karel Klic 1:23.1-20 +- Simpler fix for rhbz#517272 + +* Thu Jan 7 2010 Jens Petersen - 1:23.1-19 +- m17n-lib-flt requires m17n-db-flt so no longer need to require explicitly + m17n-db-datafiles for complex text rendering (#542657) + +* Mon Jan 4 2010 Karel Klic 1:23.1-18 +- Fixed rhbz#517272 - emacs-23.1 update shows fonts in double the normal size + +* Tue Dec 8 2009 Karel Klic 1:23.1-17 +- Fixed rhbz#545398 - ETags messes up filenames + +* Thu Dec 03 2009 Daniel Novotny 1:23.1-16 +- fix #542657 - emacs does not display indic text + +* Wed Dec 02 2009 Daniel Novotny 1:23.1-15 +- fix #543046 - Using scroll bar in emacs highlights/selects text + +* Mon Nov 30 2009 Daniel Novotny 1:23.1-14 +- fixed FTBFS in F12 and higher (#540921) + +* Mon Oct 19 2009 Daniel Novotny 1:23.1-13 +- fixed update-directory-autoloads (#474958) + +* Wed Oct 14 2009 Daniel Novotny 1:23.1-12 +- do not compress the files which implement compression itself (#484830) + +* Wed Oct 14 2009 Jonathan G. Underwood - 1:23.1-11 +- Update macros.xemacs to treat epoch correctly and be consistent with xemacs package +- Use site_start_d macro consistently + +* Tue Sep 29 2009 Daniel Novotny 1:23.1-10 +- emacs contains nxml-mode (#516391) + +* Thu Sep 24 2009 Daniel Novotny 1:23.1-9 +- use xdg-open(1) for opening URLs (#316131) + +* Wed Sep 23 2009 Daniel Novotny 1:23.1-8 +- updated rpm-spec-mode.el to latest upstream version (#524851) + +* Tue Sep 22 2009 Daniel Novotny 1:23.1-7 +- updated %%info_files (#510750) + +* Mon Aug 31 2009 Daniel Novotny 1:23.1-6 +- fixed buffer menu (#515722) + +* Wed Aug 26 2009 Daniel Novotny 1:23.1-5 +- correct BuildRequires for libotf (#519151) + +* Tue Aug 25 2009 Daniel Novotny 1:23.1-4 +- alsa-lib-devel added to BuildRequires (#518659) + +* Thu Aug 13 2009 Daniel Novotny 1:23.1-3 +- fixed Name and GenericName in desktop file (#514599) + +* Mon Aug 10 2009 Ville Skyttä - 1:23.1-2 +- Use bzipped upstream tarball. + +* Fri Jul 31 2009 Daniel Novotny 1:23.1-1 +- new upstream version 23.1 + +* Fri Jul 24 2009 Fedora Release Engineering - 1:23.0.93-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Fri Jun 26 2009 Daniel Novotny 1:23.0.93-6 +- removed dependency to bitmap fonts: emacs version 23 does not need them + +* Thu Jun 25 2009 Daniel Novotny 1:23.0.93-5 +- revoked default.el change (#508033) +- added build dependency: librsvg2-devel (#507852) +- added dependency: aspell (#443549) + +* Wed Jun 24 2009 Daniel Novotny 1:23.0.93-4 +- added xorg-x11-fonts-misc to dependencies (#469220) + +* Fri Jun 19 2009 Jens Petersen - 1:23.0.93-3 +- drop igrep since lgrep and rgrep are maintained in emacs now +- specify the list of *-init.el files to be install explicitly + +* Thu Jun 11 2009 Daniel Novotny 1:23.0.93-2 +- fix bz#505083 - rpm-add-change-log-entry date format rejected by rpmbuild + +* Mon May 18 2009 Daniel Novotny 1:23.0.93-1 +- new upstream version + +* Fri Apr 10 2009 Daniel Novotny 1:22.3-11 +- fix bz#443549 - spell-buffer, flyspell-mode do not work + +* Fri Mar 27 2009 Daniel Novotny 1:22.3-10 +- fix segfaults when emacsclient connects to a tcp emacs server (#489066) + +* Thu Mar 12 2009 Daniel Novotny 1:22.3-9 +- implement UTC change log option in rpm-spec-mode.el (#489829) + +* Wed Mar 4 2009 Michel Salim - 1:22.3-8 +- Use desktop-file-utils to handle desktop file +- Update icon cache if GTK2 is installed + +* Wed Feb 25 2009 Daniel Novotny 1:22.3-7 +- site-lisp/default.el is now config(noreplace) + +* Tue Feb 24 2009 Fedora Release Engineering - 1:22.3-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Mon Feb 16 2009 Daniel Novotny 1:22.3-5 +- fix #474578 - /usr/bin/emacs link not updated on upgrade + (added a script to scan the alternatives and update them) + +* Mon Feb 09 2009 Daniel Novotny 1:22.3-4 +- fix bz#484309 (alternatives error message) + +* Sun Jan 18 2009 Jonathan G. Underwood - 1:22.3-3 +- Add /etc/rpm/macros.emacs file + +* Mon Dec 01 2008 Ignacio Vazquez-Abrams - 1:22.3-2 +- Rebuild for Python 2.6 + +* Sat Nov 8 2008 Jens Petersen - 1:22.3-1 +- update to 22.3 (#461448) +- emacs-22.1.50-sparc64.patch and emacs-22.1.50-regex.patch no longer needed +- update rpm-spec-mode.el to look for fields at bol (#466407) + +* Thu May 01 2008 Tom "spot" Callaway +- fix requires to include epoch + +* Thu May 01 2008 Dennis Gilmore 1:22.2-4 +- add patch from bz#435767 + +* Thu May 01 2008 Dennis Gilmore 1:22.2-3 +- add epoch +- put epoch in .pc file + +* Thu Apr 24 2008 Dennis Gilmore 22.2-2 +- add patch fixing libdir on sparc64 + +* Tue Apr 22 2008 Chip Coldwell 22.2-1 +- revert back to emacs-22.2 (bz443639) +- update to php-mode-1.4.0 +- update to rpm-spec-mode.el v0.12.1x (bz432209) +- patch rpm-spec-mode to use compilation mode (bz227418) +- fix the Release tag (bz440624) +- drop superfluous configure options +- move the new icons into the right destination directory +- the heuristics for detecting address space randomization in the emacs dumper + seem insufficient, so bring back setarch -R + +* Fri Apr 18 2008 Chip Coldwell 23.0.60-2 +- New upstream tarball (fixes bz435767) +- configure tweaks +- drop files.el patch (now upstream) +- drop parallel build patch (now upstream) + +* Mon Feb 18 2008 Fedora Release Engineering - 22.1.50-4 +- Autorebuild for GCC 4.3 + +* Wed Jan 2 2008 Chip Coldwell 22.1.50-3.1 +- parallel build patch from Dan Nicolaescu + +* Fri Dec 7 2007 Chip Coldwell 22.1.50-3 +- scriptlets shouldn't fail needlessly. +- new upstream tarball + +* Thu Dec 6 2007 Chip Coldwell 22.1.50-2 +- drop -DSYSTEM_PURESIZE_EXTRA=16777216 (bz409581) + +* Mon Nov 19 2007 Chip Coldwell 22.1.50-1 +- pulled sources from GNU CVS + +* Mon Nov 19 2007 Chip Coldwell 22.1-9 +- fixup alternatives mess (bz239745, bz246540) + +* Tue Nov 6 2007 Chip Coldwell 22.1-8 +- fix insufficient safe-mode checks (Resolves: bz367601) + +* Thu Nov 1 2007 Chip Coldwell 22.1-7 +- Update rpm-spec-mode to the current upstream, drop compat patch (bz306841) + +* Wed Oct 24 2007 Jeremy Katz - 22.1-6 +- Update rpm-spec-mode to the current upstream (#306841) + +* Wed Sep 12 2007 Chip Coldwell - 22.1-5 +- require xorg-x11-fonts-ISO8859-1-100dpi instead of 75dpi (Resolves: bz281861) +- drop broken python mode (Resolves: bz262801) + +* Mon Sep 10 2007 Chip Coldwell - 22.1-4 +- fix pkgconfig path (from pkg-config to pkgconfig (Jonathan Underwood) +- use macro instead of variable style for buildroot. + +* Tue Aug 28 2007 Chip Coldwell - 22.1-3 +- change group from Development to Utility + +* Mon Aug 13 2007 Chip Coldwell - 22.1-2 +- add pkgconfig file for emacs-common and virtual provides (Resolves: bz242176) +- glibc-open-macro.patch to deal with glibc turning "open" into a macro. +- leave emacs info pages in default section (Resolves: bz199008) + +* Wed Jun 6 2007 Chip Coldwell - 22.1-1 +- move alternatives install to posttrans scriptlet (Resolves: bz239745) +- new release tarball from FSF (Resolves: bz245303) +- new php-mode 1.2.0 + +* Wed May 23 2007 Chip Coldwell - 22.0.990-2 +- revert all spec file changes since 22.0.95-1 (Resolves: bz239745) +- new pretest tarball from FSF (Resolves: bz238234) +- restore php-mode (Resolves: bz235941) + +* Mon May 21 2007 Chip Coldwell - 22.0.990-1 +- new pretest tarball from FSF +- removed Ulrich Drepper's patch to prevent mmapped pages during dumping + removed BuildRequires: glibc >= 2.5.90-22 + (bug traced to glibc Resolves: bz239344) +- fix alternatives removal scriptlet (Resolves: bz239745) + +* Thu May 17 2007 Chip Coldwell - 22.0.99-4 +- format of freed blocks changed between glibc 2.5.90-21 and 2.5.90-22 +- BuildRequires: glibc >= 2.5.90-22 (Ulrich Drepper) + +* Sun May 13 2007 Chip Coldwell - 22.0.99-2 +- prevent mmapped pages during dumping (Ulrich Drepper Resolves: bz239344) + +* Tue Apr 24 2007 Chip Coldwell - 22.0.99-1 +- new (last?) pretest tarball from FSF +- update to php-mode-1.2.0 (Ville Skyttä Resolves: bz235941) +- use /etc/alternatives instead of wrapper script + +* Tue Mar 6 2007 Chip Coldwell - 22.0.95-1 +- new pretest tarball from FSF + +* Mon Feb 26 2007 Chip Coldwell - 22.0.94-1 +- new pretest tarball obsoletes loaddefs.el dependencies patch + +* Fri Feb 23 2007 Chip Coldwell - 22.0.93-7 +- fix po-mode-init.el (Kjartan Maraas #228143) + +* Tue Feb 13 2007 Chip Coldwell - 22.0.93-6 +- remove --without-xim configure flag to fix dead keys (Alexandre Oliva #224626) + +* Fri Jan 26 2007 Chip Coldwell - 22.0.93-5 +- remove Tetris to avoid trademark problems (Ville Skyttä #224627) + +* Thu Jan 25 2007 Chip Coldwell - 22.0.93-4 +- fixup loaddefs.el dependencies (Dan Nicolaescu #176171) +- add BuildRequires: automake (changes to Makefile.in) + +* Wed Jan 24 2007 Chip Coldwell - 22.0.93-3 +- po-mode.el was being left out + +* Tue Jan 23 2007 Chip Coldwell - 22.0.93-1 +- new pretest version +- removed setarch since new dumper copes with execshield +- clean up site initialization files (varions #176171) + +* Tue Jan 2 2007 Chip Coldwell - 22.0.92-1 +- new pretest version +- removed almost all emacs 21 patches from emacs 22 +- clean up spec file, +- many new BuildRequires (David Woodhouse #221250) + +* Tue Nov 14 2006 Chip Coldwell - 22.0.90-1 +- first pretest rpm build + +* Mon Nov 6 2006 Chip Coldwell - 21.4-19 +- BuildRequires: sendmail (Wolfgang Rupprecht #213813) + +* Thu Aug 3 2006 Chip Coldwell - 21.4-18 +- non-CJK text broken by default for Western locale (James Ralston #144707) + +* Thu Aug 3 2006 Chip Coldwell - 21.4-17 +- use UTF-8 keyboard input encoding on terminals that support it (Axel Thimm #185399) + +* Thu Aug 3 2006 Chip Coldwell - 21.4-16 +- fix German spell checking for UTF-8 encoded buffers (Daniel Hammer #197737) + +* Wed Jul 26 2006 Chip Coldwell - 21.4-15 +- fix src/unexelf.c to build on PowerPC64 (backport from emacs-22, #183304) + +* Wed Jul 12 2006 Jesse Keating - 21.4-14.1.1 +- rebuild + +* Tue Apr 18 2006 Chip Coldwell - 21.4-14.1 +- don't clobber site-lisp/default.el (Ritesh Khadgaray, 180153) + +* Tue Mar 7 2006 Jens Petersen - 21.4-14 +- bring back setarch for i386 with -R option in spec file and drop + emacs-21-personality-linux32-101818.patch since it no longer seems + sufficient with recent kernels (Sam Peterson, #174736) +- buildrequire giflib-devel instead of libungif-devel + +* Thu Mar 2 2006 Jens Petersen +- avoid backup for fix-x-vs-no-x-diffs.dpatch (Ian Collier, #183503) +- remove the old ccmode info manual (#182084) + +* Mon Feb 27 2006 Jens Petersen - 21.4-13 +- buildrequire libXaw-devel for menus and scrollbar +- pass -R to setarch to disable address randomization during dumping + (Sam Peterson, #174736) +- install cc-mode.info correctly (Sam Peterson, #182084) +- fix sort-columns not to use deprecated non-posix sort key syntax + with sort-columns-posix-key-182282.patch (Richard Ryniker, #182282) +- use system-name function not variable when setting frame-title-format in + /etc/skel/.emacs for XEmacs users hitting .emacs + +* Fri Feb 10 2006 Jesse Keating - 21.4-12.2 +- bump again for double-long bug on ppc(64) + +* Tue Feb 07 2006 Jesse Keating - 21.4-12.1 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Fri Feb 3 2006 Jens Petersen - 21.4-12 +- add mule-cmd.el-X11-locale.alias-173781.patch to correct location of X11 + locale.alias file (Paul Dickson, #173781) +- fix autoload of php-mode in php-mode-init.el (Christopher Beland, #179484) + +* Wed Dec 14 2005 Jens Petersen - 21.4-11 +- avoid building with -fstack-protector on i386 to prevent crashing + (Jonathan Kamens, #174730) +- require xorg-x11-fonts-ISO8859-1-75dpi instead of xorg-x11-fonts-75dpi + for modular X (#174614) + +* Fri Dec 09 2005 Jesse Keating +- rebuilt + +* Fri Nov 25 2005 Jens Petersen - 21.4-10 +- fix missing parenthesis in lang-coding-systems-init.el + +* Tue Nov 22 2005 Jens Petersen - 21.4-9 +- fix keyboard-coding-system on console for utf-8 (Dawid Gajownik, #173855) +- update etags to latest cvs (Hideki Iwamoto, #173023) + - replace etags-14.21-17.11-diff.patch with etags-update-to-cvs.patch +- update smtpmail.el to latest cvs version for better authentication support + with smtpmail-cvs-update.patch (Alberto Brizio, #167804) + +* Mon Nov 14 2005 Jeremy Katz - 21.4-8 +- update dep for new xorg fonts packages + +* Wed Aug 24 2005 Jens Petersen +- fix name of aspell-es dictionary (#147964) + - update emacs-21.3-lisp-textmodes-ispell-languages.patch + +* Thu Jul 14 2005 Jens Petersen - 21.4-7 +- update rpm-spec-mode.el to cvs revision 1.17 (Ville Skyttä) + - fixes expansion of %%{?dist} +- replace emacs-21.4-setarch_for_loadup-101818.patch with backport + emacs-21-personality-linux32-101818.patch from cvs (Jan Djärv) + which also turns off address randomization during dumping (Masatake Yamato) + - no longer need to pass SETARCH to make on i386 (#160814) +- move ownership of %%{_datadir}/emacs/ and %%{_datadir}/emacs/%%{version}/ + from emacs to emacs-el and emacs-leim subpackages +- don't build tramp html and dvi documentation +- drop src/config.in part of bzero-and-have-stdlib.dpatch to avoid + compiler warnings + +* Thu Jun 23 2005 Jens Petersen - 21.4-6 +- merge in changes from emacs22.spec conditionally + - define emacs21 rpm macro switch to control major version and use it +- update tramp to 2.0.49 + +* Fri Jun 17 2005 Jens Petersen +- set arg0 to emacs in wrapper script (Peter Oliver, 149512#3) + +* Mon May 30 2005 Jens Petersen +- move setting of require-final-newline from default.el to a comment in default + .emacs (Ralph Loader, 119141) + +* Wed May 18 2005 Jens Petersen - 21.4-5 +- update cc-mode to 5.30.9 stable release to address font-lock problems + (126165,148977,150197,155292,158044) + +* Mon May 16 2005 Jens Petersen - 21.4-4 +- don't accidently exclude emacsclient from common package + (Jonathan Kamens, #157808) +- traditional Chinese desktop file translation (Wei-Lun Chao, #157287) + +* Wed Apr 20 2005 Jens Petersen - 21.4-3 +- add igrep.el and init file + +* Mon Apr 11 2005 Jens Petersen - 21.4-2 +- update etags to 17.11 (idht4n@hotmail.com, 151390) + - add etags-14.21-17.11-diff.patch +- replace i386 setarch redefinitions of __make and makeinstall with + emacs-21.4-setarch_for_loadup-101818.patch and setting SETARCH on i386 + (Jason Vas Dias, 101818) + +* Sun Apr 10 2005 Jens Petersen - 21.4-1 +- update to 21.4 movemail vulnerability release + - no longer need movemail-CAN-2005-0100.patch +- replace %%{_bindir}/emacs alternatives with a wrapper script (Warren Togami) + to prevent it from disappearing when upgrading (Michal Jaegermann, 154326) + - suffix the X emacs binaries with -x and the no X binaries with -nox + - the wrapper script %%{_bindir}/emacs-%%version runs emacs-x if installed or + otherwise emacs-nox. %%{_bindir}/emacs is a symlink to the wrapper +- make emacs and emacs-nox own the subdirs in %%{_libexecdir} +- add a bunch of fixes from debian's emacs21_21.4a-1 patch: + battery-acpi-support.dpatch, bzero-and-have-stdlib.dpatch, + coding-region-leak.dpatch, detect-coding-iso2022.dpatch, + fix-batch-mode-signal-handling.dpatch, pcl-cvs-format.dpatch, + python-completion-ignored-extensions.dpatch, + remote-files-permissions.dpatch, save-buffer.dpatch, scroll-margin.dpatch, + xfree86-4.3-modifiers.dpatch + - add fix-x-vs-no-x-diffs.dpatch + - define emacs_libexecdir + - build both emacs and emacs-nox as %%{version}.1 and move common DOC file + to emacs-common + - suffix version in fns-%%{version}.1.el with -x and -nox respectively +- add 100 to elisp patches + +* Wed Apr 6 2005 Jens Petersen - 22.0.50-0.20050406 +- update to snapshot of current cvs + - configure xim support off by default + - bootstrap snapshot + +* Wed Apr 6 2005 Jens Petersen - 21.3-27 +- use alternatives to switch _bindir/emacs between emacs and emacs-nox + (Henning Schmiedehausen, #151067) + - remove emacs and emacs-nox from bindir + - prereq alternatives for emacs and emacs-nox + - add post and postun scripts to handle alternatives +- buildrequire xorg-x11-devel instead of XFree86-devel +- really include and apply emacs-21.3-latex-mode-hook-144083.patch +- make emacs and emacs-nox own _datadir/emacs/version too + +* Wed Mar 9 2005 Jens Petersen - 21.3-26 +- rebuild with gcc 4.0 + - add emacs-21.3-gcc4.patch for emacsclient + +* Mon Feb 28 2005 Jens Petersen - 21.3-25 +- add tramp-2.1.3 to site-lisp (David Woodhouse, 149703) + - move removal of info dir to after its installation + - add tramp-init.el to put tramp into load-path + +* Thu Feb 24 2005 Jens Petersen - 21.3-24 +- mark default.el as a noreplace config file (Pawel Salek, 149310) +- only set keyboard-coding-system in xterms to fix problem with input + Latin characters becoming prefixes and making emacs loop + (Eddahbi Karim, 126007) +- make emacs-el own its lisp directories +- run latex-mode-hook in latex-mode (Martin Biely, 144083) + - add emacs-21.3-latex-mode-hook-144083.patch + +* Fri Feb 18 2005 Jens Petersen - 21.3-23 +- install %%{_bindir}/emacs-nox as a hardlink of the versioned binary +- drop explicit lib requirements +- use sed instead of perl to fix up filelists + +* Mon Feb 14 2005 Jens Petersen - 21.3-22 +- use prereq instead of contexts for common script requirements + (Axel Thimm, 147791) +- move emacs.png from common to main package + +* Fri Feb 4 2005 Jens Petersen - 21.3-21 +- fix CAN-2005-0100 movemail vulnerability with movemail-CAN-2005-0100.patch + (Max Vozeler, 146701) + +* Fri Jan 14 2005 Jens Petersen - 21.3-20 +- workaround xorg-x11 modifier key problem with + emacs-21.3-xterm-modifiers-137868.patch (Thomas Woerner, 137868) + +* Mon Nov 29 2004 Jens Petersen - 21.3-19 +- prefer XIM status under-the-window for now to stop xft httx from dying + (125413): add emacs-xim-status-under-window-125413.patch +- default diff to unified format in .emacs + +* Wed Nov 10 2004 Jens Petersen - 21.3.50-0.20041111 +- initial packaging of cvs emacs + - leim and elisp manual now in main tarball + - no leim subpackage anymore, so make common obsolete it + - no longer need MuleUCS, nor rfc1345.el + - buildrequire and use autoconf rather autoconf213 + - no longer need emacs-21.2-x86_64.patch, + editfns.c-Fformat-multibyte-davej.patch + - bring back game for now + - TODO: some patches still need updating + - fns.el no longer installed + - remove /var/games for now + - update filelist generation to single sweep + - update info_files list + +* Thu Nov 4 2004 Jens Petersen - 21.3-18 +- show emacs again in the desktop menu (132567) +- require fonts-xorg-75dpi to prevent empty boxes at startup due to missing + fonts (Johannes Kaiser, 137060) + +* Mon Oct 18 2004 Jens Petersen - 21.3-17 +- fix etag alternatives removal when uninstalling (Karsten Hopp, 136137) + +* Fri Oct 15 2004 Jens Petersen - 21.3-16 +- do not setup frame-title-format in default.el, since it will override + setting by users (Henrik Bakken, 134520) +- emacs-el no longer requires emacs for the sake of -nox users + (Lars Hupfeldt Nielsen, 134479) +- condition calling of global-font-lock-mode in default .emacs + in case xemacs should happen to load it + +* Wed Sep 29 2004 Jens Petersen - 21.3-15 +- cleanup and update .desktop file +- make emacs not appear in the desktop menu (Seth Nickell,132567) +- move the desktop file from -common to main package +- go back to using just gctags for ctags +- etags is now handled by alternatives (92256) +- improve the default frame title by prefixing the buffer name + (Christopher Beland, 128110) +- fix the names of some European aspell languages with + emacs-21.3-lisp-textmodes-ispell-languages.patch (David Jansen, 122618) +- fixing running "libtool gdb program" in gud with + emacs-21.3-gud-libtool-fix.patch (Dave Malcolm, 130955) + +* Tue Jun 15 2004 Elliot Lee +- rebuilt + +* Fri Apr 30 2004 Jens Petersen - 21.3-13 +- unset focus-follows-mouse in default.el to make switching frames work for + click-to-focus (Theodore Belding,114736) + +* Thu Apr 15 2004 Jens Petersen - 21.3-12 +- update php-mode to 1.1.0 +- add emacs-21.3-no-rpath.patch so that /usr/X11R6/lib is not rpath'ed +- require /bin/ln for %%post (Tim Waugh, 119817) +- move prereq for dev and /sbin/install-info to emacs-common +- leim no longer requires emacs +- use source site-lisp dir in %%prep to setup site files +- define and use site_lisp for buildroot in %%install +- default ispell dictionary to "english" for CJK locale +- add comment to top of site-start.el about load order +- turn on auto-compression-mode in default.el (114808) +- set require-final-newline with setq (David Olsson,119141) + and remove redundant next-line-add-newlines setting +- update info_file list (Reuben Thomas,114729) + +* Tue Mar 16 2004 Mike A. Harris 21.3-11 +- Removed bogus Requires: XFree86-libs that was added in 21.3-8, as rpm + find-requires will automatically pick up the dependancies on any runtime + libraries, and such hard coded requires is not X11 implementation + agnostic (#118471) + +* Fri Feb 13 2004 Elliot Lee +- rebuilt + +* Sat Jan 24 2004 Jens Petersen - 21.3-9 +- bring back emacs-nox subpackage (emacs built without X support) (#113001) + [suggested by Frank Kruchio] +- base emacs package now only contains emacs binary built with X support + and no longer obsoletes emacs-nox +- all the common files required by emacs and emacs-nox are now in emacs-common +- update php-mode.el to 1.0.5 +- add missing rfc1345.el leim input method +- update po-compat.el to version in gettext-0.13.1 +- update base package summary +- add url for python-mode.el and php-mode.el +- gctags is now a symlink to ctags.emacs + +* Wed Jan 14 2004 Jens Petersen - 21.3-8 +- comment out setting transient-mark-mode in skel .emacs (#102441,#90193) + [reported by mal@gromco.com, Jonathan Kamens] +- improve lang-coding-systems-init.el to set-language-environment for CJK + utf-8 locale too and use utf-8 for default-coding-systems and + terminal-coding-system (#111172) [Yoshinori Kuniga] +- update rpm-spec-mode.el to newer one in xemacs package cvs (#105888) [Dams] +- rename etags to etags.emacs and make etags a symlink to it at install time + if it doesn't exist (#92256) [marc_soft@merlins.org] +- apply editfns.c-Fformat-multibyte-davej.patch to fix multibyte code typo + in Fformat [patch from Dave Jones] +- add runtime requirements for XFree86-libs, image libraries, ncurses and zlib +- improve -el and -leim package summaries +- no longer configure build with redundant --with-gcc + +* Tue Nov 25 2003 Jens Petersen +- buildrequire autoconf213 (#110741) [reported by mvd@mylinux.com.ua] + +* Mon Oct 27 2003 Jens Petersen - 21.3-7 +- use "setarch i386" to build on ix86 (#101818) [reported by Michael Redinger] +- use __make to %%build and %%install +- set keyboard coding-system for utf-8 in lang-coding-systems-init.el (#106929) + [reported with fix by Axel Thimm] +- add source url for MuleUCS +- update base package description (#103551) [reported by Tim Landscheidt] + +* Wed Jun 04 2003 Elliot Lee +- rebuilt + +* Wed May 7 2003 Jens Petersen - 21.3-5 +- move transient-mark-mode and global-font-lock-mode setting from default.el + back to dotemacs, so as not to surprise old users (#90193) + [reported by jik@kamens.brookline.ma.us] +- change require-final-newline to query (default.el) +- don't make a backup when applying browse-url-htmlview-84262.patch (#90226) + [reported by mitr@volny.cz] + +* Fri May 2 2003 Elliot Lee +- Add emacs-21.3-ppc64.patch + +* Fri Apr 25 2003 Jens Petersen - 21.3-3 +- use Mule-UCS utf-8 coding-system for CJK subprocess IO +- no need to set fontset anymore in CJK locale + +* Wed Apr 16 2003 Jens Petersen - 21.3-2 +- add Mule-UCS for CJK utf-8 support (suggested by Akira Tagoh) + and use it by default in CJK UTF-8 locale +- move emacs-asian startup files into new lang-coding-systems-init.el +- utf-8 setup in site-start.el is no longer needed in Emacs 21.3 +- generate filelist for site-lisp automatically like base lisp and leim +- don't setup aspell in site-start.el +- rename dotemacs to dotemacs.el and move former contents to new default.el + +* Mon Apr 7 2003 Jens Petersen - 21.3-1 +- update to 21.3 +- no longer set compound-text-with-extensions in dotemacs, since it is now + the default +- emacs-21.2-pop.patch is no longer needed +- update php-mode to 1.0.4 + +* Thu Feb 20 2003 Jens Petersen - 21.2-33 +- default browse-url to use htmlview (#84262) +- remove info dir file rather than excluding it + +* Sat Feb 8 2003 Jens Petersen - 21.2-32 +- set X copy'n'paste encoding to extended compound-text (#74100) + by default in .emacs file [suggested by olonho@hotmail.com] +- .emacs file cleanup (xemacs now has a separate init file) + +* Fri Feb 7 2003 Jens Petersen - 21.2-31 +- block input in allocate_vectorlike to prevent malloc hangs (#83600) + [thanks to Jim Blandy] +- set startup wmclass notify in desktop file + +* Wed Jan 22 2003 Tim Powers +- rebuilt + +* Wed Jan 15 2003 Jens Petersen 21.2-29 +- update to newer po-mode.el and po-compat.el from gettext-0.11.4 +- patch po-mode's po-replace-revision-date for when + po-auto-replace-revision-date is nil (#71264) +- update po-mode-init.el +- examine LC_ALL before LC_CTYPE in site-start.el for utf-8 (#79535) +- don't install etc/DOC files explicitly by hand +- make sure all lisp .elc files are up to date +- pass _smp_mflags to make +- remove games that we shouldn't ship + +* Mon Jan 13 2003 Karsten Hopp 21.2-28 +- s390x lib64 fix + +* Fri Jan 3 2003 Jens Petersen 21.2-27 +- look at LANG after LC_CTYPE when checking for UTF-8 locale encoding + in site-start.el (#79535) +- don't set desktop file config(noreplace) + +* Fri Dec 20 2002 Jens Petersen 21.2-26 +- unset the sticky bit of emacs in bindir (#80049) + +* Wed Dec 18 2002 Jens Petersen 21.2-25 +- no need to patch config.{sub,guess} + +* Tue Dec 3 2002 Tim Waugh +- Fix python-mode-init.el (bug #78910). + +* Sun Dec 1 2002 Jens Petersen 21.2-24 +- rpm-spec-mode update fixes + - patch in XEmacs compat functions rather than defining them with apel + macros in init file (#78764) + - autoload "rpm-spec-mode" not "rpm-spec-mode.el" in same file +- let emacs base also own leim dir to avoid startup warning about missing dir + when -el and -leim aren't installed (#78764) + +* Thu Nov 28 2002 Jens Petersen +- use LC_CTYPE rather than LANG to determine default encoding (#78678) + [reported by starback@stp.ling.uu.se] + +* Wed Nov 27 2002 Jens Petersen 21.2-23 +- set transient-mark-mode in dotemacs for Emacs not XEmacs (#75440) +- update rpm-spec-mode.el to 0.12 + - define needed XEmacs compat functions in new rpm-spec-mode-init.el +- tidy site-start.el + - move python-mode setup to python-mode +- don't build with sbin in path +- use _libexecdir, _bindir and _sysconfdir +- don't gzip info files explicitly +- use tar's C and j options +- generate lisp file-lists in single find sweeps over lisp and leim dirs + - use -fprint and -fprintf + - correct more dir ownerships + +* Sun Nov 24 2002 Florian La Roche 21.2-22 +- add correct alloca defines for s390 + +* Wed Nov 6 2002 Jens Petersen 21.2-21 +- uses patches for x86_64 and s390 support and config.{guess,sub} updating + +* Tue Nov 5 2002 Jens Petersen 21.2-20 +- add support for x86_64 and merge in s390 support from cvs +- add alloca defines to amdx86-64.h (from SuSE) + +* Wed Oct 30 2002 Jens Petersen 21.2-19 +- own our libexec dir (#73984) +- only set transient-mark-mode in dotemacs for Emacs (#75440) +- update to latest config.{guess,sub} +- use _datadir macro + +* Wed Aug 28 2002 Trond Eivind Glomsrød 21.2-18 +- Desktop file fix - add Application to make it show up +- DNS lookup fix for pop (#64802) + +* Tue Aug 27 2002 Trond Eivind Glomsrød 21.2-17 +- Fix gdb arrow when used in non-windowed mode (#56890) + +* Fri Aug 9 2002 Trond Eivind Glomsrød 21.2-16 +- Handle UTF-8 input (#70855). + +* Tue Aug 6 2002 Trond Eivind Glomsrød 21.2-15 +- Don't use canna by default (#70870) + +* Thu Aug 1 2002 Trond Eivind Glomsrød 21.2-14 +- Fixes to desktop file (add encoding, add missing a ";") +- Update s390 patch + +* Wed Jul 24 2002 Trond Eivind Glomsrød 21.2-13 +- rpm -> rpmbuild for rpmspec mode (#68185) + +* Mon Jul 22 2002 Trond Eivind Glomsrød 21.2-12 +- desktop file changes (#69385) + +* Mon Jul 8 2002 Trond Eivind Glomsrød 21.2-11 +- Fix php-mode to not initialize on e.g. foophp.c (#67592) + +* Thu Jun 27 2002 Trond Eivind Glomsrød 21.2-10 +- Downgrade po-mode + +* Fri Jun 21 2002 Tim Powers +- automated rebuild + +* Mon Jun 17 2002 Trond Eivind Glomsrød 21.2-8 +- #66808 + +* Wed May 29 2002 Trond Eivind Glomsrød 21.2-7 +- Rebuild + +* Mon May 20 2002 Trond Eivind Glomsrød 21.2-6 +- Prereq dev + +* Thu May 16 2002 Trond Eivind Glomsrød 21.2-5 +- Update the elisp manual and po-mode + +* Tue May 7 2002 Trond Eivind Glomsrød 21.2-4 +- php-mode 1.0.2 + +* Thu Apr 25 2002 Trond Eivind Glomsrød 21.2-3 +- Update po-mode to the one from gettext 0.11.1 + +* Mon Apr 8 2002 Trond Eivind Glomsrød 21.2-2 +- Tweak mouse init process (#59757) + +* Mon Mar 18 2002 Trond Eivind Glomsrød 21.2-1 +- 21.2 + +* Fri Mar 8 2002 Trond Eivind Glomsrød 21.1.95-1 +- 21.1.95 + +* Fri Feb 8 2002 Trond Eivind Glomsrød 21.1.90-2 +- Upgrade po-mode to the version bundled with gettext 0.11 +- Upgrade rpm-spec-mode to 0.11h + +* Thu Jan 31 2002 Trond Eivind Glomsrød 21.1.90-1 +- 21.1.90 + +* Fri Jan 18 2002 Trond Eivind Glomsrød 21.1.80-2 +- Add ebrowse +- Set transient-mode to t in /etc/skel/.emacs + +* Mon Jan 14 2002 Trond Eivind Glomsrød 21.1.80-1 +- 21.1.80 + +* Wed Jan 09 2002 Tim Powers +- automated rebuild + +* Thu Dec 6 2001 Trond Eivind Glomsrød 21.1-3 +- Increase recursive-load-depth-limit from 10 to 50 + +* Wed Dec 5 2001 Trond Eivind Glomsrød 21.1-2 +- Make it conflict with old versions of gettext + +* Thu Nov 29 2001 Trond Eivind Glomsrød 21.1-1 +- rpm-spec-mode 0.11h, should fix #56748 + +* Tue Nov 6 2001 Trond Eivind Glomsrød 21.1-0.4 +- php mode 1.0.1. Should fix some speedbar problems. + +* Tue Oct 23 2001 Trond Eivind Glomsrød 21.1-0.3 +- Minor cleanups +- add ssl.el + +* Mon Oct 22 2001 Trond Eivind Glomsrød 21.1-0.2 +- Add more files from the libexec directory (#54874, #54875) + +* Sun Oct 21 2001 Trond Eivind Glomsrød 21.1-0.1 +- 21.1 +- Build on IA64 again - the default config now handles it +- Drop all old patches +- Misc cleanups +- Update the elisp manual to 21-2.7 +- Deprecate the emacs-nox and emacs-X11 subpackages. + Simplify build procedure to match. +- Update php-mode to 1.0.0 + +* Mon Oct 15 2001 Trond Eivind Glomsrød 20.7-43 +- Add php-mode 0.9.9 +- Add URL (#54603) +- don't run autoconf/libtoolize during build - they're broken +- don't build on IA64 until they are fixed + +* Sun Sep 16 2001 Trond Eivind Glomsrød 20.7-42 +- Update python-mode to the version in the python 2.2a3 +- Include po-mode in emacs, instead of including in gettext + +* Mon Jul 30 2001 Trond Eivind Glomsrød +- Minor fix to make-mode fontify regexp (#50010) +- Build without emacs being installed (#49085) + +* Tue Jun 19 2001 Trond Eivind Glomsrød +- Much cleaner site-start.d sourcing +- Add more build dependencies +- Add the emacs lisp reference info pages (RFE #44577) +- Don't require tamago - just plug it in for Japanese support + +* Mon Jun 18 2001 Trond Eivind Glomsrød +- Add Xaw3d-devel to buildrequires (#44736) + +* Mon Jun 18 2001 Florian La Roche +- merged s390x patch from + +* Mon Jun 4 2001 Trond Eivind Glomsrød +- New rpm-spec-mode.el, which fixes #43323 + +* Thu Apr 26 2001 Florian La Roche +- fix linker problem on s390 (fix by Than Ngo than@redhat.com) + +* Wed Apr 25 2001 Trond Eivind Glomsrød +- Make sure that mwheel is initialized for XEmacs (#37451) + +* Fri Mar 16 2001 Trond Eivind Glomsrød +- New locale.alias file for emacs-nox + +* Tue Mar 6 2001 Trond Eivind Glomsrød +- update rpm-spec-mode.el to 0.11e - this should fix #30702 + +* Fri Feb 16 2001 Preston Brown +- require tamago, or japanese cannot be input (#27932). + +* Sat Jan 27 2001 Jakub Jelinek +- Preprocess Makefiles as if they were assembly, not C source. + +* Wed Jan 24 2001 Yukihiro Nakai +- Fix the fontset problem when creating a new frame. + +* Thu Jan 18 2001 Trond Eivind Glomsrød +- add Japanese support from Yukihiro Nakai + +* Thu Jan 04 2001 Preston Brown +- do not remove etags, only ctags, per Tom Tromey's suggestion. + +* Wed Dec 27 2000 Tim Powers +- bzipped sources to conserve space + +* Mon Dec 18 2000 Trond Eivind Glomsrød +- add /usr/share/emacs/locale.alias , which had gone AWOL +- update rpm-spec-mode to 0.11a, fresh from the author + (Stig Bjorlykke ). The changes we made + are integrated. + +* Fri Dec 15 2000 Trond Eivind Glomsrød +- prereq fileutils for emacs-nox + +* Mon Dec 11 2000 Trond Eivind Glomsrød +- do locale.alias fix for emacs-nox only, as it somehow + broke the subject line in gnus. Weird. +- update to gnus 5.8.7 + +* Fri Dec 08 2000 Than Ngo +- add support s390 machine + +* Thu Dec 07 2000 Trond Eivind Glomsrød +- add rpm-spec-mode after modifying (use Red Hat groups, + from /usr/share/doc/rpm-version/GROUPS) and fixing + colours(don't specify "yellow" on "bright") Also, + use gpg, not pgp. +- use it (site-start.el) +- add mwheel +- use it, in /etc/skel/.emacs + +* Thu Nov 30 2000 Trond Eivind Glomsrød +- add /usr/share/emacs/site-lisp/site-start.d +- change site-start.el so files in the above directory + are automatically run on startup +- don't set the ispell name in site-start.el, use the + above directory instead + +* Thu Oct 19 2000 Trond Eivind Glomsrød +- fix icon name in the .desktop file +- don't have site-start.el "noreplace" +- load psgml-init (if present) in the default site-start.el + to avoid psgml modifying the file + +* Tue Oct 17 2000 Trond Eivind Glomsrød +- new and better emacs.desktop file + +* Tue Oct 10 2000 Trond Eivind Glomsrød +- remove ctags.1 and etags.1 from the emacs etc directory + (#18011) +- fix the emacs-nox not to use the locale.alias in XFree86 + (#18548)... copy it into /usr/share/emacs and patch + the startup files to use it. Argh. + +* Wed Oct 04 2000 Trond Eivind Glomsrød +- fix initialization of python mode (require it before + customizing it) + +* Fri Sep 22 2000 Bill Nottingham +- don't use bcopy without a prototype + +* Thu Aug 24 2000 Trond Eivind Glomsrød +- define MAIL_USE_LOCKF +- remove setgid on movemail + +* Mon Aug 07 2000 Trond Eivind Glomsrød +- add /usr/share/emacs/site-lisp/subdirs.el (#15639) + +* Tue Jul 25 2000 Trond Eivind Glomsrød +- remove "-b" option from manpage + +* Fri Jul 21 2000 Trond Eivind Glomsrød +- remove Japanese support + +* Mon Jul 17 2000 Matt Wilson +- updated .desktop entry and icon + +* Wed Jul 12 2000 Prospector +- automatic rebuild + +* Fri Jul 07 2000 Trond Eivind Glomsrød +- fix some typos in spec file + +* Sun Jul 02 2000 Trond Eivind Glomsrød +- make /etc/skel/.emacs 0644 + +* Wed Jun 28 2000 Trond Eivind Glomsrød +- include python mode and change in site-start.el related to this +- some changes to the default .emacs + +* Mon Jun 26 2000 Matt Wilson +- don't build with -O2 on alpha until we can track down the compiler + bug that causes crashes in the garbage collector +- removed all the nox Japanese packages + +* Mon Jun 19 2000 Trond Eivind Glomsrød +- include site-start.el as a a config file +- add aspell support via the above + +* Fri Jun 16 2000 Trond Eivind Glomsrød +- (from MSW) different compression on IA64 to avoid hangs +- remove etags/ctags - use a separate package. Disable patch1 + +* Wed Jun 14 2000 Matt Wilson +- edited japanese patch not to patch configure +- fixed a missing escaped \" in a wc string +- merge japanese support to head of development + +* Tue Jun 13 2000 Trond Eivind Glomsrød +- Version 20.7 +- Add requirement for final newline to the default .emacs +- redid the Xaw3d patch +- checked all patches, discarded those we've upstreamed + +* Wed Jun 07 2000 Trond Eivind Glomsrød +- use %%{_mandir} and %%{_infodir} + +* Fri Jun 2 2000 Bill Nottingham +- add yet another ia64 patch + +* Mon May 22 2000 Bill Nottingham +- add another ia64 patch + +* Fri May 19 2000 Trond Eivind Glomsrød +- Disabled the compile patch for 20.6 + +* Thu May 18 2000 Bill Nottingham +- add in ia64 patch + +* Thu May 18 2000 Trond Eivind Glomsrød +- don't apply the unexelf patch - use a new unexelf.c file + from the 21 source tree (this will go into the 20.7 tree) + +* Wed May 17 2000 Trond Eivind Glomsrød +- added patch by jakub to make it work with glibc2.2 + +* Mon May 08 2000 Trond Eivind Glomsrød +- fixed a problem with ange-ftp and kerberized ftp + +* Mon May 08 2000 Bernhard Rosenkraenzer +- rebuild with new Xaw3d + +* Thu Apr 20 2000 Trond Eivind Glomsrød +- let the build system handle gzipping man pages and stripping +- added patch to increase keyboard buffer size + +* Thu Apr 20 2000 Trond Eivind Glomsrød +- gzip man pages + +* Thu Apr 20 2000 Trond Eivind Glomsrød +- added a security patch from RUS-CERT, which fixes + bugs mentioned in "Advisory 200004-01: GNU Emacs 20" + +* Tue Apr 18 2000 Trond Eivind Glomsrød +- patched to detect bash2 scripts. + +* Thu Apr 06 2000 Trond Eivind Glomsrød +- removed configuraton file status from /usr/share/pixmaps/emacs.png + +* Fri Mar 24 2000 Bernhard Rosenkraenzer +- update to 20.6 and make it compile + +* Mon Feb 21 2000 Preston Brown +- add .emacs make the delete key work to delete forward character for X ver. + +* Wed Feb 16 2000 Cristian Gafton +- fix bug #2988 +- recompile patched .el files (suggested by Pavel.Janik@linux.cz) +- prereq /sbin/install-info + +* Mon Feb 07 2000 Preston Brown +- wmconfig gone + +* Thu Feb 03 2000 Cristian Gafton +- fix descriptions and summary +- fix permissions for emacs niaries (what the hell does 1755 means for a + binary?) +- added missing, as per emacs Changelog, NCURSES_OSPEED_T compilation + flag; without it emacs on Linux is making global 'ospeed' short which + is not the same as 'speed_t' expected by libraries. (reported by Michal + Jaegermann ) + +* Mon Jan 10 2000 David S. Miller +- Revert src/unexecelf.c to 20.4 version, fixes SPARC problems. + +* Sun Jan 9 2000 Matt Wilson +- strip emacs binary +- disable optimizations for now, they cause illegal instructions on SPARC. + +* Sun Jan 09 2000 Paul Fisher +- upgrade to 20.5a +- remove python-mode, wheelmouse support, and auctex menu +- import emacs.desktop with icon from GNOME + +* Wed Dec 08 1999 Ngo Than +- added python-mode, wheelmouse support and auctex menu +- added Comment[de] in emacs.desktop + +* Sat Sep 25 1999 Preston Brown +- added desktop entry + +* Thu Sep 23 1999 Preston Brown +- tried to fix triggers, hopefully working now. + +* Wed Sep 01 1999 Preston Brown +- added trigger for making symlink to /usr/bin/emacs in emacs-nox package + +* Thu Jul 22 1999 Paul Fisher +- upgrade to 20.4 +- cleaned up spec + +* Fri Apr 16 1999 Owen Taylor +- replace bad xemacs compiled .elc file for mh-e with one compiled + on emacs + +* Thu Apr 15 1999 Bill Nottingham +- make sure movemail doesn't get %%defattr()'d to root.root + +* Wed Apr 14 1999 Cristian Gafton +- patch to make it work with dxpc + +* Wed Mar 31 1999 Preston Brown +- updated mh-utils emacs lisp file to match our nmh path locations + +* Sun Mar 21 1999 Cristian Gafton +- auto rebuild in the new build environment (release 9) + +* Fri Feb 26 1999 Cristian Gafton +- linker scripts hack to make it build on the alpha + +* Fri Jan 1 1999 Jeff Johnson +- add leim package (thanks to Pavel.Janik@inet.cz). + +* Fri Dec 18 1998 Cristian Gafton +- build against glibc 2.1 + +* Wed Sep 30 1998 Cristian Gafton +- backed up changes to uncompress.el (it seems that the one from 20.2 works + much better) + +* Mon Sep 28 1998 Jeff Johnson +- eliminate /tmp race in rcs2log + +* Wed Sep 09 1998 Cristian Gafton +- upgrade to 20.3 + +* Tue Jun 9 1998 Jeff Johnson +- add --with-pop to X11 compile. +- include contents of /usr/share/.../etc with main package. + +* Mon Jun 01 1998 Prospector System +- translations modified for de, fr + +* Mon Jun 01 1998 David S. Miller +- fix signals when linked with glibc on non-Intel architectures + NOTE: This patch is not needed with emacs >20.2 + +* Thu May 07 1998 Prospector System + +- translations modified for de, fr, tr + +* Thu May 07 1998 Cristian Gafton +- added /usr/lib/emacs/20.2/*-redhat-linux directory in the filelist + +* Thu Apr 09 1998 Cristian Gafton +- alpha started to like emacs-nox again :-) + +* Thu Nov 6 1997 Michael Fulbright +- alpha just doesnt like emacs-nox, taking it out for now + +* Mon Nov 3 1997 Michael Fulbright +- added multibyte support back into emacs 20.2 +- added wmconfig for X11 emacs +- fixed some errant buildroot references + +* Thu Oct 23 1997 Michael Fulbright +- joy a new version of emacs! Of note - no lockdir any more. +- use post/preun sections to handle numerous GNU info files + +* Mon Oct 06 1997 Erik Troan +- stopped stripping it as it seems to break things + +* Sun Sep 14 1997 Erik Troan +- turned off ecoff support on the Alpha (which doesn't build anymore) + +* Mon Jun 16 1997 Erik Troan +- built against glibc + +* Fri Feb 07 1997 Michael K. Johnson +- Moved ctags to gctags to fit in the more powerful for C (but less + general) exuberant ctags as the binary /usr/bin/ctags and the + man page /usr/man/man1/ctags.1