emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 8f74691 2/3: Merge branch 'master' of git.savannah.


From: Eli Zaretskii
Subject: [Emacs-diffs] master 8f74691 2/3: Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
Date: Sat, 31 Mar 2018 03:57:03 -0400 (EDT)

branch: master
commit 8f746914214f19fe7eaad15e03923aca8667b87f
Merge: 6a2b940 20fa40d
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
---
 admin/make-tarball.txt    | 34 ++++++++++++++++++++++---------
 make-dist                 |  8 ++++----
 src/alloc.c               |  9 ---------
 src/editfns.c             |  7 +++----
 src/fileio.c              |  2 ++
 src/insdel.c              |  4 ++--
 src/lisp.h                |  4 ++--
 src/marker.c              | 13 ++++++++++--
 test/src/editfns-tests.el | 51 +++++++++++++++++++++++++++++++++++++++++++++++
 9 files changed, 100 insertions(+), 32 deletions(-)

diff --git a/admin/make-tarball.txt b/admin/make-tarball.txt
index ac6d15d..19edeb7 100644
--- a/admin/make-tarball.txt
+++ b/admin/make-tarball.txt
@@ -123,7 +123,7 @@ General steps (for each step, check for possible errors):
 
 9. Decide what compression schemes to offer.
     For a release, at least gz and xz:
-      gzip --best -c emacs-NEW.tar > emacs-NEW.tar.gz
+      gzip --best --no-name -c emacs-NEW.tar > emacs-NEW.tar.gz
       xz -c emacs-NEW.tar > emacs-NEW.tar.xz
     For pretests, just xz is probably fine (saves bandwidth).
 
@@ -197,7 +197,6 @@ The pages to update are:
 
 emacs.html (for a new major release, a more thorough update is needed)
 history.html
-add the new NEWS file as news/NEWS.xx.y
 
 For every new release, a banner is displayed on top of the emacs.html
 page.  Uncomment and the release banner in emacs.html.  Keep it on the
@@ -210,15 +209,32 @@ manual/html_node directory, delete any old manual pages 
that are no
 longer present.
 
 Tar up the generated html_node/emacs/ and elisp/ directories and update
-the files manual/elisp.html_node.tar.gz and emacs.html_node.tar.gz.
+the files  manual/elisp.html_node.tar.gz and emacs.html_node.tar.gz.
+Use GNU Tar as follows so that the tarballs are reproducible:
 
-Use M-x make-manuals-dist from admin/admin.el to update the
-manual/texi/ tarfiles.
-
-Add compressed copies of the main info pages from the tarfile to manual/info/.
+cd manual
+tar='tar --numeric-owner --owner=0 --group=0 --mode=go+u,go-w --sort=name'
+gzip='gzip --best --no-name'
+$tar -cf - html_node/emacs | $gzip >emacs.html_node.tar.gz
+$tar -cf - html_node/elisp | $gzip >elisp.html_node.tar.gz
 
-Update the refcards/pdf/ and ps/ directories, and also
-refcards/emacs-refcards.tar.gz (use make -C etc/refcards pdf ps dist).
+Use M-x make-manuals-dist from admin/admin.el to update the
+manual/*.tar files.
+
+Add compressed copies of the main info pages from the tarfile to manual/info/
+as follows:
+
+cd manual
+mkdir info
+gzip --best --no-name <../info/eintr.info >info/eintr.info.gz
+gzip --best --no-name <../info/elisp.info >info/elisp.info.gz
+gzip --best --no-name <../info/emacs.info >info/emacs.info.gz
+
+FIXME: The above instructions are not quite complete, as they do not
+specify how to copy the generated files in the 'manual' directory to
+the corresponding web files.  Also, they are missing some files, e.g.,
+they generate manual/html_mono/ada-mode.html but do not generate the
+top-level ada-mode.html file for the one-node-per-page version.
 
 Browsing <https://web.cvs.savannah.gnu.org/viewvc/?root=emacs> is one
 way to check for any files that still need updating.
diff --git a/make-dist b/make-dist
index 26247b3..48c7fb4 100755
--- a/make-dist
+++ b/make-dist
@@ -639,14 +639,14 @@ if [ "${make_tar}" = yes ]; then
   case "${default_gzip}" in
     bzip2) gzip_extension=.bz2 ;;
     xz)  gzip_extension=.xz ;;
-    gzip)  gzip_extension=.gz ; default_gzip="gzip --best";;
+    gzip)  gzip_extension=.gz ; default_gzip="gzip --best --no-name";;
        *)  gzip_extension= ;;
   esac
   echo "Creating tar file"
-  taropt=
-  [ "$verbose" = "yes" ] && taropt=v
+  taropt='--numeric-owner --owner=0 --group=0 --mode=go+u,go-w --sort=name'
+  [ "$verbose" = "yes" ] && taropt="$taropt --verbose"
 
-  (cd ${tempparent} ; tar c${taropt}f - ${emacsname} ) \
+  (cd ${tempparent} ; tar $taropt -cf - ${emacsname} ) \
     | ${default_gzip} \
     > ${emacsname}.tar${gzip_extension}
 fi
diff --git a/src/alloc.c b/src/alloc.c
index 369592d..9fdcc73 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3878,15 +3878,6 @@ build_marker (struct buffer *buf, ptrdiff_t charpos, 
ptrdiff_t bytepos)
   return obj;
 }
 
-/* Put MARKER back on the free list after using it temporarily.  */
-
-void
-free_marker (Lisp_Object marker)
-{
-  unchain_marker (XMARKER (marker));
-  free_misc (marker);
-}
-
 
 /* Return a newly created vector or string with specified arguments as
    elements.  If all the arguments are characters that can fit
diff --git a/src/editfns.c b/src/editfns.c
index 727f2d0..608304c 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3899,10 +3899,9 @@ save_restriction_restore (Lisp_Object data)
 
          buf->clip_changed = 1; /* Remember that the narrowing changed. */
        }
-      /* This isn’t needed anymore, so don’t wait for GC.
-         Do not call free_marker on XCAR (data) or XCDR (data),
-         though, since record_marker_adjustments may have put
-         them on the buffer’s undo list (Bug#30931).  */
+      /* Detach the markers, and free the cons instead of waiting for GC.  */
+      detach_marker (XCAR (data));
+      detach_marker (XCDR (data));
       free_cons (XCONS (data));
     }
   else
diff --git a/src/fileio.c b/src/fileio.c
index 52ca8b6..2f8358f 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -224,6 +224,7 @@ report_file_error (char const *string, Lisp_Object name)
   report_file_errno (string, name, errno);
 }
 
+#ifdef USE_FILE_NOTIFY
 /* Like report_file_error, but reports a file-notify-error instead.  */
 
 void
@@ -238,6 +239,7 @@ report_file_notify_error (const char *string, Lisp_Object 
name)
 
   xsignal (Qfile_notify_error, Fcons (build_string (string), errdata));
 }
+#endif
 
 void
 close_file_unwind (int fd)
diff --git a/src/insdel.c b/src/insdel.c
index 02e3f41..173c243 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -2149,9 +2149,9 @@ signal_before_change (ptrdiff_t start_int, ptrdiff_t 
end_int,
     }
 
   if (! NILP (start_marker))
-    free_marker (start_marker);
+    detach_marker (start_marker);
   if (! NILP (end_marker))
-    free_marker (end_marker);
+    detach_marker (end_marker);
   RESTORE_VALUE;
 
   unbind_to (count, Qnil);
diff --git a/src/lisp.h b/src/lisp.h
index b931d23..c931d9c 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3812,7 +3812,6 @@ extern Lisp_Object make_save_funcptr_ptr_obj (void (*) 
(void), void *,
 extern Lisp_Object make_save_memory (Lisp_Object *, ptrdiff_t);
 extern void free_save_value (Lisp_Object);
 extern Lisp_Object build_overlay (Lisp_Object, Lisp_Object, Lisp_Object);
-extern void free_marker (Lisp_Object);
 extern void free_cons (struct Lisp_Cons *);
 extern void init_alloc_once (void);
 extern void init_alloc (void);
@@ -4105,7 +4104,8 @@ extern ptrdiff_t marker_byte_position (Lisp_Object);
 extern void clear_charpos_cache (struct buffer *);
 extern ptrdiff_t buf_charpos_to_bytepos (struct buffer *, ptrdiff_t);
 extern ptrdiff_t buf_bytepos_to_charpos (struct buffer *, ptrdiff_t);
-extern void unchain_marker (struct Lisp_Marker *marker);
+extern void detach_marker (Lisp_Object);
+extern void unchain_marker (struct Lisp_Marker *);
 extern Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, 
Lisp_Object);
 extern Lisp_Object set_marker_both (Lisp_Object, Lisp_Object, ptrdiff_t, 
ptrdiff_t);
 extern Lisp_Object set_marker_restricted_both (Lisp_Object, Lisp_Object,
diff --git a/src/marker.c b/src/marker.c
index 2a45ae6..2d5b05c 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -560,7 +560,7 @@ POSITION is nil, makes marker point nowhere so it no longer 
slows down
 editing in any buffer.  Returns MARKER.  */)
   (Lisp_Object marker, Lisp_Object position, Lisp_Object buffer)
 {
-  return set_marker_internal (marker, position, buffer, 0);
+  return set_marker_internal (marker, position, buffer, false);
 }
 
 /* Like the above, but won't let the position be outside the visible part.  */
@@ -569,7 +569,7 @@ Lisp_Object
 set_marker_restricted (Lisp_Object marker, Lisp_Object position,
                       Lisp_Object buffer)
 {
-  return set_marker_internal (marker, position, buffer, 1);
+  return set_marker_internal (marker, position, buffer, true);
 }
 
 /* Set the position of MARKER, specifying both the
@@ -616,6 +616,15 @@ set_marker_restricted_both (Lisp_Object marker, 
Lisp_Object buffer,
   return marker;
 }
 
+/* Detach a marker so that it no longer points anywhere and no longer
+   slows down editing.  Do not free the marker, though, as a change
+   function could have inserted it into an undo list (Bug#30931).  */
+void
+detach_marker (Lisp_Object marker)
+{
+  Fset_marker (marker, Qnil, Qnil);
+}
+
 /* Remove MARKER from the chain of whatever buffer it is in,
    leaving it points to nowhere.  This is called during garbage
    collection, so we must be careful to ignore and preserve
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el
index 442ad08..2e20c9d 100644
--- a/test/src/editfns-tests.el
+++ b/test/src/editfns-tests.el
@@ -288,4 +288,55 @@
                  (buffer-string)
                  "foo bar baz qux"))))))
 
+(ert-deftest delete-region-undo-markers-1 ()
+  "Make sure we don't end up with freed markers reachable from Lisp."
+  ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30931#40
+  (with-temp-buffer
+    (insert "1234567890")
+    (setq buffer-undo-list nil)
+    (narrow-to-region 2 5)
+    ;; `save-restriction' in a narrowed buffer creates two markers
+    ;; representing the current restriction.
+    (save-restriction
+      (widen)
+      ;; Any markers *within* the deleted region are put onto the undo
+      ;; list.
+      (delete-region 1 6))
+    ;; (princ (format "%S" buffer-undo-list) #'external-debugging-output)
+    ;; `buffer-undo-list' is now
+    ;; (("12345" . 1) (#<temp-marker1> . -1) (#<temp-marker2> . 1))
+    ;;
+    ;; If temp-marker1 or temp-marker2 are freed prematurely, calling
+    ;; `type-of' on them will cause Emacs to abort.  Calling
+    ;; `garbage-collect' will also abort if it finds any reachable
+    ;; freed objects.
+    (should (eq (type-of (car (nth 1 buffer-undo-list))) 'marker))
+    (should (eq (type-of (car (nth 2 buffer-undo-list))) 'marker))
+    (garbage-collect)))
+
+(ert-deftest delete-region-undo-markers-2 ()
+  "Make sure we don't end up with freed markers reachable from Lisp."
+  ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30931#55
+  (with-temp-buffer
+    (insert "1234567890")
+    (setq buffer-undo-list nil)
+    ;; signal_before_change creates markers delimiting a change
+    ;; region.
+    (let ((before-change-functions
+           (list (lambda (beg end)
+                   (delete-region (1- beg) (1+ end))))))
+      (delete-region 2 5))
+    ;; (princ (format "%S" buffer-undo-list) #'external-debugging-output)
+    ;; `buffer-undo-list' is now
+    ;; (("678" . 1) ("12345" . 1) (#<marker in no buffer> . -1)
+    ;;  (#<temp-marker1> . -1) (#<temp-marker2> . -4))
+    ;;
+    ;; If temp-marker1 or temp-marker2 are freed prematurely, calling
+    ;; `type-of' on them will cause Emacs to abort.  Calling
+    ;; `garbage-collect' will also abort if it finds any reachable
+    ;; freed objects.
+    (should (eq (type-of (car (nth 3 buffer-undo-list))) 'marker))
+    (should (eq (type-of (car (nth 4 buffer-undo-list))) 'marker))
+    (garbage-collect)))
+
 ;;; editfns-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]