aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2021-11-03 20:26:28 +0200
committerEli Zaretskii2021-11-03 20:26:29 +0200
commitf78c819d9569ad18cc048554ddeb331a27a58989 (patch)
treebd9e61206672a71af7724a079305b07cc11e49fa
parentd8523060e5dcf285a5468377720bed6a34599df6 (diff)
parent3e4eb54db49e23b593664e4a3de3d3d744de61b7 (diff)
downloademacs-f78c819d9569ad18cc048554ddeb331a27a58989.tar.gz
emacs-f78c819d9569ad18cc048554ddeb331a27a58989.zip
Merge from origin/emacs-28
3e4eb54 ; * etc/PROBLEMS: Minor copyedits of the last change. (Bug#5... 35bc211 Document a macOS error message when opening Emacs 4df9998 Fix header-line and tab-line when mode-line-compact is set 81915a9 Add manual section about how to avoid regexp problems a16e66c Clarify build environment 6ab6b2f Clarify build directory structure 9d61620 * src/pdumper.c (dump_do_dump_relocation): Add sanity check.
-rw-r--r--admin/nt/dist-build/README-scripts37
-rw-r--r--doc/lispref/elisp.texi1
-rw-r--r--doc/lispref/searching.texi77
-rw-r--r--etc/PROBLEMS29
-rw-r--r--src/pdumper.c3
-rw-r--r--src/xdisp.c3
6 files changed, 115 insertions, 35 deletions
diff --git a/admin/nt/dist-build/README-scripts b/admin/nt/dist-build/README-scripts
index f27bcd3bd66..6b1adbe03e1 100644
--- a/admin/nt/dist-build/README-scripts
+++ b/admin/nt/dist-build/README-scripts
@@ -3,6 +3,15 @@ Distribution Build Scripts for Windows
3 3
4The scripts are used to build the binary distribution zip files for windows. 4The scripts are used to build the binary distribution zip files for windows.
5 5
6Environment
7-----------
8
9A full installation of msys2 is required along for the build. The
10various dependencies of Emacs need to be installed also. These change
11over time, but are listed in build-deps-zips.py.
12
13
14
6File System Organization 15File System Organization
7------------------------ 16------------------------
8 17
@@ -15,15 +24,19 @@ The file system needs to be organized like so:
15 24
16~/emacs-build/git 25~/emacs-build/git
17 26
18Contains a checkout of the Emacs git repository, organized according 27Contains checkouts and worktrees of the Emacs git repository,
19to branches, with git worktree 28organized according to branches.
20 29
21~/emacs-build/git/emacs-$branch 30~/emacs-build/git/master
22 31
23A branch of the git repository containing the current release 32A checkout out of the master branch of the Emacs git repository.
33
34~/emacs-build/git/emacs-$major-version
35
36A worktree of the git repository containing the current release
24branch. This has to be created by hand. 37branch. This has to be created by hand.
25 38
26~/emacs-build/git/emacs-$version 39~/emacs-build/git/emacs-$release-version
27 40
28A branch of the git repository containing the last release. The 41A branch of the git repository containing the last release. The
29build-zips.sh file will create this for you. 42build-zips.sh file will create this for you.
@@ -63,8 +76,8 @@ uploaded.
63Build Process 76Build Process
64------------- 77-------------
65 78
66For each major version 79
67---------------------- 80### For each major version
68 81
69The dependencies files need to be created. This can be around the time 82The dependencies files need to be created. This can be around the time
70of the pre-tests, then used for all releases of that version, to 83of the pre-tests, then used for all releases of that version, to
@@ -88,8 +101,7 @@ files will be created in ~/emacs-upload from where they can be signed
88and uploaded with `gnupload`. 101and uploaded with `gnupload`.
89 102
90 103
91For snapshots from Master 104### For snapshots from Master
92-------------------------
93 105
94Snapshots are generally created from master when there is a release 106Snapshots are generally created from master when there is a release
95branch on which a release has already been created. At this point, 107branch on which a release has already been created. At this point,
@@ -110,8 +122,7 @@ used.
110Now, run `build-zips.sh -s` to build a snapshot release. 122Now, run `build-zips.sh -s` to build a snapshot release.
111 123
112 124
113For snapshots from a Release Branch 125### For snapshots from a Release Branch
114-----------------------------------
115 126
116Snapshots can be built from a release branch; this is really only 127Snapshots can be built from a release branch; this is really only
117useful before a pre-test has happened. 128useful before a pre-test has happened.
@@ -123,8 +134,8 @@ version number must be added to the command line with `build-zips.sh
123the version (e.g emacs-27-2019-12-26.zip) rather than than the Emacs 134the version (e.g emacs-27-2019-12-26.zip) rather than than the Emacs
124version (e.g emacs-27.0.50.zip). 135version (e.g emacs-27.0.50.zip).
125 136
126For snapshots from another branch 137
127--------------------------------- 138### For snapshots from another branch
128 139
129Snapshots can be build from any other branch. There is rarely a need 140Snapshots can be build from any other branch. There is rarely a need
130to do this, except where some significant, wide-ranging feature is 141to do this, except where some significant, wide-ranging feature is
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index c4bd97bf815..6057691239f 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -1316,6 +1316,7 @@ Regular Expressions
1316* Rx Notation:: An alternative, structured regexp notation. 1316* Rx Notation:: An alternative, structured regexp notation.
1317@end ifnottex 1317@end ifnottex
1318* Regexp Functions:: Functions for operating on regular expressions. 1318* Regexp Functions:: Functions for operating on regular expressions.
1319* Regexp Problems:: Some problems and how they may be avoided.
1319 1320
1320Syntax of Regular Expressions 1321Syntax of Regular Expressions
1321 1322
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi
index f5a42406ae0..296ce20169c 100644
--- a/doc/lispref/searching.texi
+++ b/doc/lispref/searching.texi
@@ -263,6 +263,7 @@ case-sensitive.
263* Rx Notation:: An alternative, structured regexp notation. 263* Rx Notation:: An alternative, structured regexp notation.
264@end ifnottex 264@end ifnottex
265* Regexp Functions:: Functions for operating on regular expressions. 265* Regexp Functions:: Functions for operating on regular expressions.
266* Regexp Problems:: Some problems and how they may be avoided.
266@end menu 267@end menu
267 268
268@node Syntax of Regexps 269@node Syntax of Regexps
@@ -343,15 +344,6 @@ first tries to match all three @samp{a}s; but the rest of the pattern is
343The next alternative is for @samp{a*} to match only two @samp{a}s. With 344The next alternative is for @samp{a*} to match only two @samp{a}s. With
344this choice, the rest of the regexp matches successfully. 345this choice, the rest of the regexp matches successfully.
345 346
346@strong{Warning:} Nested repetition operators can run for a very
347long time, if they lead to ambiguous matching. For
348example, trying to match the regular expression @samp{\(x+y*\)*a}
349against the string @samp{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz} could
350take hours before it ultimately fails. Emacs may try each way of
351grouping the @samp{x}s before concluding that none of them can work.
352In general, avoid expressions that can match the same string in
353multiple ways.
354
355@item @samp{+} 347@item @samp{+}
356@cindex @samp{+} in regexp 348@cindex @samp{+} in regexp
357is a postfix operator, similar to @samp{*} except that it must match 349is a postfix operator, similar to @samp{*} except that it must match
@@ -1884,6 +1876,73 @@ variables that may be set to a pattern that actually matches
1884something. 1876something.
1885@end defvar 1877@end defvar
1886 1878
1879@node Regexp Problems
1880@subsection Problems with Regular Expressions
1881@cindex regular expression problems
1882@cindex regexp stack overflow
1883@cindex stack overflow in regexp
1884
1885The Emacs regexp implementation, like many of its kind, is generally
1886robust but occasionally causes trouble in either of two ways: matching
1887may run out of internal stack space and signal an error, and it can
1888take a long time to complete. The advice below will make these
1889symptoms less likely and help alleviate problems that do arise.
1890
1891@itemize
1892@item
1893Anchor regexps at the beginning of a line, string or buffer using
1894zero-width assertions (@samp{^} and @code{\`}). This takes advantage
1895of fast paths in the implementation and can avoid futile matching
1896attempts. Other zero-width assertions may also bring benefits by
1897causing a match to fail early.
1898
1899@item
1900Avoid or-patterns in favour of character alternatives: write
1901@samp{[ab]} instead of @samp{a\|b}. Recall that @samp{\s-} and @samp{\sw}
1902are equivalent to @samp{[[:space:]]} and @samp{[[:word:]]}, respectively.
1903
1904@item
1905Since the last branch of an or-pattern does not add a backtrack point
1906on the stack, consider putting the most likely matched pattern last.
1907For example, @samp{^\(?:a\|.b\)*c} will run out of stack if trying to
1908match a very long string of @samp{a}s, but the equivalent
1909@samp{^\(?:.b\|a\)*c} will not.
1910
1911(It is a trade-off: successfully matched or-patterns run faster with
1912the most frequently matched pattern first.)
1913
1914@item
1915Try to ensure that any part of the text can only match in a single
1916way. For example, @samp{a*a*} will match the same set of strings as
1917@samp{a*}, but the former can do so in many ways and will therefore
1918cause slow backtracking if the match fails later on. Make or-pattern
1919branches mutually exclusive if possible, so that matching will not go
1920far into more than one branch before failing.
1921
1922Be especially careful with nested repetitions: they can easily result
1923in very slow matching in the presence of ambiguities. For example,
1924@samp{\(?:a*b*\)+c} will take a long time attempting to match even a
1925moderately long string of @samp{a}s before failing. The equivalent
1926@samp{\(?:a\|b\)*c} is much faster, and @samp{[ab]*c} better still.
1927
1928@item
1929Don't use capturing groups unless they are really needed; that is, use
1930@samp{\(?:@dots{}\)} instead of @samp{\(@dots{}\)} for bracketing
1931purposes.
1932
1933@ifnottex
1934@item
1935Consider using @code{rx} (@pxref{Rx Notation}); it can optimise some
1936or-patterns automatically and will never introduce capturing groups
1937unless explicitly requested.
1938@end ifnottex
1939@end itemize
1940
1941If you run into regexp stack overflow despite following the above
1942advice, don't be afraid of performing the matching in multiple
1943function calls, each using a simpler regexp where backtracking can
1944more easily be contained.
1945
1887@node Regexp Search 1946@node Regexp Search
1888@section Regular Expression Searching 1947@section Regular Expression Searching
1889@cindex regular expression searching 1948@cindex regular expression searching
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index e1bfc2b032b..825801db912 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -742,18 +742,6 @@ completed" message that tls.el relies upon, causing affected Emacs
742functions to hang. To work around the problem, use older or newer 742functions to hang. To work around the problem, use older or newer
743versions of gnutls-cli, or use Emacs's built-in gnutls support. 743versions of gnutls-cli, or use Emacs's built-in gnutls support.
744 744
745*** Stack overflow in regexp matcher.
746Due to fundamental limitations in the way Emacs' regular expression
747engine is designed, you might run into combinatorial explosions in
748backtracking with certain regexps.
749
750Avoid "\(...\(...\)*...\)*" and "\(...\)*\(...\)*". Look for a way to
751anchor your regular expression, to avoid matching the null string in
752infinite ways. The latter is what creates backtrack points, and
753eventual overflow in practice.
754
755(Also prefer "\(?:...\)" to "\(...\)" unless you need the latter.)
756
757* Runtime problems related to font handling 745* Runtime problems related to font handling
758 746
759** Characters are displayed as empty boxes or with wrong font under X. 747** Characters are displayed as empty boxes or with wrong font under X.
@@ -2706,6 +2694,23 @@ If you do, please send it to bug-gnu-emacs@gnu.org so we can list it here.
2706 2694
2707* Runtime problems specific to macOS 2695* Runtime problems specific to macOS
2708 2696
2697** Error message when opening Emacs on macOS
2698
2699When opening Emacs, you may see an error message saying something like
2700this:
2701
2702 "Emacs" can't be opened because Apple cannot check it for malicious
2703 software. This software needs to be updated. Contact the developer
2704 for more information.
2705
2706The reason is that Apple incorrectly catalogs Emacs as potentially
2707malicious software and thus shows this error message.
2708
2709To avoid this alert, open Finder, go to Applications, control-click
2710the Emacs app icon, and then choose Open. This adds a security
2711exception for Emacs and from now on you should be able to open it by
2712double-clicking on its icon, like any other app.
2713
2709** macOS doesn't come with libxpm, so only XPM3 is supported. 2714** macOS doesn't come with libxpm, so only XPM3 is supported.
2710 2715
2711Libxpm is available for macOS as part of the XQuartz project. 2716Libxpm is available for macOS as part of the XQuartz project.
diff --git a/src/pdumper.c b/src/pdumper.c
index 6cf7b847cb7..9eff5c48d09 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -5296,6 +5296,9 @@ dump_do_dump_relocation (const uintptr_t dump_base,
5296 error ("Trying to load incoherent dumped eln file %s", 5296 error ("Trying to load incoherent dumped eln file %s",
5297 SSDATA (comp_u->file)); 5297 SSDATA (comp_u->file));
5298 5298
5299 if (!CONSP (comp_u->file))
5300 error ("Incoherent compilation unit for dump was dumped");
5301
5299 /* emacs_execdir is always unibyte, but the file names in 5302 /* emacs_execdir is always unibyte, but the file names in
5300 comp_u->file could be multibyte, so we need to encode 5303 comp_u->file could be multibyte, so we need to encode
5301 them. */ 5304 them. */
diff --git a/src/xdisp.c b/src/xdisp.c
index aa01db210b7..39ede3c0952 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -25626,7 +25626,8 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format)
25626 push_kboard (FRAME_KBOARD (it.f)); 25626 push_kboard (FRAME_KBOARD (it.f));
25627 record_unwind_save_match_data (); 25627 record_unwind_save_match_data ();
25628 25628
25629 if (NILP (Vmode_line_compact)) 25629 if (NILP (Vmode_line_compact)
25630 || face_id == HEADER_LINE_FACE_ID || face_id == TAB_LINE_FACE_ID)
25630 { 25631 {
25631 mode_line_target = MODE_LINE_DISPLAY; 25632 mode_line_target = MODE_LINE_DISPLAY;
25632 display_mode_element (&it, 0, 0, 0, format, Qnil, false); 25633 display_mode_element (&it, 0, 0, 0, format, Qnil, false);