1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00
Commit Graph

2751 Commits

Author SHA1 Message Date
Eli Zaretskii
5af695c747 ; * lib-src/etags.c (print_help): Fix indentation. 2023-03-05 08:43:03 +02:00
Eli Zaretskii
0fde314f6f * lib-src/etags.c (process_file_name): Free malloc'ed vars (bug#61819). 2023-02-26 20:03:20 +02:00
Eli Zaretskii
cae528457c ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
Philipp Stephani
940d9070e9 Support newer glib versions (Bug#59061)
* lib-src/seccomp-filter.c (main): Allow pidfd_open system call
2022-12-09 19:32:14 +01:00
Stefan Kangas
40af27859e ; * lib-src/etags.c (escape_shell_arg_string): Minor doc fix. 2022-12-06 18:05:08 +01:00
Mattias Engdegård
43b7e7efbf Fix etags builds on non-Windows non-MS-DOS machines
* lib-src/etags.c: In this file, MSDOS is always defined but can be
either `true` or `false`, so don't used `defined MSDOS` as a condition.
2022-12-06 17:37:22 +01:00
Eli Zaretskii
7e6d1d1c47 ; Fix last change in etags.c. 2022-12-06 18:13:41 +02:00
lu4nx
01a4035c86 Fix etags local command injection vulnerability
* lib-src/etags.c: (escape_shell_arg_string): New function.
(process_file_name): Use it to quote file names passed to the
shell.  (Bug#59817)
2022-12-06 18:07:45 +02:00
Stefan Kangas
70ecdebc92 ; Fix typos (don't abbreviate "with" or "without") 2022-12-01 16:36:09 +01:00
Po Lu
afc7ed987b Allow be-resources to fail
* lib-src/be_resources.cc (be_perror): Print additional blurb.
(main): Return 0 on failure as well, but print the blurb.
Problem reported by the Haiku packager.
2022-11-29 06:26:16 +00:00
Gregory Heytings
5f97a085be Fix incompatible -t and -r options in emacsclient
* lib-src/emacsclient.c (decode_options): Do not allow -t and -r
together.
2022-11-28 00:16:00 +01:00
Eli Zaretskii
6f0906be51 ; Fix last change in etags.c
* lib-src/etags.c (cleanup_tags_file): Renamed from
clean_matched_file_tag.

* test/manual/etags/CTAGS.good_update:
* test/manual/etags/CTAGS.good_crlf: Update to match the test.
2022-11-27 15:43:39 +02:00
lu4nx
d48bb4874b Fixed ctags local command execute vulnerability
* lib-src/etags.c:

(clean_matched_file_tag): New function
(do_move_file): New function
(readline_internal):
Add `leave_cr` parameter, if true, include the \r character

* test/manual/etags/CTAGS.good_crlf: New file
* test/manual/etags/CTAGS.good_update: New file
* test/manual/etags/crlf: New file
* test/manual/etags/Makefile: Add `ctags -u` test cases
2022-11-27 15:20:49 +02:00
Shohei YOSHIDA
bacba02e5c * lib-src/emacsclient.c (print_help_and_exit): Fix --timeout. 2022-11-27 15:17:40 +02:00
lu4nx
6e82403013 ; Clean up unused function: cuserid
* lib-src/ntlib.c (cuserid): Remove unused function.
2022-11-26 16:28:45 +02:00
lu4nx
325515f979 Support Racket programs in 'etags'
* lib-src/ctags.c (Scheme_suffixes): Add the Racket language
extension ".rkt".

Copyright-paperwork-exempt: yes
2022-11-23 20:31:18 +02:00
Stefan Kangas
5e8c62ffca ; Fix typos 2022-11-23 05:49:22 +01:00
Stefan Kangas
40539c7587 ; Fix typos 2022-11-22 02:24:20 +01:00
Eli Zaretskii
1682bd18f5 Fix encoding and display of messages sent by server to emacsclient
* lisp/server.el (server-start): Use 'locale-coding-system' to
encode messages sent back to the client.

* lib-src/emacsclient.c (main): Print '-error' messages via
'message', not directly via 'fprintf'.  This shows the error on
MS-Windows when the client is invoked as 'emacsclientw', since
stderr goes to the bit bucket in that case.
2022-11-19 21:34:07 +02:00
Jan Stranik
8a6c5be683 Support multi-line C++11 strings in Ebrowse
* lib-src/ebrowse.c (yylex): Support C++11 multi-line strings.
(bug#58847)
2022-11-17 12:07:45 +02:00
Stefan Kangas
5247a72aec * lib-src/rcs2log: Add fallback for $TMPDIR. 2022-10-19 08:02:36 +02:00
Philipp Stephani
92703e00dc Add gettid to seccomp-filter
* lib-src/seccomp-filter.c (main): gettid is necessary on RHEL 9.0
(bug#56359).
2022-10-11 02:52:51 +02:00
Paul Eggert
345de32a5d Port bwrap/allows-stdout test to Ubuntu 22.04.1
Without this patch, Ubuntu 22.04.1 x86-64 "make check" reports a
failure in test/src/emacs-tests.el’s
emacs-tests/bwrap/allows-stdout.  One can reproduce the bug
without using the Emacs executable, by running this script:

  #!/bin/bash
  export LC_ALL=C
  exec strace -f -o /tmp/tr bwrap --ro-bind / / --seccomp 20 -- \
    cat /dev/null 20< lib-src/seccomp-filter-exec.bpf

This script exits with status 159, because "cat" didn’t get
started (it got a SIGSYS signal early on).

The command "journalctl -g SECCOMP" indicated that rseq (syscall
334) was the problem.  This syscall is issued by
/lib64/ld-linux-x86-64.so.2 before ‘main’ is called.

There’s another problem with the clone3 syscall, which is used by
pthread_create starting in glibc 2.34.  pthread_create is called
by g_child_watch_source_new, which is called by
init_process_emacs.

* lib-src/seccomp-filter.c (main): Allow rseq, clone3.  This
causes the test to pass.  Perhaps a fancier, more accurate patch
could be written by someone who has the time.
2022-10-10 12:36:38 -07:00
Paul Eggert
190582adf4 Don’t truncate seccomp-filter diagnostic
* lib-src/seccomp-filter.c (fail): Do not truncate diagnostic
arbitrarily to 1000 bytes when ERROR is nonzero.
2022-10-02 13:47:56 -07:00
Paul Eggert
5598886adc Prefer static_assert to verify in seccomp-filter
Prefer static_assert in just one file for now; the idea is to do
it elsewhere eventually.  static_assert is standard (starting with
C23) whereas verify is not, and static_assert can be used even in
pre-C23 files due to Gnulib’s support for it.
* lib-src/seccomp-filter.c: Do not include verify.h.
Prefer static_assert to verify.
2022-10-02 13:47:56 -07:00
Gregory Heytings
d096819089 Remove hard-coded path to pwd in Makefiles.
* Makefile.in:
* lib-src/Makefile.in:
* nextstep/Makefile.in:
* nt/Makefile.in: Replace hard-coded calls to /bin/pwd by calls
to 'pwd -P'.  Fixes bug#58080.
2022-09-28 16:30:47 +02:00
Paul Eggert
f6fb2b9e1f Port better to C23 bool+true+false keywords
C23 is adding the C++ keywords bool, true, and false;
prefer them to <stdbool.h> if they are available.
* admin/merge-gnulib (GNULIB_MODULES):
Add stdbool, which emulates C23 on pre-C23 platforms.
(AVOIDED_MODULES): Remove stdbool; Gnulib has renamed
this module to stdbool-c99 and nobody uses it so it does
not need to be avoided.
* m4/c-bool.m4: New file, from Gnulib stdbool module.
* lib-src/seccomp-filter.c, src/conf_post.h, src/dynlib.h:
* src/emacs-module.c, src/nsterm.m, src/systhread.h:
* test/src/emacs-module-resources/mod-test.c:
Use the C23 style and use bool without including <stdbool.h>.
The Gnulib stdbool module causes config.h to include stdbool.h
on pre-C23 platforms.
* src/emacs-module.h.in:
Don’t include <stdbool.h> if C23 or later, or if
it has already been included.
2022-09-28 01:09:01 -07:00
Po Lu
a1f1072975 Fix several printfs for 32 bit systems
* lib-src/emacsclient.c (main): Use right length modifier when
printing uintmax_t.
* src/alloc.c (check_pure_size): Use right length modifier when
printing ptrdiff_t.
2022-09-10 09:35:49 +08:00
Stefan Kangas
c6d8db8d91 Display error in emacsclient if setsockopt failed
* lib-src/emacsclient.c (set_tcp_socket, set_socket_timeout): Display
an error message if setsockopt failed.
2022-09-09 11:20:33 +02:00
Stefan Kangas
901d3a2b5d ; Make emacsclient.c more quiet again
* lib-src/emacsclient.c (main): Remove status message after getting a
response from the server.  (Bug#57650)
2022-09-07 23:38:55 +02:00
Stefan Kangas
ca0a8b554a ; * lib-src/emacsclient.c (main): Fix previous change. 2022-09-07 03:00:14 +02:00
Eli Zaretskii
088b81031b Fix the MS-Windows build
* lib-src/emacsclient.c (DEFAULT_TIMEOUT): Move out of the
!WINDOWSNT condition, to fix the MS-Windows compilation.
(set_socket_timeout) [WINDOWSNT]: Protect against too-large values
of timeout.
2022-09-06 15:09:09 +03:00
Stefan Kangas
6a19f2a024 Add new --timeout flag to emacsclient
* lib-src/emacsclient.c (DEFAULT_TIMEOUT): New constant.
(timeout): New static variable.
(longopts, shortopts, decode_options, print_help_and_exit): Add new
flag --timeout.
(set_socket_timeout, check_socket_timeout): New helper functions.
(main): Display a status message or exit after Emacs has not responded
for a while, depending on above new --timeout flag.  (Bug#50849)

* doc/emacs/misc.texi (emacsclient Options):
* doc/man/emacsclient.1: Document the above new option.
* etc/NEWS: Announce it.
2022-09-06 02:05:18 +02:00
Stefan Kangas
cf98a395d0 * lib-src/etags.c: Remove XEmacs support. 2022-08-07 14:50:05 +02:00
Stefan Monnier
9e9b0e13bc Revert "Revert part of 59732a83c8 to fix bug#52969"
This reverts commit 460f35e96d.

Re-remove the code that scans .el files for docstrings, now
that even `lisp/loaddefs.el` is compiled.

* lib-src/make-docfile.c (scan_file): Don't call `scan_lisp_file`.
(scan_lisp_file, skip_white, read_lisp_symbol, search_lisp_doc_at_eol):
Delete functions.
2022-08-03 17:02:25 -04:00
Stefan Kangas
9699eaf8af Merge from origin/emacs-28
db259d8fd3 Build Seccomp filter only if we have a 64-bit userspace (B...
2022-07-16 06:30:39 +02:00
Philipp Stephani
db259d8fd3 Build Seccomp filter only if we have a 64-bit userspace (Bug#56549)
* configure.ac (SIZEOF_LONG): New variable.
* lib-src/Makefile.in (SIZEOF_LONG): New variable; added conditional.
2022-07-15 17:56:02 +02:00
Eli Zaretskii
8a098f6517 Fix quoting of file names in 'ctags'
* lib-src/etags.c (main) [WINDOWSNT || MSDOS]: Quote file names
according to the rules of the system shells.
2022-07-01 16:17:40 +03:00
Eli Zaretskii
8ef3862fa0 Update the 'etags' test suite
* ETAGS.good_1:
* ETAGS_good_2:
* ETAGS_good_3:
* ETAGS_good_4:
* ETAGS_good_5:
* ETAGS_good_6: Adapt to recent changes in test sources.

* lib-src/etags.c (C_entries): Add commentary for resetting
bracelev.  (Bug#45246)
2022-06-09 20:33:43 +03:00
Paul Eggert
a1c19dfca4 Pacify GCC 12 -Wanalyzer-use-of-uninitialized-value
* lib-src/etags.c (readline_internal): Do not copy a pointer to
freed storage, as that has undefined behavior even if the pointer
is not dereferenced.
(relative_filename): Avoid a backward scan by remembering where
the last slash was.  This is a bit faster, and pacifies a GCC
false alarm.
2022-05-31 01:26:47 -07:00
Lars Ingebrigtsen
59951f7af5 Audit quoting symbols in C doc strings
* test/manual/etags/c-src/emacs/src/keyboard.c (Frecursive_edit):
* src/xfns.c (syms_of_xfns):
* src/xdisp.c (Fwindow_text_pixel_size):
(syms_of_xdisp):
* src/w32notify.c (Fw32notify_add_watch):
(Fw32notify_add_watch):
* src/frame.c (Fframe_child_frame_border_width):
* src/comp.c (Fcomp__subr_signature):
* src/alloc.c (Fgarbage_collect):
* lib-src/make-docfile.c (scan_c_stream): Audit quoting symbols in C
doc strings.
2022-05-24 11:51:18 +02:00
Paul Eggert
0f731c49e6 Pacify GCC 12 in default developer build
This lets ‘./configure; make’ work on Fedora 36 x86-64 from a Git
checkout without generating false-alarm warnings.
* lib-src/etags.c (main): There appeared to be false alarm with
GCC 12.  However, the code was wrong anyway, as it mishandled file
names containing "'" so fix that bug.  This pacifies GCC.
(mercury_decl): Omit tests ‘s + pos != NULL’ that were apparently
intended to be ‘s[pos] != '\0'’ but which were miscoded to always
be true and which were mostly not needed anyway.  In one place,
though, a test was needed, so fix that by using strchr instead.
* src/alloc.c (lisp_free) [!GC_MALLOC_CHECK]:
* src/term.c (Fsuspend_tty): Don’t look at a pointer after freeing
it, even just to test it for equality with some other pointer, as
this has undefined behavior in C and GCC 12 diagnoses this.
* src/dbusbind.c (xd_read_message_1): Rework the code a bit
so that it has fewer tests.  This pacifies GCC 12 which was
complaining incorrectly about dereferencing a null pointer.
* src/intervals.c (copy_properties): Remove an eassume that should
no longer be needed even to pacify older GCCs, due to ...
* src/intervals.h (split_interval_left): ... this addition of
ATTRIBUTE_RETURNS_NONNULL to pacify a GCC 12 warning about
dereferencing a null pointer.
* src/regex-emacs.c (EXTEND_BUFFER): Use negative values rather
than auxiliary booleans to indicate null pointers.  This pacifies
GCC 12 false alarms about using uninitialized variables.
* src/xdisp.c (clear_position): New function.
(append_space_for_newline, extend_face_to_end_of_line):
Use it to work around false alarms from GCC 12.
(display_and_set_cursor): Add an UNINIT to pacify GCC 12.
* src/xterm.c (x_draw_glyphless_glyph_string_foreground):
Defend against hypothetical bad code elsewhere;
this also pacifies GCC 12.
(x_term_init): Use fixed-size auto array rather than alloca,
as the array is small; this also pacifies GCC 12.
2022-05-12 17:03:55 -07:00
Paul Eggert
6662079b90 Merge from origin/emacs-28
3cccf0a910 Don’t assume openat
2022-04-17 13:10:19 -07:00
Eli Zaretskii
c2f94f32b5 Revert "Don’t assume openat"
This reverts commit 3cccf0a910.

This is a change with far-reaching effects on MS-Windows at the least,
where file-related APIs are shadowed to support transparent support
for UTF-8 encoded file names.  Making such changes on a stable branch
for the benefit of a proprietary platform with a 13-year old OS is a
tail wagging the dog.  Please don't do that without discussing first.
2022-04-17 22:03:52 +03:00
Paul Eggert
3cccf0a910 Don’t assume openat
Use openat only on platforms with O_PATH.
This ports to OS X 10.9 and earlier.
Problem reported by Keith David Bershatsky in:
https://lists.gnu.org/r/emacs-devel/2022-04/msg00805.html
* lib-src/emacsclient.c (local_sockname): Use open, not openat.
* src/sysdep.c (sys_openat): New static function,
which uses openat only if O_PATH is defined.
(emacs_openat): Use it instead of openat.
(emacs_openat_noquit): Remove.
(emacs_open_noquit): Reimplement as per the old emacs_openat_noquit,
but use plain 'open'.
2022-04-17 10:43:13 -07:00
Paul Eggert
d9bffa1f3b ebrowse dumping need not return int
* lib-src/ebrowse.c (dump_members, dump_tree): Return void, not
int, since callers never actually use returned value.  All uses
changed.
2022-04-08 17:33:15 -07:00
Paul Eggert
ec35e2621a Do not include <attribute.h> from <config.h>
This is because mod-test.c shouldn’t use source code from lib,
but it does need to include <config.h>.
* lib-src/ebrowse.c, lib-src/emacsclient.c, lib-src/etags.c:
* lib-src/make-docfile.c, lib-src/movemail.c:
* lib-src/seccomp-filter.c, src/dynlib.h, src/lisp.h:
* src/syssignal.h, src/sysstdio.h, src/systhread.h, src/tparam.h:
Include <attribute.h>.
* src/conf_post.h: Do not include <attribute.h>.
All uses of attribute.h macros replaced with their _GL_ equivalents.
2022-03-08 18:51:17 -08:00
Stefan Kangas
200627c255 Merge from origin/emacs-28
0090318c61 * lib-src/seccomp-filter.c (main): Use faccessat2 only if ...
3bb01a499b Fix regression in derived-mode-init-mode-variables
2022-03-06 06:32:23 +01:00
Andreas Schwab
0090318c61 * lib-src/seccomp-filter.c (main): Use faccessat2 only if defined. 2022-03-05 14:41:22 +01:00
Stefan Kangas
1319d108da Merge from origin/emacs-28
6d3608be88 Seccomp: improve support for newer versions of glibc (Bug#...
e58ecd01d5 EUDC: Fix a quoting bug in the BBDB backend
2022-01-23 06:30:31 +01:00