Accepting request 49865 from editors

Copy from editors/emacs based on submit request 49865 from user WernerFink

OBS-URL: https://build.opensuse.org/request/show/49865
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/emacs?expand=0&rev=54
This commit is contained in:
OBS User autobuild 2010-10-06 21:37:35 +00:00 committed by Git OBS Bridge
commit abc08e2cb9
4 changed files with 163 additions and 1 deletions

View File

@ -0,0 +1,58 @@
--- lisp/loaddefs.el
+++ lisp/loaddefs.el 2010-08-12 15:38:16.235126810 +0000
@@ -25974,7 +25974,7 @@ as its \"correct\" spelling; then the qu
\(fn)" t nil)
-(make-obsolete 'spell-buffer 'ispell-buffer "23.1")
+(define-obsolete-function-alias 'spell-buffer 'ispell-buffer "23.1")
(autoload 'spell-word "spell" "\
Check spelling of word at or before point.
@@ -25983,7 +25983,7 @@ and `query-replace' the entire buffer to
\(fn)" t nil)
-(make-obsolete 'spell-word 'ispell-word "23.1")
+(define-obsolete-function-alias 'spell-word 'ispell-word "23.1")
(autoload 'spell-region "spell" "\
Like `spell-buffer' but applies only to region.
@@ -25993,7 +25993,7 @@ for example, \"word\".
\(fn START END &optional DESCRIPTION)" t nil)
-(make-obsolete 'spell-region 'ispell-region "23.1")
+(define-obsolete-function-alias 'spell-region 'ispell-region "23.1")
(autoload 'spell-string "spell" "\
Check spelling of string supplied as argument.
--- lisp/textmodes/spell.el
+++ lisp/textmodes/spell.el 2010-08-12 15:36:22.119126692 +0000
@@ -63,7 +63,7 @@ as its \"correct\" spelling; then the qu
(with-no-warnings
(spell-region (point-min) (point-max) "buffer")))
;;;###autoload
-(make-obsolete 'spell-buffer 'ispell-buffer "23.1")
+(define-obsolete-function-alias 'spell-buffer 'ispell-buffer "23.1")
;;;###autoload
(defun spell-word ()
@@ -82,7 +82,7 @@ and `query-replace' the entire buffer to
(with-no-warnings
(spell-region beg end (buffer-substring beg end)))))
;;;###autoload
-(make-obsolete 'spell-word 'ispell-word "23.1")
+(define-obsolete-function-alias 'spell-word 'ispell-word "23.1")
;;;###autoload
(defun spell-region (start end &optional description)
@@ -145,7 +145,7 @@ for example, \"word\"."
(query-replace-regexp (concat "\\b" (regexp-quote word) "\\b")
newword)))))))
;;;###autoload
-(make-obsolete 'spell-region 'ispell-region "23.1")
+(define-obsolete-function-alias 'spell-region 'ispell-region "23.1")
;;;###autoload
(defun spell-string (string)

90
emacs-23.1-rst.patch Normal file
View File

@ -0,0 +1,90 @@
Description: Patch to fix temporary file vulnerability
My approach is based on the premise that the make-temp-file function
provided from Emacs 22 onwards is safe. So, I backport the method to
the rst.el file, and bind it to the symbol rst--make-temp-file as
follows:
- If the Emacs version is less than 22, use this custom version. This
works on Emacs 21, I tested it.
- If the Emacs version is 22 or more, bind rst--make-temp-file to the
make-temp-fil provided in the Emacs Lisp libraries.
I don't see a solution for removing the temporary files, though.
I am no expert on security or Emacs Lisp, but I hope this patch
provides a start.
Author: Kumar Appaiah <akumar@debian.org>
Addopted due bug bnc#642787 for emacs 23.1 by Werner Fink <werner@suse.de>
---
rst.el | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 46 insertions(+), 2 deletions(-)
--- lisp/textmodes/rst.el
+++ lisp/textmodes/rst.el 2010-10-06 09:50:28.779926181 +0000
@@ -3297,10 +3297,54 @@ or of the entire buffer, if the region i
(defvar rst-pdf-program "xpdf"
"Program used to preview PDF files.")
+(if (> emacs-major-version 22)
+ (defalias 'rst--make-temp-file 'make-temp-file)
+ (defvar temporary-file-directory)
+ (defun rst--make-temp-file (prefix &optional dir-flag suffix)
+ "Create a temporary file.
+The returned file name (created by appending some random characters at the end
+of PREFIX, and expanding against `temporary-file-directory' if necessary),
+is guaranteed to point to a newly created empty file.
+You can then use `write-region' to write new data into the file.
+
+If DIR-FLAG is non-nil, create a new empty directory instead of a file.
+
+If SUFFIX is non-nil, add that at the end of the file name."
+ (let ((umask (default-file-modes))
+ file)
+ (unwind-protect
+ (progn
+ ;; Create temp files with strict access rights. It's easy to
+ ;; loosen them later, whereas it's impossible to close the
+ ;; time-window of loose permissions otherwise.
+ (set-default-file-modes ?\700)
+ (while (condition-case ()
+ (progn
+ (setq file
+ (make-temp-name
+ (if (zerop (length prefix))
+ (file-name-as-directory
+ temporary-file-directory)
+ (expand-file-name prefix
+ temporary-file-directory))))
+ (if suffix
+ (setq file (concat file suffix)))
+ (if dir-flag
+ (make-directory file)
+ (write-region "" nil file nil 'silent nil 'excl))
+ nil)
+ (file-already-exists t))
+ ;; the file was somehow created by someone else between
+ ;; `make-temp-name' and `write-region', let's try again.
+ nil)
+ file)
+ ;; Reset the umask.
+ (set-default-file-modes umask)))))
+
(defun rst-compile-pdf-preview ()
"Convert the document to a PDF file and launch a preview program."
(interactive)
- (let* ((tmp-filename "/tmp/out.pdf")
+ (let* ((tmp-filename (rst--make-temp-file "rst" nil ".pdf"))
(command (format "rst2pdf.py %s %s && %s %s"
buffer-file-name tmp-filename
rst-pdf-program tmp-filename)))
@@ -3315,7 +3359,7 @@ or of the entire buffer, if the region i
(defun rst-compile-slides-preview ()
"Convert the document to an S5 slide presentation and launch a preview program."
(interactive)
- (let* ((tmp-filename "/tmp/slides.html")
+ (let* ((tmp-filename (rst--make-temp-file "rst" nil ".html"))
(command (format "rst2s5.py %s %s && %s %s"
buffer-file-name tmp-filename
rst-slides-program tmp-filename)))

View File

@ -1,8 +1,18 @@
-------------------------------------------------------------------
Wed Oct 6 11:59:06 CEST 2010 - werner@suse.de
- Fix reStructuredText tmp file problem (bnc#642787)
-------------------------------------------------------------------
Tue Sep 7 12:54:28 UTC 2010 - aj@suse.de
- BuildRequire gpm-devel
-------------------------------------------------------------------
Thu Aug 12 17:40:53 CEST 2010 - werner@suse.de
- Avoid trouble with spell see bug bnc#628268
-------------------------------------------------------------------
Thu May 20 12:44:38 CEST 2010 - werner@suse.de

View File

@ -30,7 +30,7 @@ Url: http://www.gnu.org/software/emacs/
License: GPLv2+
Group: Productivity/Editors/Emacs
Version: 23.1
Release: 21
Release: 22
Obsoletes: ge_exec ge_site emac_nox emacmisc emacsbin emacsger emacs-url Mule-UCS emacs-calc erc
Requires: emacs-info = %{version}
Requires: emacs_program = %{version}-%{release}
@ -66,6 +66,8 @@ Patch18: emacs-sparc.diff
Patch19: emacs-23.1-fix_cpp.patch
Patch20: emacs-23.1-gcc45.dif
Patch21: emacs-23.1-png_sig_cmp.patch
Patch22: emacs-23.1-bnc628268.patch
Patch23: emacs-23.1-rst.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%global bug_345669 0
%{expand: %%global _exec_prefix %(type -p pkg-config &>/dev/null && pkg-config --variable prefix x11 || echo /usr/X11R6)}
@ -260,6 +262,8 @@ if test ! -e $HOME/.mh_profile && type -p install-mh > /dev/null 2>&1; then
fi
%patch20 -p0 -b .gcc45
%patch21
%patch22
%patch23
%build
CC=gcc-4.3