Paul Eggert [Fri, 18 May 2018 22:45:42 +0000 (15:45 -0700)]
Port to GCC 8 -fsanitize=undefined
In GCC 8, gcc -fsanitize=undefined flags the undefined behavior
that Emacs relies on in its XPNTR and XSYMBOL low-level functions.
Disable undefined sanitization in these functions. Although this
disabling doesn’t suffice if DEFINE_KEY_OPS_AS_MACROS is true, it
works for -fsanitize=undefined -DINLINING=0, which is good enough.
* src/alloc.c (macro_PNTR_ADD): New macro.
(PNTR_ADD): New function and macro.
The function disables -fsanitize=undefined.
(macro_XPNTR): Use it.
* src/conf_post.h (ATTRIBUTE_NO_SANITIZE_UNDEFINED): New macro.
* src/lisp.h (XSYMBOL): Disable -fsanitize=undefined.
Eli Zaretskii [Fri, 18 May 2018 13:34:19 +0000 (16:34 +0300)]
Fix decoding of directories when "~" includes non-ASCII chars
* src/fileio.c (Fexpand_file_name): Don't build multibyte strings
from unibyte non-ASCII strings when NAME and DEFAULT_DIRECTORY
have different multibyteness, as this adds bytes to the byte
sequence, and in some situations, e.g., when the home directory
includes non-ASCII characters, can fail file APIs. (Bug#30755)
* lisp/startup.el (normal-top-level): Make sure default-directory
is set to a multibyte string when decoded on MS-Windows.
Filipp Gunbin [Tue, 15 May 2018 00:02:49 +0000 (03:02 +0300)]
Fix bugs in `auth-source-netrc-parse-one'.
* lisp/auth-source.el (auth-source-netrc-parse-one): Ensure that match
data is not overwritten in `auth-source-netrc-parse-next-interesting'.
Ensure that blanks are skipped before and after going over comments
and eols.
* test/lisp/auth-source-tests.el (auth-source-test-netrc-parse-one): New test.
Michael Albinus [Wed, 16 May 2018 09:22:51 +0000 (11:22 +0200)]
Fix creation of Secret Service items in auth-source
* lisp/auth-source.el (auth-source-secrets-create): Use ´apply'.
(auth-source-secrets-saver): Handle `auth-source-save-behavior'
equal t.
* lisp/net/secrets.el (secrets-get-items): Do not call
`secrets-open-session' here ...
(top): ... but here.
* test/lisp/auth-source-tests.el
(auth-source-test-secrets-create-secret): Bind
`auth-source-save-behavior' to t. Cleanup.
* test/lisp/net/secrets-tests.el (secrets-test00-availability):
After loading secets.el, a session is already opened.
(secrets-test02-collections, secrets-test03-items)
(secrets-test04-search): Open a new session.
Jay Kamat [Tue, 8 May 2018 19:36:36 +0000 (12:36 -0700)]
esh-opt.el: Add a :parse-leading-options-only argument (Bug#28323)
* lisp/eshell/esh-opt.el (eshell-eval-using-options): Add a new
:parse-leading-options-only argument which ignores dash/switch
arguments after the first positional argument.
(eshell--process-args): Abort processing of arguments if we see one
positional argument and :parse-leading-options-only is set.
* lisp/eshell/em-tramp.el (eshell/sudo): Use
:parse-leading-options-only, to avoid parsing subcommand switches as
switches of sudo itself.
* test/lisp/eshell/esh-opt-tests.el: Add tests for new and old behavior.
Jay Kamat [Tue, 8 May 2018 19:04:00 +0000 (12:04 -0700)]
esh-opt.el: Fix improper parsing of first argument (Bug#28323)
Examples of broken behavior:
sudo -u root whoami
Outputs: -u
ls -I '*.txt' /dev/null
Errors with: *.txt: No such file or directory
* lisp/eshell/esh-opt.el (eshell--process-args): Refactor usage of
args to eshell--args, as we rely on modifications from
eshell--process-option and vice versa. These modifications were not
being propogated in the (if (= ai 0)) case, since popping the first
element of a list doesn't destructively modify the underlying list
object.
Glenn Morris [Tue, 15 May 2018 16:09:48 +0000 (09:09 -0700)]
Merge from origin/emacs-26
b98cf9c ; Fix a typo in the Emacs manual 700fcd7 * doc/emacs/help.texi: Fix paren typo. c9c0e40 More minor changes in shell-related nodes of Emacs manual e6bf19c Fix inaccuracies in "Shell Ring" node of Emacs manual 087681b8 Improve documentation of kmacro commands and variables. be2e8cb * doc/man/emacs.1.in: Document --fg-daemon and --bg-daemon. 1d9e66a Don't check non-X frames for z order (Bug#31373) 7dc028e Check NSWindow is actually a frame
Michael Albinus [Tue, 15 May 2018 12:48:11 +0000 (14:48 +0200)]
Fix Bug#29575
* lisp/net/secrets.el (secrets-create-item): The new item does not
need a unique label.
(secrets-item-path, secrets-get-secret, secrets-get-attributes)
(secrets-get-attribute, secrets-delete-item): ITEM can also be an
object path. (Bug#29575)
* test/lisp/net/secrets-tests.el (secrets-test03-items):
Test also creation of two items with same label. Test
`secrets-get-secret', `secrets-get-attribute' and
`secrets-get-attributes' with object path.
(secrets-test04-search): Harden test.
Tino Calancha [Mon, 14 May 2018 16:30:11 +0000 (01:30 +0900)]
run-python: Make the buffer running python current
* lisp/progmodes/python.el (run-python, python-shell-make-comint):
Make the buffer running the inferior python process the current buffer
(Bug#31398).
* test/lisp/progmodes/python-tests.el (python-tests--bug31398):
Add test.
João Távora [Fri, 11 May 2018 22:28:40 +0000 (23:28 +0100)]
Fix filesystem littering by Flymake's legacy backend
The Flymake legacy "proc" backend, which is active by default will try
to syntax-check foo.c/foo.cpp and many other types of files, but on
failing to find a suitable Makefile target, will fail. There's
nothing wrong with that except that it used to leave behind the
foo_flymake.c and foo_flymake.cpp auxiliary files behind, littering
the filesystem.
* lisp/progmodes/flymake-proc.el (flymake-proc-legacy-flymake):
Call init-function inside of the unwind-protect.
João Távora [Fri, 11 May 2018 22:28:40 +0000 (23:28 +0100)]
Fix filesystem littering by Flymake's legacy backend
The Flymake legacy "proc" backend, which is active by default will try
to syntax-check foo.c/foo.cpp and many other types of files, but on
failing to find a suitable Makefile target, will fail. There's
nothing wrong with that except that it used to leave behind the
foo_flymake.c and foo_flymake.cpp auxiliary files behind, littering
the filesystem.
* lisp/progmodes/flymake-proc.el (flymake-proc-legacy-flymake):
Call init-function inside of the unwind-protect.
Eli Zaretskii [Fri, 11 May 2018 09:39:52 +0000 (12:39 +0300)]
More minor changes in shell-related nodes of Emacs manual
* doc/emacs/misc.texi (Interactive Shell): Clarify how the window
that displays "*shell*" is selected.
(Shell Prompts): Fix a typo. Reported by Jorge
<jorge+list@disroot.org> in emacs-manual-bugs.
Eli Zaretskii [Fri, 11 May 2018 09:32:31 +0000 (12:32 +0300)]
Fix inaccuracies in "Shell Ring" node of Emacs manual
* doc/emacs/misc.texi (Shell Ring): Don't mention 'M-s' and don't
insist on Shell history commands being "jsut like" similar
commands that operate on minibuffer history. Reported by Jorge
<jorge+list@disroot.org> in emacs-manual-bugs.
* lisp/window.el (scroll-other-window-down):
Move to src/window.c as Fscroll_other_window_down.
* src/window.c (scroll_command): Generalise for arbitrary windows.
(Fscroll_up, Fscroll_down): Use scroll_command with selected_window.
(Fscroll_other_window, Fscroll_other_window_down):
Rewrite in terms of scroll_command.
(syms_of_window): Add Sscroll_other_window_down.
Glenn Morris [Mon, 7 May 2018 14:50:49 +0000 (07:50 -0700)]
Merge from origin/emacs-26
1d732d6 (origin/emacs-26) Fix gud-statement for pdb 91a68b5 ; * msdos/INSTALL: Add info about GCC versions. 7ddcc9a Document 'custom-group' 58f9e15 A minor addition to etc/DEBUG 4590414 Avoid errors in ispell.el when Enchant returns empty extra chars d0d75f9 Make 'ispell-initialize-spellchecker-hook' work again b90ce66 Handle selected_window change in prepare_menu_bars (Bug#31312) 79ad0b3 ; * INSTALL: Fix Emacs version number. (Bug#31358) 91de88b Fix report-emacs-bug via mailclient on MS-Windows f4b5ff2 Port collation tests to glibc 2.27
Eli Zaretskii [Sun, 6 May 2018 18:20:31 +0000 (21:20 +0300)]
Don't remove highlight of misspelled word on pdict save
* lisp/textmodes/ispell.el (ispell-pdict-save): Don't restart
flyspell-mode, as bug#11963, which this was supposed to fix, is
fixed better by ispell-command-loop, when the user types 'i' or
'a'. Restarting Flyspell mode when the personal dictionary is
saved caused bug#31372 as side effect.
(ispell-command-loop): Test 'flyspell-mode', not whether
flyspell-unhighlight-at is fboundp, to determine whether Flyspell
mode is turned on in the current buffer.
(flyspell-unhighlight-at): Add declare-function form for it.
Michael Albinus [Sun, 6 May 2018 10:39:36 +0000 (12:39 +0200)]
Fix Bug#31272
* lisp/net/tramp-sh.el (tramp-do-file-attributes-with-ls)
(tramp-do-directory-files-and-attributes-with-stat)
(tramp-sh-handle-insert-directory): Use "--show-control-chars".
(tramp-convert-file-attributes): Decode multibyte strings,
produced by "stat". (Bug#31272)
Eli Zaretskii [Sat, 5 May 2018 08:52:29 +0000 (11:52 +0300)]
Avoid infloops in font_open_entity
* src/font.c (font_open_entity): Fail after 15 iterations through
the loop that looks for a font whose average_width and height are
both positive. This avoids infinite loops for fonts that, e.g.,
report average_width of zero for any possible size we try.
(Bug#31316)
Eli Zaretskii [Sat, 5 May 2018 08:45:37 +0000 (11:45 +0300)]
Fix encoding of characters when using GB18030 fonts
* lisp/international/fontset.el (font-encoding-alist): Fix the
GB18030 entry to encode characters correctly when passing them to
the xfont back-end. (Bug#31315) See also
http://lists.gnu.org/archive/html/emacs-devel/2008-01/msg00754.html.
Daniel Pittman [Fri, 4 May 2018 14:37:10 +0000 (17:37 +0300)]
Avoid errors in ispell.el when Enchant returns empty extra chars
* lisp/textmodes/ispell.el (ispell--get-extra-word-characters):
Handle the case of empty extra characters returned by the
Enchant '-lsmod' command. (Bug#31344)
* lisp/subr.el (add-to-history): Clarify docstring.
Protect against negative history-length and unnecessary variable
modification, as per read_minibuf.
Paul Eggert [Wed, 2 May 2018 18:14:07 +0000 (11:14 -0700)]
Port collation tests to glibc 2.27
* test/src/fns-tests.el (fns-tests-collate-strings)
(fns-tests-collate-sort): Don’t make unportable assumptions
about how en_US.UTF-8 collation works. These assumptions
are not true on Fedora 28, which ships with glibc 2.27.
Michael Albinus [Wed, 2 May 2018 10:31:51 +0000 (12:31 +0200)]
Fix some edge cases of tramp-smb
* lisp/net/tramp-smb.el (tramp-smb-errors):
Add "NT_STATUS_REVISION_MISMATCH".
(tramp-smb-handle-delete-directory): Check, that the directory
has been removed indeed.
(tramp-smb-get-localname): Add further checks on filename syntax.
* lisp/net/tramp.el (tramp-localname-regexp): Do not allow linefeeds.
* test/lisp/net/tramp-tests.el (tramp-smb-get-localname): Declare.
(auth-source-save-behavior): Set it to nil.
(tramp-test01-file-name-syntax): Extend, checking for linefeeds.
(tramp-test03-file-name-host-rules, tramp--test-utf8): Refine tests.
(tramp-test03-file-name-method-rules): New test.
(tramp--test-ignore-add-name-to-file-error): New defmacro.
(tramp-test21-file-links): Use it.
Paul Eggert [Tue, 1 May 2018 00:17:11 +0000 (17:17 -0700)]
Port --enable-gcc-warnings to GCC 8
Backport from master.
* lib-src/emacsclient.c (fail):
Do not dereference a null pointer.
* src/frame.c (delete_frame):
Add a decl with UNINIT to work around GCC bug 85563.
* src/menu.h (finish_menu_items):
Do not use attribute const.
* src/regex.c (analyze_first): Use FALLTHROUGH, not a comment.
Stefan Monnier [Mon, 30 Apr 2018 02:25:09 +0000 (22:25 -0400)]
* lisp/net/socks.el: Use lexical-binding and process properties
Remove unneeded requires. Better following commenting conventions.
(socks-connections): Remove (use process properties instead).
(socks-wait-for-state-change): Make it a function.
(open-network-stream): Use an advice when overriding.
(socks-send-command): Avoid string-make-unibyte.
(socks--open-network-stream): New function (extracted from
socks-open-network-stream).
(socks-open-network-stream): Rewrite using it.
Paul Eggert [Sat, 28 Apr 2018 23:49:24 +0000 (16:49 -0700)]
Port --enable-gcc-warnings to GCC 8
* configure.ac: Do not use GCC 8’s new -Wcast-align flag.
* lib-src/ebrowse.c (xmalloc):
* lib-src/emacsclient.c (xmalloc, xstrdup):
* lib-src/etags.c (xmalloc):
* lib-src/make-docfile.c (xmalloc):
* lib-src/movemail.c (xmalloc):
* src/dispnew.c (new_glyph_pool):
* src/regex.c (xmalloc):
* src/term.c (tty_menu_create):
* src/tparam.h (tparam):
Use ATTRIBUTE_MALLOC. Also see GCC bug 85562.
* lib-src/emacsclient.c (fail):
Do not dereference a null pointer.
* src/frame.c (delete_frame):
Add a decl with UNINIT to work around GCC bug 85563.
* src/menu.h (finish_menu_items):
Do not use attribute const.
* src/regex.c (analyze_first): Use FALLTHROUGH, not a comment.
Juri Linkov [Sat, 28 Apr 2018 20:20:33 +0000 (23:20 +0300)]
* lisp/subr.el (dotimes): Deprecate RESULT field. (Bug#16206)
* doc/lispref/control.texi (Iteration):
* doc/misc/cl.texi (Iteration): Document deprecation of its use.
* doc/lispintro/emacs-lisp-intro.texi (dotimes):
* test/src/emacs-module-tests.el (multiply-string):
* test/lisp/filenotify-tests.el (file-notify-test07-many-events):
Place RESULT field after the form.
* lisp/gnus/message.el (message-forward-included-headers): Change
the default to exclude most messages.
(message-remove-ignored-headers): Make
message-forward-included-headers actually work -- it's a list of
regexps, not a list of strings.
Ivan Shmakov [Fri, 23 Mar 2018 03:24:17 +0000 (03:24 +0000)]
Ensure woman2-roff-buffer restores functions on error (Bug#30908)
* lisp/woman.el (woman2-roff-buffer): Put the fallback paragraph
processing inside the protected part of the unwind-protect form,
rather than the cleanup forms. Attempting to format paragraphs again
after an error has been signaled is unlikely to be helpful. The
fallback processing should be triggered only in case the loop
terminated normally, but did not reach the end of the buffer for some
reason.
* lisp/emacs-lisp/cl-print.el (cl-print-object) <cons>: Push each
element of list being printed onto cl-print--currently-printing.
* test/lisp/emacs-lisp/cl-print-tests.el (cl-print-circle-2): New
test.
Paul Eggert [Wed, 25 Apr 2018 19:20:04 +0000 (12:20 -0700)]
Don’t set print-escape-newlines in the minibuffer
This appears to be an unnecessary and possibly-confusing
revenant from ancient code (Bug#31251). See thread containing:
https://lists.gnu.org/r/emacs-devel/2018-04/msg00654.html
* src/minibuf.c (read_minibuf): Do not set print-escape-newlines.
* src/print.c (syms_of_print): Do not defsym print-escape-newlines
or print-escape-control-characters, as these symbols are not used
in C code.