commit 27a57f4cca55fd64a61eb8952b6422712f27b0af (HEAD, refs/remotes/origin/master) Author: Po Lu Date: Tue Aug 8 14:05:43 2023 +0800 * src/androidvfs.c (android_saf_file_open): Improve commentary. diff --git a/src/androidvfs.c b/src/androidvfs.c index 0ee555c0ad4..93927ccc86b 100644 --- a/src/androidvfs.c +++ b/src/androidvfs.c @@ -5622,21 +5622,23 @@ android_saf_file_open (struct android_vnode *vnode, int flags, /* Open a parcel file descriptor according to flags. Documentation for the SAF openDocument operation is scant and seldom helpful. - It's clear that their file access modes are inconsistently - implemented, and that at least: + From observations made, it is clear that their file access modes + are inconsistently implemented, and that at least: r = either an FIFO or a real file, without truncation. - w = either an FIFO or a real file, with truncation. + w = either an FIFO or a real file, with OR without truncation. wt = either an FIFO or a real file, with truncation. rw = a real file, without truncation. rwt = a real file, with truncation. This diverges from the self-contradicting documentation, where - openDocument says nothing about truncation, and openFile, where - w can elect not to truncate. + openDocument says nothing about truncation, and openFile mentions + that w can elect not to truncate and programs which rely on + truncation should use wt. Since Emacs is prepared to handle FIFOs within fileio.c, simply - use the straightforward relationships possible. */ + specify the straightforward relationship between FLAGS and the + file access modes listed above. */ method = service_class.open_document; read = trunc = write = false; commit 5e7e7304c3e556e66c7e4157eb2fc80422a9d1be Author: Po Lu Date: Tue Aug 8 14:04:36 2023 +0800 Fix truncation for the Android internal storage provider * java/org/gnu/emacs/EmacsSafThread.java (openDocument1): If truncate is specified while resorting to `w', try truncating the file by hand. diff --git a/java/org/gnu/emacs/EmacsSafThread.java b/java/org/gnu/emacs/EmacsSafThread.java index 9f5d7f3d0cf..421e82c5759 100644 --- a/java/org/gnu/emacs/EmacsSafThread.java +++ b/java/org/gnu/emacs/EmacsSafThread.java @@ -1598,7 +1598,7 @@ In addition, arbitrary runtime exceptions (such as /* Set mode to w when WRITE && !READ, disregarding TRUNCATE. In contradiction with the ContentResolver documentation, document providers seem to truncate files whenever w is - specified, at least superficially. */ + specified, at least superficially. (But see below.) */ mode = "w"; } else @@ -1607,7 +1607,6 @@ In addition, arbitrary runtime exceptions (such as fileDescriptor = resolver.openFileDescriptor (documentUri, mode, signal); - Log.d (TAG, "openDocument1: " + mode + " " + fileDescriptor); /* If a writable on-disk file descriptor is requested and TRUNCATE is set, then probe the file descriptor to detect if it is @@ -1644,6 +1643,12 @@ In addition, arbitrary runtime exceptions (such as if (fileDescriptor != null) EmacsNative.ftruncate (fileDescriptor.getFd ()); } + else if (!read && write && truncate && fileDescriptor != null) + /* Moreover, document providers that return actual seekable + files characteristically neglect to truncate the file + returned when the access mode is merely w, so attempt to + truncate it by hand. */ + EmacsNative.ftruncate (fileDescriptor.getFd ()); /* Every time a document is opened, remove it from the file status cache. */ commit 8cd1681c32dad9f0b674d2e6f55d61e1e025a7b1 Merge: d35ead5bd8a 52ad5dc479e Author: Po Lu Date: Tue Aug 8 13:39:45 2023 +0800 Merge remote-tracking branch 'savannah/master' into master-android-1 commit d35ead5bd8a2630c34a38e02d4689e682b0e1ba9 Author: Po Lu Date: Tue Aug 8 13:39:16 2023 +0800 Utilize more frequently supported file access modes * java/org/gnu/emacs/EmacsSafThread.java (openDocument1): Use plain r or w where possible, as the fileio stuff is now better prepared for FIFOs. (openDocument): New argument READ. * java/org/gnu/emacs/EmacsService.java (openDocument): New argument READ. * src/android.c (android_init_emacs_service): Adjust correspondingly. * src/androidvfs.c (android_saf_file_open): Don't support O_APPEND. Pass read as well as trunc and write. diff --git a/java/org/gnu/emacs/EmacsSafThread.java b/java/org/gnu/emacs/EmacsSafThread.java index 3ae3c0839ce..9f5d7f3d0cf 100644 --- a/java/org/gnu/emacs/EmacsSafThread.java +++ b/java/org/gnu/emacs/EmacsSafThread.java @@ -1565,8 +1565,9 @@ In addition, arbitrary runtime exceptions (such as signal. */ public ParcelFileDescriptor - openDocument1 (String uri, String documentId, boolean write, - boolean truncate, CancellationSignal signal) + openDocument1 (String uri, String documentId, boolean read, + boolean write, boolean truncate, + CancellationSignal signal) throws Throwable { Uri treeUri, documentUri; @@ -1586,10 +1587,19 @@ In addition, arbitrary runtime exceptions (such as if (write) { - if (truncate) - mode = "rwt"; + if (read) + { + if (truncate) + mode = "rwt"; + else + mode = "rw"; + } else - mode = "rw"; + /* Set mode to w when WRITE && !READ, disregarding TRUNCATE. + In contradiction with the ContentResolver documentation, + document providers seem to truncate files whenever w is + specified, at least superficially. */ + mode = "w"; } else mode = "r"; @@ -1597,14 +1607,15 @@ In addition, arbitrary runtime exceptions (such as fileDescriptor = resolver.openFileDescriptor (documentUri, mode, signal); + Log.d (TAG, "openDocument1: " + mode + " " + fileDescriptor); - /* If a writable file descriptor is requested and TRUNCATE is set, - then probe the file descriptor to detect if it is actually - readable. If not, close this file descriptor and reopen it - with MODE set to rw; some document providers granting access to - Samba shares don't implement rwt, but these document providers - invariably truncate the file opened even when the mode is - merely rw. + /* If a writable on-disk file descriptor is requested and TRUNCATE + is set, then probe the file descriptor to detect if it is + actually readable. If not, close this file descriptor and + reopen it with MODE set to rw; some document providers granting + access to Samba shares don't implement rwt, but these document + providers invariably truncate the file opened even when the + mode is merely w. This may be ascribed to a mix-up in Android's documentation regardin DocumentsProvider: the `openDocument' function is only @@ -1612,7 +1623,7 @@ In addition, arbitrary runtime exceptions (such as implementation of the `openFile' function (which documents rwt) delegates to `openDocument'. */ - if (write && truncate && fileDescriptor != null + if (read && write && truncate && fileDescriptor != null && !EmacsNative.ftruncate (fileDescriptor.getFd ())) { try @@ -1647,15 +1658,13 @@ In addition, arbitrary runtime exceptions (such as TRUNCATE and the document already exists, truncate its contents before returning. - On Android 9.0 and earlier, always open the document in - ``read-write'' mode; this instructs the document provider to - return a seekable file that is stored on disk and returns correct - file status. + If READ && WRITE, open the file under either the `rw' or `rwt' + access mode, which implies that the value must be a seekable + on-disk file. If WRITE && !READ or TRUNC && WRITE, also truncate + the file after it is opened. - Under newer versions of Android, open the document in a - non-writable mode if WRITE is false. This is possible because - these versions allow Emacs to explicitly request a seekable - on-disk file. + If only READ or WRITE is set, value may be a non-seekable FIFO or + one end of a socket pair. Value is NULL upon failure or a parcel file descriptor upon success. Call `ParcelFileDescriptor.close' on this file @@ -1667,7 +1676,8 @@ In addition, arbitrary runtime exceptions (such as public ParcelFileDescriptor openDocument (final String uri, final String documentId, - final boolean write, final boolean truncate) + final boolean read, final boolean write, + final boolean truncate) { Object tem; @@ -1677,8 +1687,8 @@ In addition, arbitrary runtime exceptions (such as runObject (CancellationSignal signal) throws Throwable { - return openDocument1 (uri, documentId, write, truncate, - signal); + return openDocument1 (uri, documentId, read, + write, truncate, signal); } }); diff --git a/java/org/gnu/emacs/EmacsService.java b/java/org/gnu/emacs/EmacsService.java index d91d8f66009..14ff2cce98f 100644 --- a/java/org/gnu/emacs/EmacsService.java +++ b/java/org/gnu/emacs/EmacsService.java @@ -1537,15 +1537,13 @@ In addition, arbitrary runtime exceptions (such as TRUNCATE and the document already exists, truncate its contents before returning. - On Android 9.0 and earlier, always open the document in - ``read-write'' mode; this instructs the document provider to - return a seekable file that is stored on disk and returns correct - file status. + If READ && WRITE, open the file under either the `rw' or `rwt' + access mode, which implies that the value must be a seekable + on-disk file. If TRUNC && WRITE, also truncate the file after it + is opened. - Under newer versions of Android, open the document in a - non-writable mode if WRITE is false. This is possible because - these versions allow Emacs to explicitly request a seekable - on-disk file. + If only READ or WRITE is set, value may be a non-seekable FIFO or + one end of a socket pair. Value is NULL upon failure or a parcel file descriptor upon success. Call `ParcelFileDescriptor.close' on this file @@ -1555,8 +1553,8 @@ In addition, arbitrary runtime exceptions (such as UnsupportedOperationException may be thrown upon failure. */ public ParcelFileDescriptor - openDocument (String uri, String documentId, boolean write, - boolean truncate) + openDocument (String uri, String documentId, + boolean read, boolean write, boolean truncate) { /* Start the thread used to run SAF requests if it isn't already running. */ @@ -1567,7 +1565,7 @@ In addition, arbitrary runtime exceptions (such as storageThread.start (); } - return storageThread.openDocument (uri, documentId, write, + return storageThread.openDocument (uri, documentId, read, write, truncate); } diff --git a/src/android.c b/src/android.c index bd19107f53a..7f263bc83d1 100644 --- a/src/android.c +++ b/src/android.c @@ -1574,7 +1574,7 @@ #define FIND_METHOD(c_name, name, signature) \ "(Landroid/database/Cursor;)Lorg/gnu/emacs/" "EmacsDirectoryEntry;"); FIND_METHOD (open_document, "openDocument", - "(Ljava/lang/String;Ljava/lang/String;ZZ)" + "(Ljava/lang/String;Ljava/lang/String;ZZZ)" "Landroid/os/ParcelFileDescriptor;"); FIND_METHOD (create_document, "createDocument", "(Ljava/lang/String;Ljava/lang/String;" diff --git a/src/androidvfs.c b/src/androidvfs.c index 4234e337acb..0ee555c0ad4 100644 --- a/src/androidvfs.c +++ b/src/androidvfs.c @@ -5590,7 +5590,7 @@ android_saf_file_open (struct android_vnode *vnode, int flags, struct android_saf_file_vnode *vp; jobject uri, id, descriptor; jmethodID method; - jboolean trunc, write; + jboolean read, trunc, write; jint fd; struct android_parcel_fd *info; struct stat statb; @@ -5601,6 +5601,15 @@ android_saf_file_open (struct android_vnode *vnode, int flags, return -1; } + /* O_APPEND isn't supported as a consequence of Android content + providers defaulting to truncating the file. */ + + if (flags & O_APPEND) + { + errno = EOPNOTSUPP; + return -1; + } + /* Build strings for both the URI and ID. */ vp = (struct android_saf_file_vnode *) vnode; @@ -5611,18 +5620,43 @@ android_saf_file_open (struct android_vnode *vnode, int flags, vp->document_id); android_exception_check_1 (uri); - /* Open a parcel file descriptor according to flags. */ + /* Open a parcel file descriptor according to flags. Documentation + for the SAF openDocument operation is scant and seldom helpful. + It's clear that their file access modes are inconsistently + implemented, and that at least: + + r = either an FIFO or a real file, without truncation. + w = either an FIFO or a real file, with truncation. + wt = either an FIFO or a real file, with truncation. + rw = a real file, without truncation. + rwt = a real file, with truncation. + + This diverges from the self-contradicting documentation, where + openDocument says nothing about truncation, and openFile, where + w can elect not to truncate. + + Since Emacs is prepared to handle FIFOs within fileio.c, simply + use the straightforward relationships possible. */ method = service_class.open_document; - trunc = (flags & O_TRUNC); - write = (((flags & O_RDWR) == O_RDWR) || (flags & O_WRONLY)); + read = trunc = write = false; + + if ((flags & O_RDWR) == O_RDWR || (flags & O_WRONLY)) + write = true; + + if (flags & O_TRUNC) + trunc = true; + + if ((flags & O_RDWR) == O_RDWR || !write) + read = true; + inside_saf_critical_section = true; descriptor = (*android_java_env)->CallNonvirtualObjectMethod (android_java_env, emacs_service, service_class.class, method, uri, id, - write, trunc); + read, write, trunc); inside_saf_critical_section = false; if (android_saf_exception_check (2, uri, id)) @@ -6448,6 +6482,8 @@ android_vfs_init (JNIEnv *env, jobject manager) vnodes may not be reentrant, but operating on them from within an async input handler will at worst cause an error to be returned. + The eight is that some vnode types do not support O_APPEND. + And the final drawback is that directories cannot be directly opened. Instead, `dirfd' must be called on a directory stream used by `openat'. commit 3fb2c174d3a73ee5a2670b438538a5c32ad9d7ac Author: Po Lu Date: Tue Aug 8 13:37:00 2023 +0800 Enable visiting FIFOs as files * doc/lispref/files.texi (Reading from Files): Document new `if-regular' value of REPLACE. * etc/NEWS: Announce the new value. * lisp/files.el (basic-save-buffer-2): Demote errors saving backup files, since FIFOs cannot be copied. (revert-buffer-insert-file-contents--default-function): Supply `if-regular' instead of t as REPLACE. * src/fileio.c (selinux_enabled_p): New function. (Fcopy_file, Ffile_selinux_context, Fset_file_selinux_context): Call that function to ascertain if SELinux applies to a file. (read_non_regular): Don't assume `emacs_fd_read' always returns int. (Finsert_file_contents): If REPLACE is if-regular and FILENAME is a special non-seekable file, fall back to erasing the buffer before inserting the contents of that file. (syms_of_fileio) : New symbol. diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index aaab4e455a0..afedf776c86 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -582,11 +582,12 @@ Reading from Files marker positions and (2) it puts less data in the undo list. It is possible to read a special file (such as a FIFO or an I/O -device) with @code{insert-file-contents}, as long as @var{replace}, -and @var{visit} and @var{beg} are @code{nil}. However, you should -normally use an @var{end} argument for these files to avoid inserting -(potentially) unlimited data into the buffer (for instance, when -inserting data from @file{/dev/urandom}). +device) with @code{insert-file-contents}, as long as @var{replace} is +@code{nil} or @code{if-regular}, and @var{visit} and @var{beg} are +@code{nil}. However, you should normally use an @var{end} argument +for these files to avoid inserting (potentially) unlimited data into +the buffer (for instance, when inserting data from +@file{/dev/urandom}). @end defun @defun insert-file-contents-literally filename &optional visit beg end replace diff --git a/etc/NEWS b/etc/NEWS index 6cdeeacc158..ee1ce72db98 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -743,6 +743,12 @@ The compatibility aliases 'x-defined-colors', 'x-color-defined-p', See (info "(elisp)Porting Old Advice") for help converting them to use `advice-add` or `define-advice instead. ++++ +** New value 'if-regular' for the REPLACE argument to 'insert-file-contents'. +It results in 'insert-file-contents' erasing the buffer instead of +preserving markers if the file being inserted is not a regular file, +rather than signaling an error. + +++ ** New variable 'current-key-remap-sequence'. It is bound to the key sequence that caused a call to a function bound diff --git a/lisp/files.el b/lisp/files.el index 58014665fbc..685eb5fc957 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -5871,8 +5871,10 @@ basic-save-buffer-2 buffer-file-name))) (setq tempsetmodes t) (error "Attempt to save to a file that you aren't allowed to write")))))) - (or buffer-backed-up - (setq setmodes (backup-buffer))) + (with-demoted-errors + "Backing up buffer: %s" + (or buffer-backed-up + (setq setmodes (backup-buffer)))) (let* ((dir (file-name-directory buffer-file-name)) (dir-writable (file-writable-p dir))) (if (or (and file-precious-flag dir-writable) @@ -6894,9 +6896,9 @@ revert-buffer-insert-file-contents--default-function (if revert-buffer-preserve-modes (let ((buffer-file-format buffer-file-format)) (insert-file-contents file-name (not auto-save-p) - nil nil t)) + nil nil 'if-regular)) (insert-file-contents file-name (not auto-save-p) - nil nil t)))))) + nil nil 'if-regular)))))) (defvar revert-buffer-with-fine-grain-max-seconds 2.0 "Maximum time that `revert-buffer-with-fine-grain' should use. diff --git a/src/fileio.c b/src/fileio.c index b5c3add836e..26b7e193f0a 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -200,6 +200,25 @@ check_vfs_filename (Lisp_Object encoded, const char *reason) #endif /* defined HAVE_ANDROID && !defined ANDROID_STUBIFY */ } +#ifdef HAVE_LIBSELINUX + +/* Return whether SELinux is enabled and pertinent to FILE. Provide + for cases where FILE is or is a constitutent of a special + directory, such as /assets or /content on Android. */ + +static bool +selinux_enabled_p (const char *file) +{ + return (is_selinux_enabled () +#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY + && !android_is_special_directory (file, "/assets") + && !android_is_special_directory (file, "/content") +#endif /* defined HAVE_ANDROID && !defined ANDROID_STUBIFY */ + ); +} + +#endif /* HAVE_LIBSELINUX */ + /* Test whether FILE is accessible for AMODE. Return true if successful, false (setting errno) otherwise. */ @@ -2311,7 +2330,7 @@ DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 6, if (!NILP (preserve_permissions)) { #if HAVE_LIBSELINUX - if (is_selinux_enabled () + if (selinux_enabled_p (SSDATA (encoded_file)) && emacs_fd_to_int (ifd) != -1) { conlength = fgetfilecon (emacs_fd_to_int (ifd), @@ -2319,7 +2338,7 @@ DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 6, if (conlength == -1) report_file_error ("Doing fgetfilecon", file); } -#endif +#endif /* HAVE_LIBSELINUX */ } /* We can copy only regular files. */ @@ -3353,6 +3372,7 @@ Return (nil nil nil nil) if the file is nonexistent, { Lisp_Object user = Qnil, role = Qnil, type = Qnil, range = Qnil; Lisp_Object absname = expand_and_dir_to_file (filename); + const char *file; /* If the file name has special constructs in it, call the corresponding file name handler. */ @@ -3361,11 +3381,13 @@ Return (nil nil nil nil) if the file is nonexistent, if (!NILP (handler)) return call2 (handler, Qfile_selinux_context, absname); + file = SSDATA (ENCODE_FILE (absname)); + #if HAVE_LIBSELINUX - if (is_selinux_enabled ()) + if (selinux_enabled_p (file)) { char *con; - int conlength = lgetfilecon (SSDATA (ENCODE_FILE (absname)), &con); + int conlength = lgetfilecon (file, &con); if (conlength > 0) { context_t context = context_new (con); @@ -3384,7 +3406,7 @@ Return (nil nil nil nil) if the file is nonexistent, || errno == ENOTSUP)) report_file_error ("getting SELinux context", absname); } -#endif +#endif /* HAVE_LIBSELINUX */ return list4 (user, role, type, range); } @@ -3410,10 +3432,11 @@ DEFUN ("set-file-selinux-context", Fset_file_selinux_context, Lisp_Object type = CAR_SAFE (CDR_SAFE (CDR_SAFE (context))); Lisp_Object range = CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (context)))); char *con; + const char *name; bool fail; int conlength; context_t parsed_con; -#endif +#endif /* HAVE_LIBSELINUX */ absname = Fexpand_file_name (filename, BVAR (current_buffer, directory)); @@ -3424,11 +3447,13 @@ DEFUN ("set-file-selinux-context", Fset_file_selinux_context, return call3 (handler, Qset_file_selinux_context, absname, context); #if HAVE_LIBSELINUX - if (is_selinux_enabled ()) + encoded_absname = ENCODE_FILE (absname); + name = SSDATA (encoded_absname); + + if (selinux_enabled_p (name)) { /* Get current file context. */ - encoded_absname = ENCODE_FILE (absname); - conlength = lgetfilecon (SSDATA (encoded_absname), &con); + conlength = lgetfilecon (name, &con); if (conlength > 0) { parsed_con = context_new (con); @@ -3469,7 +3494,7 @@ DEFUN ("set-file-selinux-context", Fset_file_selinux_context, else report_file_error ("Doing lgetfilecon", absname); } -#endif +#endif /* HAVE_LIBSELINUX */ return Qnil; } @@ -3860,11 +3885,12 @@ verify (GCALIGNED (union read_non_regular)); read_non_regular (Lisp_Object state) { union read_non_regular *data = XFIXNUMPTR (state); - int nbytes = emacs_fd_read (data->s.fd, - ((char *) BEG_ADDR + PT_BYTE - BEG_BYTE - + data->s.inserted), - data->s.trytry); - return make_fixnum (nbytes); + intmax_t nbytes + = emacs_fd_read (data->s.fd, + ((char *) BEG_ADDR + PT_BYTE - BEG_BYTE + + data->s.inserted), + data->s.trytry); + return make_int (nbytes); } @@ -4002,13 +4028,19 @@ because (1) it preserves some marker positions (in unchanged portions undo list. When REPLACE is non-nil, the second return value is the number of characters that replace previous buffer contents. +If REPLACE is the symbol `if-regular', then eschew preserving marker +positions or the undo list if REPLACE is nil if FILENAME is not a +regular file. Otherwise, signal an error if REPLACE is non-nil and +FILENAME is not a regular file. + This function does code conversion according to the value of `coding-system-for-read' or `file-coding-system-alist', and sets the variable `last-coding-system-used' to the coding system actually used. In addition, this function decodes the inserted text from known formats by calling `format-decode', which see. */) - (Lisp_Object filename, Lisp_Object visit, Lisp_Object beg, Lisp_Object end, Lisp_Object replace) + (Lisp_Object filename, Lisp_Object visit, Lisp_Object beg, Lisp_Object end, + Lisp_Object replace) { struct stat st; struct timespec mtime; @@ -4123,24 +4155,27 @@ because (1) it preserves some marker positions (in unchanged portions report_file_error ("Input file status", orig_filename); mtime = get_stat_mtime (&st); - /* This code will need to be changed in order to work on named - pipes, and it's probably just not worth it. So we should at - least signal an error. */ + /* The REPLACE code will need to be changed in order to work on + named pipes, and it's probably just not worth it. So we should + at least signal an error. */ + if (!S_ISREG (st.st_mode)) { regular = false; - if (! NILP (visit)) - { - eassert (inserted == 0); - goto notfound; - } - if (!NILP (replace)) - xsignal2 (Qfile_error, - build_string ("not a regular file"), orig_filename); + { + if (!EQ (replace, Qif_regular)) + xsignal2 (Qfile_error, + build_string ("not a regular file"), orig_filename); + else + /* Set REPLACE to Qunbound, indicating that we are trying + to replace the buffer contents with that of a + non-regular file. */ + replace = Qunbound; + } - seekable = emacs_fd_lseek (fd, 0, SEEK_CUR) < 0; + seekable = emacs_fd_lseek (fd, 0, SEEK_CUR) != (off_t) -1; if (!NILP (beg) && !seekable) xsignal2 (Qfile_error, build_string ("cannot use a start position in a non-seekable file/device"), @@ -4316,7 +4351,8 @@ because (1) it preserves some marker positions (in unchanged portions method and hope for the best. But if we discover the need for conversion, we give up on this method and let the following if-statement handle the replace job. */ - if (!NILP (replace) + if ((!NILP (replace) + && !BASE_EQ (replace, Qunbound)) && BEGV < ZV && (NILP (coding_system) || ! CODING_REQUIRE_DECODING (&coding))) @@ -4503,7 +4539,9 @@ because (1) it preserves some marker positions (in unchanged portions is needed, in a simple way that needs a lot of memory. The preceding if-statement handles the case of no conversion in a more optimized way. */ - if (!NILP (replace) && ! replace_handled && BEGV < ZV) + if ((!NILP (replace) + && !BASE_EQ (replace, Qunbound)) + && ! replace_handled && BEGV < ZV) { ptrdiff_t same_at_start_charpos; ptrdiff_t inserted_chars; @@ -4688,6 +4726,12 @@ because (1) it preserves some marker positions (in unchanged portions prepare_to_modify_buffer (PT, PT, NULL); } + /* If REPLACE is Qunbound, buffer contents are being replaced with + text read from a FIFO. Erase the entire buffer. */ + + if (BASE_EQ (replace, Qunbound)) + del_range (BEG, Z); + move_gap_both (PT, PT_BYTE); /* Ensure the gap is at least one byte larger than needed for the @@ -4696,7 +4740,8 @@ because (1) it preserves some marker positions (in unchanged portions if (GAP_SIZE <= total) make_gap (total - GAP_SIZE + 1); - if (beg_offset != 0 || !NILP (replace)) + if (beg_offset != 0 || (!NILP (replace) + && !EQ (replace, Qunbound))) { if (emacs_fd_lseek (fd, beg_offset, SEEK_SET) < 0) report_file_error ("Setting file position", orig_filename); @@ -4729,6 +4774,7 @@ because (1) it preserves some marker positions (in unchanged portions if (!seekable && NILP (end)) { Lisp_Object nbytes; + intmax_t number; /* Read from the file, capturing `quit'. When an error occurs, end the loop, and arrange for a quit @@ -4744,18 +4790,20 @@ because (1) it preserves some marker positions (in unchanged portions break; } - this = XFIXNUM (nbytes); + if (!integer_to_intmax (nbytes, &number) + && number > PTRDIFF_MAX) + buffer_overflow (); + + this = number; } else - { - /* Allow quitting out of the actual I/O. We don't make text - part of the buffer until all the reading is done, so a C-g - here doesn't do any harm. */ - this = emacs_fd_read (fd, - ((char *) BEG_ADDR + PT_BYTE - BEG_BYTE - + inserted), - trytry); - } + /* Allow quitting out of the actual I/O. We don't make text + part of the buffer until all the reading is done, so a + C-g here doesn't do any harm. */ + this = emacs_fd_read (fd, + ((char *) BEG_ADDR + PT_BYTE - BEG_BYTE + + inserted), + trytry); if (this <= 0) { @@ -4940,9 +4988,14 @@ because (1) it preserves some marker positions (in unchanged portions Funlock_file (BVAR (current_buffer, file_truename)); Funlock_file (filename); } + +#if !defined HAVE_ANDROID || defined ANDROID_STUBIFY + /* Under Android, modtime and st.st_size can be valid even if FD + is not a regular file. */ if (!regular) xsignal2 (Qfile_error, build_string ("not a regular file"), orig_filename); +#endif /* !defined HAVE_ANDROID || defined ANDROID_STUBIFY */ } if (set_coding_system) @@ -6810,9 +6863,11 @@ do (file-exists-p FILENAME) and FILENAME is handled by HANDLER, then #ifndef DOS_NT defsubr (&Sfile_system_info); -#endif +#endif /* DOS_NT */ #ifdef HAVE_SYNC defsubr (&Sunix_sync); -#endif +#endif /* HAVE_SYNC */ + + DEFSYM (Qif_regular, "if-regular"); } commit 52ad5dc479eb70b553e84e487d044427c210a7e4 Author: Stefan Kangas Date: Tue Aug 8 06:11:51 2023 +0200 Add calling convention to x-compose-font-name * lisp/international/fontset.el (x-compose-font-name): Add advertised-calling-convention for argument ignored since 22.1. diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el index 27d7f509752..d879920b1d0 100644 --- a/lisp/international/fontset.el +++ b/lisp/international/fontset.el @@ -1274,9 +1274,8 @@ x-decompose-font-name (defun x-compose-font-name (fields &optional _reduce) "Compose X fontname from FIELDS. FIELDS is a vector of XLFD fields, of length 12. -If a field is nil, wild-card letter `*' is embedded. -Optional argument REDUCE exists just for backward compatibility, -and is always ignored." +If a field is nil, wild-card letter `*' is embedded." + (declare (advertised-calling-convention (fields) "30.1")) (concat "-" (mapconcat (lambda (x) (or x "*")) fields "-"))) commit 44e919adb69ad9146003c9328868b5989f8c52d5 Author: Stefan Kangas Date: Tue Aug 8 05:52:31 2023 +0200 Make x-font-name-charset-alist obsolete * lisp/international/fontset.el (x-font-name-charset-alist): Make obsolete. It has been a no-op since Emacs 22. diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el index bbb1993ba3c..27d7f509752 100644 --- a/lisp/international/fontset.el +++ b/lisp/international/fontset.el @@ -1207,7 +1207,8 @@ vertical-centering-font-regexp (list (cons (purecopy "-cdac$") 1.3))) (defvar x-font-name-charset-alist nil - "This variable has no meaning now. Just kept for backward compatibility.") + "This variable has no meaning starting with Emacs 22.1.") +(make-obsolete-variable 'x-font-name-charset-alist nil "30.1") ;;; XLFD (X Logical Font Description) format handler. commit 85b6c150c8a356ebf3442fde2836364954aa938c Author: Paul Eggert Date: Mon Aug 7 21:23:28 2023 -0700 Fix some emacs_fopen confusion Problem reported by Po Lu in: https://lists.gnu.org/r/emacs-devel/2023-08/msg00195.html * src/comp.c (comp_hash_source_file, Fcomp__release_ctxt): * src/sysdep.c (get_up_time, procfs_ttyname, procfs_get_total_memory): Be more systematic about using emacs_fclose on streams that were opened with emacs_fopen or emacs_fdopen. Do this even if not Android, as this simplifies checking that it's done consistently. * src/lisp.h (emacs_fclose): If it’s just fclose, make it a macro rather than a function, to avoid confusing gcc -Wmismatched-dealloc. (emacs_fopen): Move decl here from sysstdio.h, because sysstdio.h is included from non-Emacs executables and emacs_fopen is good only inside Emacs. * src/sysdep.c (emacs_fclose): Define as a function only if Android. diff --git a/src/comp.c b/src/comp.c index 1bde4ae5821..b81a80b00f8 100644 --- a/src/comp.c +++ b/src/comp.c @@ -776,7 +776,7 @@ comp_hash_source_file (Lisp_Object filename) #else int res = md5_stream (f, SSDATA (digest)); #endif - fclose (f); + emacs_fclose (f); if (res) xsignal2 (Qfile_notify_error, build_string ("hashing failed"), filename); @@ -4749,7 +4749,7 @@ DEFUN ("comp--release-ctxt", Fcomp__release_ctxt, Scomp__release_ctxt, gcc_jit_context_release (comp.ctxt); if (logfile) - fclose (logfile); + emacs_fclose (logfile); comp.ctxt = NULL; return Qt; diff --git a/src/lisp.h b/src/lisp.h index 85de57b0b2f..2f26e5eddce 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -5086,9 +5086,15 @@ maybe_disable_address_randomization (int argc, char **argv) extern int emacs_open_noquit (const char *, int, int); extern int emacs_pipe (int[2]); extern int emacs_close (int); +#if !(defined HAVE_ANDROID && !defined ANDROID_STUBIFY) +# define emacs_fclose fclose +#else extern int emacs_fclose (FILE *); +#endif extern FILE *emacs_fdopen (int, const char *) ATTRIBUTE_MALLOC ATTRIBUTE_DEALLOC (emacs_fclose, 1); +extern FILE *emacs_fopen (char const *, char const *) + ATTRIBUTE_MALLOC ATTRIBUTE_DEALLOC (emacs_fclose, 1); extern int emacs_unlink (const char *); extern int emacs_symlink (const char *, const char *); extern int emacs_rmdir (const char *); diff --git a/src/sysdep.c b/src/sysdep.c index a995bc66741..0f8b70c8248 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -2644,15 +2644,13 @@ emacs_fdopen (int fd, const char *mode) clear information associated with the FILE's file descriptor if necessary. */ +#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY int emacs_fclose (FILE *stream) { -#if !(defined HAVE_ANDROID && !defined ANDROID_STUBIFY) - return fclose (stream); -#else return android_fclose (stream); -#endif } +#endif /* Wrappers around unlink, symlink, rename, renameat_noreplace, and rmdir. These operations handle asset and content directories on @@ -3492,7 +3490,7 @@ get_up_time (void) Lisp_Object subsec = Fcons (make_fixnum (upfrac), make_fixnum (hz)); up = Ftime_add (sec, subsec); } - fclose (fup); + emacs_fclose (fup); } unblock_input (); @@ -3540,7 +3538,7 @@ procfs_ttyname (int rdev) } } } - fclose (fdev); + emacs_fclose (fdev); } unblock_input (); return build_string (name); @@ -3582,7 +3580,7 @@ procfs_get_total_memory (void) } while (!done); - fclose (fmem); + emacs_fclose (fmem); } unblock_input (); return retval; diff --git a/src/sysstdio.h b/src/sysstdio.h index 5a973c833cc..8e9e5bec86c 100644 --- a/src/sysstdio.h +++ b/src/sysstdio.h @@ -28,8 +28,6 @@ #define EMACS_SYSSTDIO_H #include #include -extern FILE *emacs_fopen (char const *, char const *) - ATTRIBUTE_MALLOC ATTRIBUTE_DEALLOC (fclose, 1); extern void errputc (int); extern void errwrite (void const *, ptrdiff_t); extern void close_output_streams (void); commit a579739e2b3f3c7218b14a7e41b78e7ddbded06c Author: Stefan Kangas Date: Tue Aug 8 04:53:08 2023 +0200 Make XEmacs compat aliases for timers obsolete * lisp/emacs-lisp/timer.el (disable-timeout, add-timeout): Make XEmacs compat aliases obsolete. Update all callers. diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index 7544279d8aa..468c46519fd 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -1,6 +1,6 @@ ;;; timer.el --- run a function with args at some time in future -*- lexical-binding: t -*- -;; Copyright (C) 1996, 2001-2023 Free Software Foundation, Inc. +;; Copyright (C) 1996-2023 Free Software Foundation, Inc. ;; Maintainer: emacs-devel@gnu.org ;; Package: emacs @@ -226,8 +226,6 @@ timer-activate-when-idle timer will fire right away." (timer--activate timer (not dont-wait) reuse-cell 'idle)) -(defalias 'disable-timeout #'cancel-timer) - (defun cancel-timer (timer) "Remove TIMER from the list of active timers." (timer--check timer) @@ -348,7 +346,6 @@ timer-event-handler (memq timer timer-list)) (setf (timer--triggered timer) nil)))))) -;; This function is incompatible with the one in levents.el. (defun timeout-event-p (event) "Non-nil if EVENT is a timeout event." (and (listp event) (eq (car event) 'timer-event))) @@ -448,6 +445,7 @@ add-timeout This function returns a timer object which you can use in `cancel-timer'. This function is for compatibility; see also `run-with-timer'." + (declare (obsolete run-with-timer "30.1")) (run-with-timer secs repeat function object)) (defun run-with-idle-timer (secs repeat function &rest args) @@ -580,6 +578,9 @@ internal-timer-start-idle (dolist (timer timer-idle-list) (if (timerp timer) ;; FIXME: Why test? (setf (timer--triggered timer) nil)))) + +(define-obsolete-function-alias 'disable-timeout #'cancel-timer "30.1") + (provide 'timer) diff --git a/lisp/tooltip.el b/lisp/tooltip.el index 8d92caed08e..0881a7c7bf9 100644 --- a/lisp/tooltip.el +++ b/lisp/tooltip.el @@ -194,13 +194,13 @@ tooltip-delay (defun tooltip-cancel-delayed-tip () "Disable the tooltip timeout." (when tooltip-timeout-id - (disable-timeout tooltip-timeout-id) + (cancel-timer tooltip-timeout-id) (setq tooltip-timeout-id nil))) (defun tooltip-start-delayed-tip () "Add a one-shot timeout to call function `tooltip-timeout'." (setq tooltip-timeout-id - (add-timeout (tooltip-delay) 'tooltip-timeout nil))) + (run-with-timer (tooltip-delay) 'tooltip-timeout nil))) (defun tooltip-timeout (_object) "Function called when timer with id `tooltip-timeout-id' fires." commit 301e6a747acc31f9bcc5b7c2429dbcfa806d48f5 Author: Jim Porter Date: Sun Aug 6 13:34:18 2023 -0700 Fix listing of directory contents after "cd" in Eshell * lisp/eshell/em-dirs.el (eshell/cd): Ensure we don't close the I/O handles prematurely. Additionally, don't clobber the "cd" command's last-command info. * test/lisp/eshell/em-dirs-tests.el (em-dirs-test/cd): (em-dirs-test/cd/list-files-after-cd): New tests (bug#65110). diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el index 5284df9ab59..640d3676750 100644 --- a/lisp/eshell/em-dirs.el +++ b/lisp/eshell/em-dirs.el @@ -429,9 +429,13 @@ eshell/cd (and eshell-cd-shows-directory (eshell-printn result))) (run-hooks 'eshell-directory-change-hook) - (if eshell-list-files-after-cd - ;; Let-bind eshell-last-command around this? - (eshell-plain-command "ls" (cdr args))) + (when eshell-list-files-after-cd + ;; Call "ls", but don't update the last-command information. + (let ((eshell-last-command-name) + (eshell-last-command-status) + (eshell-last-arguments)) + (eshell-protect + (eshell-plain-command "ls" (cdr args))))) nil)))) (put 'eshell/cd 'eshell-no-numeric-conversions t) diff --git a/test/lisp/eshell/em-dirs-tests.el b/test/lisp/eshell/em-dirs-tests.el index d30b3d7d73f..9864b72ba78 100644 --- a/test/lisp/eshell/em-dirs-tests.el +++ b/test/lisp/eshell/em-dirs-tests.el @@ -99,4 +99,27 @@ em-dirs-test/directory-ring-var-indices (eshell-match-command-output "echo $-[1][/ 1 3]" "(\"some\" \"here\")\n")))) +(ert-deftest em-dirs-test/cd () + "Test that changing directories with `cd' works." + (ert-with-temp-directory tmpdir + (write-region "text" nil (expand-file-name "file.txt" tmpdir)) + (with-temp-eshell + (eshell-match-command-output (format "cd '%s'" tmpdir) + "\\`\\'") + (should (equal default-directory tmpdir))))) + +(ert-deftest em-dirs-test/cd/list-files-after-cd () + "Test that listing files after `cd' works." + (let ((eshell-list-files-after-cd t)) + (ert-with-temp-directory tmpdir + (write-region "text" nil (expand-file-name "file.txt" tmpdir)) + (with-temp-eshell + (eshell-match-command-output (format "cd '%s'" tmpdir) + "file.txt\n") + (should (equal default-directory tmpdir)) + ;; Make sure we didn't update the last-command information when + ;; running "ls". + (should (equal eshell-last-command-name "#")) + (should (equal eshell-last-arguments (list tmpdir))))))) + ;; em-dirs-tests.el ends here commit b48793253b2e6ed89f6643b72253ed6c827c289a Author: Stefan Kangas Date: Tue Aug 8 04:03:17 2023 +0200 Make Emacs 21 compat aliases easy-mmode-* obsolete * lisp/emacs-lisp/easy-mmode.el (easy-mmode-define-minor-mode) (easy-mmode-define-global-mode): Make Emacs 21 compatibility aliases obsolete. * doc/lispref/loading.texi (Autoload): * doc/lispref/modes.texi (Defining Minor Modes): Don't document above obsolete aliases. diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi index d6fc4e8d636..125011c780f 100644 --- a/doc/lispref/loading.texi +++ b/doc/lispref/loading.texi @@ -660,9 +660,7 @@ Autoload @item Definitions for major or minor modes: @code{define-minor-mode}, @code{define-globalized-minor-mode}, @code{define-generic-mode}, @code{define-derived-mode}, -@code{easy-mmode-define-minor-mode}, -@code{easy-mmode-define-global-mode}, @code{define-compilation-mode}, -and @code{define-global-minor-mode}. +@code{define-compilation-mode}, and @code{define-global-minor-mode}. @item Other definition types: @code{defcustom}, @code{defgroup}, @code{deftheme}, @code{defclass} diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index b4f69e79155..00148420893 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -1794,10 +1794,6 @@ Defining Minor Modes harmless. But these are unusual circumstances. Normally, the initial value must be @code{nil}. -@findex easy-mmode-define-minor-mode - The name @code{easy-mmode-define-minor-mode} is an alias -for this macro. - Here is an example of using @code{define-minor-mode}: @smallexample diff --git a/etc/NEWS b/etc/NEWS index 6cdeeacc158..16dd7d5f791 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -736,6 +736,10 @@ provokes an error if used numerically. The compatibility aliases 'x-defined-colors', 'x-color-defined-p', 'x-color-values', and 'x-display-color-p' are now obsolete. ++++ +** 'easy-mmode-define-{minor-mode,global-mode}' aliases are now obsolete. +Use 'define-minor-mode' and 'define-globalized-minor-mode' instead. + * Lisp Changes in Emacs 30.1 diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 20681374ee3..529f6e90e88 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -142,8 +142,6 @@ easy-mmode--mode-docstring (insert (format "\\{%s}" keymap-sym))) (buffer-string))))) -;;;###autoload -(defalias 'easy-mmode-define-minor-mode #'define-minor-mode) ;;;###autoload (defmacro define-minor-mode (mode doc &rest body) "Define a new minor mode MODE. @@ -442,8 +440,6 @@ define-minor-mode ;;; make global minor mode ;;; -;;;###autoload -(defalias 'easy-mmode-define-global-mode #'define-globalized-minor-mode) ;;;###autoload (defalias 'define-global-minor-mode #'define-globalized-minor-mode) ;;;###autoload @@ -841,6 +837,12 @@ easy-mmode-define-navigation ,@body)) (put ',prev-sym 'definition-name ',base)))) +;; When deleting these two, also delete them from loaddefs-gen.el. +;;;###autoload +(define-obsolete-function-alias 'easy-mmode-define-minor-mode #'define-minor-mode "30.1") +;;;###autoload +(define-obsolete-function-alias 'easy-mmode-define-global-mode #'define-globalized-minor-mode "30.1") + (provide 'easy-mmode) ;;; easy-mmode.el ends here commit 3eedcf6ee9d5e0429847d56f7094cffd6b20648f Author: Stefan Kangas Date: Tue Aug 8 03:45:19 2023 +0200 Make describe-keymap tests more robust * test/lisp/help-fns-tests.el (help-fns-test-describe-keymap/symbol) (help-fns-test-describe-keymap/value) (help-fns-test-describe-keymap/not-keymap) (help-fns-test-describe-keymap/let-bound) (help-fns-test-describe-keymap/dynamically-bound-no-file): Make tests independent of minibuffer-local-must-match-map. diff --git a/test/lisp/help-fns-tests.el b/test/lisp/help-fns-tests.el index 243a45ae6d2..56c521e765e 100644 --- a/test/lisp/help-fns-tests.el +++ b/test/lisp/help-fns-tests.el @@ -132,6 +132,12 @@ help-fns-test--describe-keymap-foo ;;; Tests for describe-keymap + +(defvar-keymap help-fns-test-map + "a" 'test-cmd-a + "b" 'test-cmd-b + "c" 'test-cmd-c) + (ert-deftest help-fns-test-find-keymap-name () (should (equal (help-fns-find-keymap-name lisp-mode-map) 'lisp-mode-map)) ;; Follow aliasing. @@ -142,27 +148,32 @@ help-fns-test-find-keymap-name (makunbound 'foo-test-map))) (ert-deftest help-fns-test-describe-keymap/symbol () - (describe-keymap 'minibuffer-local-must-match-map) + (describe-keymap 'help-fns-test-map) (with-current-buffer "*Help*" - (should (looking-at "^minibuffer-local-must-match-map is")))) + (should (looking-at "^help-fns-test-map is")) + (should (re-search-forward (rx word-start "a" word-end + (+ blank) + word-start "test-cmd-a" word-end) + nil t)))) (ert-deftest help-fns-test-describe-keymap/value () - (describe-keymap minibuffer-local-must-match-map) + (describe-keymap help-fns-test-map) (with-current-buffer "*Help*" (should (looking-at "\nKey")))) (ert-deftest help-fns-test-describe-keymap/not-keymap () (should-error (describe-keymap nil)) - (should-error (describe-keymap emacs-version))) + (should-error (describe-keymap emacs-version)) + (should-error (describe-keymap 'some-undefined-variable-foobar))) (ert-deftest help-fns-test-describe-keymap/let-bound () - (let ((foobar minibuffer-local-must-match-map)) + (let ((foobar help-fns-test-map)) (describe-keymap foobar) (with-current-buffer "*Help*" (should (looking-at "\nKey"))))) (ert-deftest help-fns-test-describe-keymap/dynamically-bound-no-file () - (setq help-fns-test--describe-keymap-foo minibuffer-local-must-match-map) + (setq help-fns-test--describe-keymap-foo help-fns-test-map) (describe-keymap 'help-fns-test--describe-keymap-foo) (with-current-buffer "*Help*" (should (looking-at "^help-fns-test--describe-keymap-foo is")))) commit bbd69f1663abe0066319efbeb06e9dc9f6ec8d92 Author: Stefan Kangas Date: Tue Aug 8 03:37:54 2023 +0200 Delete useless conditional in describe-keymap * lisp/help-fns.el (describe-keymap): Delete useless conditional. (Bug#65128) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 2d94182df33..fc8f431fd11 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -2071,11 +2071,9 @@ describe-keymap (if (symbolp keymap) (error "Not a keymap variable: %S" keymap) (error "Not a keymap"))) - (let ((sym nil)) - (unless sym - (setq sym (cl-gentemp "KEYMAP OBJECT (no variable) ")) - (setq used-gentemp t) - (set sym keymap)) + (let ((sym (cl-gentemp "KEYMAP OBJECT (no variable) "))) + (setq used-gentemp t) + (set sym keymap) (setq keymap sym))) ;; Follow aliasing. (setq keymap (or (ignore-errors (indirect-variable keymap)) keymap)) commit 594e03526bdc7144216e2f98831e6a7973be393a Author: Po Lu Date: Tue Aug 8 08:55:23 2023 +0800 ; * configure.ac: Fix typo in commentary. diff --git a/configure.ac b/configure.ac index 663153f8568..e01465c2af0 100644 --- a/configure.ac +++ b/configure.ac @@ -7768,7 +7768,7 @@ AC_DEFUN SMALL_JA_DIC=$with_small_ja_dic AC_SUBST([SMALL_JA_DIC]) -dnl The following commands are run on the host system when building +dnl The following commands are run on the build system when building dnl Emacs. if test "$XCONFIGURE" != "android"; then commit a97edc9556569217601894e647c9a1fee5af678a Author: Po Lu Date: Tue Aug 8 08:55:02 2023 +0800 Eschew linking Gnulib files to cross unless building for Android * configure.ac: Don't link Gnulib files to cross unless building for Android. diff --git a/configure.ac b/configure.ac index 41df4618078..663153f8568 100644 --- a/configure.ac +++ b/configure.ac @@ -7848,19 +7848,20 @@ AC_DEFUN dnl machine. AS_MKDIR_P([cross/etc]) - dnl Link gnulib files to cross/lib as well. - dnl af_alg.h and lib/save-cwd.h are copied manually from - dnl gnulib, and as such aren't specified in gl_FILE_LIST. - emacs_files='gl_FILE_LIST lib/af_alg.h lib/save-cwd.h' - dnl These files are specific to Emacs. - emacs_files="$emacs_files lib/fingerprint.c lib/fingerprint.h \ - lib/save-cwd.c lib/openat-die.c lib/save-cwd.c \ - lib/min-max.h" - for file in $emacs_files; do - AS_IF([expr "X${file}J" : "Xlib/.*[[ch]]J" >/dev/null], - [AS_IF([test -f "$srcdir/$file"], - [AC_CONFIG_LINKS([cross/$file:$file])])]) - done + AS_IF([test "x$with_android" != "xno"], [ + dnl Link gnulib files to cross/lib as well. af_alg.h and + dnl lib/save-cwd.h are copied manually from gnulib, and as such + dnl aren't specified in gl_FILE_LIST. + emacs_files='gl_FILE_LIST lib/af_alg.h lib/save-cwd.h' + dnl These files are specific to Emacs. + emacs_files="$emacs_files lib/fingerprint.c lib/fingerprint.h \ + lib/save-cwd.c lib/openat-die.c lib/save-cwd.c \ + lib/min-max.h" + for file in $emacs_files; do + AS_IF([expr "X${file}J" : "Xlib/.*[[ch]]J" >/dev/null], + [AS_IF([test -f "$srcdir/$file"], + [AC_CONFIG_LINKS([cross/$file:$file])])]) + done]) fi # Make java/Makefile commit 4a2367d2f0199a95f25297ef2c5948768e2b01da Author: Paul Eggert Date: Mon Aug 7 13:57:13 2023 -0700 Simplify lockfile name calculation * src/filelock.c (get_boot_time): Move ‘counter’ decl to simplify #ifdef nesting. (lock_file_1): Refactor two snprintf calls into one. Don’t assume INT_MAX < SIZE_MAX. diff --git a/src/filelock.c b/src/filelock.c index fea0044e219..66b8fd2ceac 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -143,10 +143,6 @@ #define WTMP_FILE "/var/log/wtmp" static time_t get_boot_time (void) { -#if defined (BOOT_TIME) - int counter; -#endif - if (boot_time_initialized) return boot_time; boot_time_initialized = 1; @@ -196,8 +192,9 @@ get_boot_time (void) /* Try to get boot time from the current wtmp file. */ get_boot_time_1 (WTMP_FILE, 1); - /* If we did not find a boot time in wtmp, look at wtmp, and so on. */ - for (counter = 0; counter < 20 && ! boot_time; counter++) + /* If we did not find a boot time in wtmp, look at wtmp.1, + wtmp.1.gz, wtmp.2, wtmp.2.gz, and so on. */ + for (int counter = 0; counter < 20 && ! boot_time; counter++) { Lisp_Object filename = Qnil; bool delete_flag = false; @@ -442,18 +439,12 @@ lock_file_1 (Lisp_Object lfname, bool force) char lock_info_str[MAX_LFINFO + 1]; intmax_t pid = getpid (); - if (boot) - { - if (sizeof lock_info_str - <= snprintf (lock_info_str, sizeof lock_info_str, - "%s@%s.%"PRIdMAX":%"PRIdMAX, - user_name, host_name, pid, boot)) - return ENAMETOOLONG; - } - else if (sizeof lock_info_str - <= snprintf (lock_info_str, sizeof lock_info_str, - "%s@%s.%"PRIdMAX, - user_name, host_name, pid)) + char const *lock_info_fmt = (boot + ? "%s@%s.%"PRIdMAX":%"PRIdMAX + : "%s@%s.%"PRIdMAX); + int len = snprintf (lock_info_str, sizeof lock_info_str, + lock_info_fmt, user_name, host_name, pid, boot); + if (! (0 <= len && len < sizeof lock_info_str)) return ENAMETOOLONG; return create_lock_file (SSDATA (lfname), lock_info_str, force); commit 7cd8236d35c033fefb7be742e6c3290c63eaf609 Author: Paul Eggert Date: Mon Aug 7 09:17:56 2023 -0700 Pacify --enable-gcc-warnings with emacs_fdopen * src/lisp.h (emacs_fdopen): Now ATTRIBUTE_MALLOC ATTRIBUTE_DEALLOC (emacs_fclose, 1), to pacify gcc -Wsuggest-attribute=malloc on non-Android platforms. diff --git a/src/lisp.h b/src/lisp.h index 447912581d7..85de57b0b2f 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -5086,8 +5086,9 @@ maybe_disable_address_randomization (int argc, char **argv) extern int emacs_open_noquit (const char *, int, int); extern int emacs_pipe (int[2]); extern int emacs_close (int); -extern FILE *emacs_fdopen (int, const char *); extern int emacs_fclose (FILE *); +extern FILE *emacs_fdopen (int, const char *) + ATTRIBUTE_MALLOC ATTRIBUTE_DEALLOC (emacs_fclose, 1); extern int emacs_unlink (const char *); extern int emacs_symlink (const char *, const char *); extern int emacs_rmdir (const char *); commit a95253f5cc1105619f6f93585dd41288f93384e4 Author: Eli Zaretskii Date: Mon Aug 7 17:43:33 2023 +0300 Fix configuring with --enable-checking on non-Android platforms * configure.ac (ENABLE_CHECKING): Fix test for --with-android. diff --git a/configure.ac b/configure.ac index c77fab3eefd..41df4618078 100644 --- a/configure.ac +++ b/configure.ac @@ -723,7 +723,7 @@ AC_DEFUN # There is little point in enabling checking in the build machine if # cross-compiling for Android. -AS_IF([test -z "$with_android" || test -n "$XCONFIGURE"],[ +AS_IF([test "$with_android" = no || test -n "$XCONFIGURE"],[ if test x$ac_enable_checking != x ; then AC_DEFINE([ENABLE_CHECKING], [1], [Define to 1 if expensive run-time data type and consistency checks are enabled.]) commit 72a606bb275b91845febd84c52897be8b8b0d877 Author: Po Lu Date: Mon Aug 7 21:14:53 2023 +0800 Fix mouse face display bug on MS-DOS * src/msdos.c (tty_draw_row_with_mouse_face): Tweak coordinates to reflect the number of glyphs used within the margin area. diff --git a/src/msdos.c b/src/msdos.c index 75a39045cee..1b7f2d4ae21 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -979,11 +979,15 @@ tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row, if (hl == DRAW_MOUSE_FACE) { int vpos = row->y + WINDOW_TOP_EDGE_Y (w); - int kstart = start_hpos + WINDOW_LEFT_EDGE_X (w); + int kstart = (start_hpos + WINDOW_LEFT_EDGE_X (w) + + row->used[LEFT_MARGIN_AREA]); int nglyphs = end_hpos - start_hpos; int offset = ScreenPrimary + 2*(vpos*screen_size_X + kstart) + 1; int start_offset = offset; + if (end_hpos >= row->used[TEXT_AREA]) + nglyphs = row->used[TEXT_AREA] - start_hpos; + if (tty->termscript) fprintf (tty->termscript, "\n", kstart, kstart + nglyphs - 1, vpos); @@ -1021,6 +1025,9 @@ tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row, temporarily move cursor coordinates to the beginning of the highlight region. */ new_pos_X = start_hpos + WINDOW_LEFT_EDGE_X (w); + /* The coordinates supplied by the caller are relative to the + text area, not the window itself. */ + new_pos_X += row->used[LEFT_MARGIN_AREA]; new_pos_Y = row->y + WINDOW_TOP_EDGE_Y (w); if (tty->termscript) commit 6990af4ca9057ef203c316f2d18510a07025be6c Author: Po Lu Date: Mon Aug 7 20:18:46 2023 +0800 * nt/gnulib-cfg.mk: Excise unneeded entries. diff --git a/nt/gnulib-cfg.mk b/nt/gnulib-cfg.mk index b36724b037f..fe29e942d80 100644 --- a/nt/gnulib-cfg.mk +++ b/nt/gnulib-cfg.mk @@ -55,20 +55,14 @@ OMIT_GNULIB_MODULE_fcntl = OMIT_GNULIB_MODULE_float = true OMIT_GNULIB_MODULE_fpucw = true OMIT_GNULIB_MODULE_free-posix = true -OMIT_GNULIB_MODULE_frexp-nolibm = true -OMIT_GNULIB_MODULE_frexpl-nolibm = true OMIT_GNULIB_MODULE_fseterr = true OMIT_GNULIB_MODULE_fsusage = true OMIT_GNULIB_MODULE_futimens = true OMIT_GNULIB_MODULE_getdelim = true OMIT_GNULIB_MODULE_getline = true OMIT_GNULIB_MODULE_inttypes-incomplete = true -OMIT_GNULIB_MODULE_isnand-nolibm = true -OMIT_GNULIB_MODULE_isnanf-nolibm = true -OMIT_GNULIB_MODULE_isnanl-nolibm = true OMIT_GNULIB_MODULE_lchmod = true OMIT_GNULIB_MODULE_malloc-posix = true -OMIT_GNULIB_MODULE_math = true OMIT_GNULIB_MODULE_nanosleep = true OMIT_GNULIB_MODULE_nproc = true OMIT_GNULIB_MODULE_open = true commit 26f6b283eeeb123fee8daf7c4cbfd5731d6a8afe Author: Po Lu Date: Mon Aug 7 20:17:55 2023 +0800 * nt/gnulib-cfg.mk: Excise unneeded entries. diff --git a/nt/gnulib-cfg.mk b/nt/gnulib-cfg.mk index d7241976f83..b36724b037f 100644 --- a/nt/gnulib-cfg.mk +++ b/nt/gnulib-cfg.mk @@ -73,9 +73,6 @@ OMIT_GNULIB_MODULE_nanosleep = OMIT_GNULIB_MODULE_nproc = true OMIT_GNULIB_MODULE_open = true OMIT_GNULIB_MODULE_pipe2 = true -OMIT_GNULIB_MODULE_printf-frexp = true -OMIT_GNULIB_MODULE_printf-frexpl = true -OMIT_GNULIB_MODULE_printf-posix = true OMIT_GNULIB_MODULE_realloc-gnu = true OMIT_GNULIB_MODULE_realloc-posix = true OMIT_GNULIB_MODULE_secure_getenv = true @@ -92,7 +89,4 @@ OMIT_GNULIB_MODULE_sys_types = OMIT_GNULIB_MODULE_unistd = true OMIT_GNULIB_MODULE_utimens = true OMIT_GNULIB_MODULE_utimensat = true -OMIT_GNULIB_MODULE_vasnprintf = true -OMIT_GNULIB_MODULE_vasprintf = true -OMIT_GNULIB_MODULE_vfprintf-posix = true OMIT_GNULIB_MODULE_xsize = true commit f74166c726dba1ecdeb7a67bf08b4432417f8015 Author: Po Lu Date: Mon Aug 7 20:15:33 2023 +0800 Stop tracking exec/config.h.in * .gitignore: Add exec/config.h.in. * exec/config.h.in: Remove from Git. diff --git a/.gitignore b/.gitignore index 889008dd96d..75e46ce20d5 100644 --- a/.gitignore +++ b/.gitignore @@ -381,6 +381,7 @@ exec/exec1 exec/deps/* exec/autom4te.cache exec/config.h +exec/config.h.in exec/config-mips.m4 exec/configure exec/*.s.s diff --git a/exec/config.h.in b/exec/config.h.in deleted file mode 100644 index 3e04af37f79..00000000000 --- a/exec/config.h.in +++ /dev/null @@ -1,358 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Copyright (C) 2023 Free Software Foundation, Inc. - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation, either version 3 of the License, or (at your -option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see . */ - -/* Define to number of reserved bytes past the stack frame. */ -#undef ABI_RED_ZONE - -/* Define if building universal (internal helper macro) */ -#undef AC_APPLE_UNIVERSAL_BUILD - -/* Define to number of the `clone3' system call. */ -#undef CLONE3_SYSCALL - -/* Define to number of the `clone' system call. */ -#undef CLONE_SYSCALL - -/* Virtual address for loading PIC executables */ -#undef EXECUTABLE_BASE - -/* Define to 1 if the system utilizes 64-bit ELF. */ -#undef EXEC_64 - -/* Define to number of the `exec' system call. */ -#undef EXEC_SYSCALL - -/* Define to 1 if you have the declaration of `stpcpy', and to 0 if you don't. - */ -#undef HAVE_DECL_STPCPY - -/* Define to 1 if you have the declaration of `stpncpy', and to 0 if you - don't. */ -#undef HAVE_DECL_STPNCPY - -/* Define to 1 if you have the `getpagesize' function. */ -#undef HAVE_GETPAGESIZE - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MINIX_CONFIG_H - -/* Define to 1 if process_vm_readv is available. */ -#undef HAVE_PROCESS_VM - -/* Define to 1 if `si_syscall' is a member of `siginfo_t'. */ -#undef HAVE_SIGINFO_T_SI_SYSCALL - -/* Define to 1 if stdbool.h conforms to C99. */ -#undef HAVE_STDBOOL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `stpcpy' function. */ -#undef HAVE_STPCPY - -/* Define to 1 if you have the `stpncpy' function. */ -#undef HAVE_STPNCPY - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UIO_H - -/* Define to 1 if the system has the type `uintptr_t'. */ -#undef HAVE_UINTPTR_T - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_WCHAR_H - -/* Define to 1 if the system has the type `_Bool'. */ -#undef HAVE__BOOL - -/* Virtual address for loading PIC interpreters */ -#undef INTERPRETER_BASE - -/* Define to 1 if MIPS NABI calling convention is being used. */ -#undef MIPS_NABI - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to number of the `readlinkat' system call. */ -#undef READLINKAT_SYSCALL - -/* Define to number of the `readlink' system call. */ -#undef READLINK_SYSCALL - -/* Define to 1 if the library is used within a signal handler. */ -#undef REENTRANT - -/* Define to 1 if the stack grows downwards. */ -#undef STACK_GROWS_DOWNWARDS - -/* Define to register holding the stack pointer. */ -#undef STACK_POINTER - -/* Define to 1 if all of the C90 standard headers exist (not just the ones - required in a freestanding environment). This macro is provided for - backward compatibility; new code need not use it. */ -#undef STDC_HEADERS - -/* Define to register holding arg1 to system calls. */ -#undef SYSCALL_ARG1_REG - -/* Define to register holding arg2 to system calls. */ -#undef SYSCALL_ARG2_REG - -/* Define to register holding arg3 to system calls. */ -#undef SYSCALL_ARG3_REG - -/* Define to register holding arg0 to system calls. */ -#undef SYSCALL_ARG_REG - -/* Define to header holding system call numbers. */ -#undef SYSCALL_HEADER - -/* Define to register holding the system call number. */ -#undef SYSCALL_NUM_REG - -/* Define to register holding value of system calls. */ -#undef SYSCALL_RET_REG - -/* Define to header holding USER_REGS_STRUCT. */ -#undef USER_HEADER - -/* Define to structure holding user registers. */ -#undef USER_REGS_STRUCT - -/* Define to word type used by tracees. */ -#undef USER_WORD - -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif -/* Enable general extensions on macOS. */ -#ifndef _DARWIN_C_SOURCE -# undef _DARWIN_C_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* Enable X/Open compliant socket functions that do not require linking - with -lxnet on HP-UX 11.11. */ -#ifndef _HPUX_ALT_XOPEN_SOCKET_API -# undef _HPUX_ALT_XOPEN_SOCKET_API -#endif -/* Identify the host operating system as Minix. - This macro does not affect the system headers' behavior. - A future release of Autoconf may stop defining this macro. */ -#ifndef _MINIX -# undef _MINIX -#endif -/* Enable general extensions on NetBSD. - Enable NetBSD compatibility extensions on Minix. */ -#ifndef _NETBSD_SOURCE -# undef _NETBSD_SOURCE -#endif -/* Enable OpenBSD compatibility extensions on NetBSD. - Oddly enough, this does nothing on OpenBSD. */ -#ifndef _OPENBSD_SOURCE -# undef _OPENBSD_SOURCE -#endif -/* Define to 1 if needed for POSIX-compatible behavior. */ -#ifndef _POSIX_SOURCE -# undef _POSIX_SOURCE -#endif -/* Define to 2 if needed for POSIX-compatible behavior. */ -#ifndef _POSIX_1_SOURCE -# undef _POSIX_1_SOURCE -#endif -/* Enable POSIX-compatible threading on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ -#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ -# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ -#endif -/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ -#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ -# undef __STDC_WANT_IEC_60559_BFP_EXT__ -#endif -/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ -#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ -# undef __STDC_WANT_IEC_60559_DFP_EXT__ -#endif -/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ -#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ -# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ -#endif -/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ -#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ -# undef __STDC_WANT_IEC_60559_TYPES_EXT__ -#endif -/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ -#ifndef __STDC_WANT_LIB_EXT2__ -# undef __STDC_WANT_LIB_EXT2__ -#endif -/* Enable extensions specified by ISO/IEC 24747:2009. */ -#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ -# undef __STDC_WANT_MATH_SPEC_FUNCS__ -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable X/Open extensions. Define to 500 only if necessary - to make mbstate_t available. */ -#ifndef _XOPEN_SOURCE -# undef _XOPEN_SOURCE -#endif - - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif - -/* Define for Solaris 2.5.1 so the uint32_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -#undef _UINT32_T - -/* Define for Solaris 2.5.1 so the uint64_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -#undef _UINT64_T - -/* Define for Solaris 2.5.1 so the uint8_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -#undef _UINT8_T - -/* Define as a signed integer type capable of holding a process identifier. */ -#undef pid_t - -/* Define to `unsigned int' if does not define. */ -#undef size_t - -/* Define to `int' if does not define. */ -#undef ssize_t - -/* Define to the type of an unsigned integer type of width exactly 16 bits if - such a type exists and the standard includes do not define it. */ -#undef uint16_t - -/* Define to the type of an unsigned integer type of width exactly 32 bits if - such a type exists and the standard includes do not define it. */ -#undef uint32_t - -/* Define to the type of an unsigned integer type of width exactly 64 bits if - such a type exists and the standard includes do not define it. */ -#undef uint64_t - -/* Define to the type of an unsigned integer type of width exactly 8 bits if - such a type exists and the standard includes do not define it. */ -#undef uint8_t - -/* Define to the type of an unsigned integer type wide enough to hold a - pointer, if such a type exists, and if the system does not define it. */ -#undef uintptr_t - - -#ifdef HAVE_STDBOOL_H -# include -#else -# ifndef HAVE__BOOL -# ifdef __cplusplus -typedef bool _Bool; -# else -# define _Bool signed char -# endif -# endif -# define bool _Bool -# define false 0 -# define true 1 -# define __bool_true_false_are_defined 1 -#endif - -#ifdef HAVE_SYS_PARAM_H -#include -#endif /* HAVE_SYS_PARAM_H */ - -#ifndef MAX -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#endif /* MAX */ - -#ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif /* MIN */ - commit b7038d9b7253754426e3734c3941985aff7729a7 Author: Eli Zaretskii Date: Mon Aug 7 14:07:43 2023 +0300 ; * src/fileio.c (internal_delete_file): Call internal_condition_case_1. diff --git a/src/fileio.c b/src/fileio.c index 290481c2b5d..b5c3add836e 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2598,7 +2598,7 @@ internal_delete_file (Lisp_Object filename) { Lisp_Object tem; - tem = internal_condition_case_2 (Fdelete_file_internal, filename, + tem = internal_condition_case_1 (Fdelete_file_internal, filename, Qt, internal_delete_file_1); return NILP (tem); } commit aae436c81ce5a993c35331badf9b1cb14611b8fc Author: Po Lu Date: Mon Aug 7 16:45:27 2023 +0800 * msdos/sed1v2.inp: Fix last change. diff --git a/msdos/sed1v2.inp b/msdos/sed1v2.inp index e7561f49889..dd7f650e8e3 100644 --- a/msdos/sed1v2.inp +++ b/msdos/sed1v2.inp @@ -213,6 +213,10 @@ s/ *@WEBP_LIBS@// /^XCONFIGURE *=/s/@XCONFIGURE@// /^[ \t]*MAKE_PDUMPER_FINGERPRINT = *$/c\ MAKE_PDUMPER_FINGERPRINT = +# While this variable is named abs_top_builddir, the distinction is +# only relevant when Emacs is undergoing cross-compilation. +/^abs_top_builddir =*/s/@abs_top_builddir@/../ +s/\$(abs_top_builddir)\/src\/lisp.mk/lisp.mk/ /^lisp\.mk:/,/^$/c\ lisp.mk: $(lispsource)/loadup.el\ @rm -f $@\ @@ -295,11 +299,3 @@ s| -I\. -I\$(srcdir)| -I.| /\$(CC) -o \$@.tmp/s/\$@.tmp/\$@/ /mv \$@.tmp \$@/d /^top_builddir =*/s/@top_builddir@/../ -# While this variable is named abs_top_builddir, the distinction is -# only relevant when Emacs is undergoing cross-compilation. -/^abs_top_builddir =*/s/@abs_top_builddir@/../ -# In fact, this leads to errors where Make protests that the -# command line is ``too long'', so edit the lisp.mk stuff to -# not specify an absolute file name. -s/\$(abs_top_builddir)\/src\/lisp.mk/lisp.mk/ -# But this still doesn't work. commit e37ab2065647ba603c7b87c0f795ae5d002e2205 Author: Po Lu Date: Mon Aug 7 16:40:27 2023 +0800 Fix the DJGPP build halfway * msdos/sed1v2.inp (abs_top_builddir): Edit to .., and explain why this is okay. ($(abs_top_builddir)/src/lisp.mk): Edit to plain lisp.mk. diff --git a/msdos/sed1v2.inp b/msdos/sed1v2.inp index 1b96cc7ddc4..e7561f49889 100644 --- a/msdos/sed1v2.inp +++ b/msdos/sed1v2.inp @@ -295,3 +295,11 @@ s| -I\. -I\$(srcdir)| -I.| /\$(CC) -o \$@.tmp/s/\$@.tmp/\$@/ /mv \$@.tmp \$@/d /^top_builddir =*/s/@top_builddir@/../ +# While this variable is named abs_top_builddir, the distinction is +# only relevant when Emacs is undergoing cross-compilation. +/^abs_top_builddir =*/s/@abs_top_builddir@/../ +# In fact, this leads to errors where Make protests that the +# command line is ``too long'', so edit the lisp.mk stuff to +# not specify an absolute file name. +s/\$(abs_top_builddir)\/src\/lisp.mk/lisp.mk/ +# But this still doesn't work. commit 9a4249a022e26353c42a7da966789b05573bb3ec Author: Po Lu Date: Mon Aug 7 16:25:25 2023 +0800 Fix the DJGPP build * msdos/sedlibmk.inp (OMI_GNULIB_MODULE_crypto/md5): Delete extraneous escape character. diff --git a/msdos/sedlibmk.inp b/msdos/sedlibmk.inp index 4300be47d0b..f3554e7b001 100644 --- a/msdos/sedlibmk.inp +++ b/msdos/sedlibmk.inp @@ -489,7 +489,7 @@ OMIT_GNULIB_MODULE_strtoll = true\ OMIT_GNULIB_MODULE_symlink = true\ OMIT_GNULIB_MODULE_sys_select = true\ OMIT_GNULIB_MODULE_sys_time = true\ -OMIT_GNULIB_MODULE_crypto\/md5 = true\ +OMIT_GNULIB_MODULE_crypto\/md5 = true /^arg-nonnull\.h:/,/^[ ][ ]*mv /c\ arg-nonnull.h: $(top_srcdir)/build-aux/snippet/arg-nonnull.h\ sed -n -e '/GL_ARG_NONNULL/,$$p' < $(top_srcdir)/build-aux/snippet/arg-nonnull.h > $@