diff options
| author | Po Lu | 2023-08-03 10:41:40 +0800 |
|---|---|---|
| committer | Po Lu | 2023-08-03 10:41:40 +0800 |
| commit | 91a7e9d83f212e478958c2bafd59057ec816cba0 (patch) | |
| tree | b65829b43a7de48ab506956519a4fcc5759f7117 /src | |
| parent | 60dda3105c9c7eb66480a9cc8a947f6c6bed1a8e (diff) | |
| download | emacs-91a7e9d83f212e478958c2bafd59057ec816cba0.tar.gz emacs-91a7e9d83f212e478958c2bafd59057ec816cba0.zip | |
Update Android port
* java/org/gnu/emacs/EmacsSafThread.java (CacheToplevel):
(EmacsSafThread):
(DocIdEntry):
(getCache):
(pruneCache):
(cacheDirectoryFromCursor):
(run):
(documentIdFromName1):
(statDocument1):
(openDocumentDirectory1):
(openDocument1): Introduce a file status cache and populate
it with files within directories as they are opened.
* java/org/gnu/emacs/EmacsService.java (createDocument):
(createDirectory):
(moveDocument): Invalidate the file status cache wherever
needed.
* src/fileio.c (check_vfs_filename):
(Fset_file_modes): Permit `set-file-modes' to silently fail
on asset and content files.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/fileio.c b/src/fileio.c index 5ce933ec45b..1ccb871ce49 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -184,9 +184,12 @@ static bool e_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t, | |||
| 184 | 184 | ||
| 185 | /* Establish that ENCODED is not contained within a special directory | 185 | /* Establish that ENCODED is not contained within a special directory |
| 186 | whose contents are not eligible for Unix VFS operations. Signal a | 186 | whose contents are not eligible for Unix VFS operations. Signal a |
| 187 | `file-error' with REASON if it does. */ | 187 | `file-error' with REASON if it does. |
| 188 | 188 | ||
| 189 | static void | 189 | If REASON is NULL, instead return whether ENCODED is contained |
| 190 | within such a directory. */ | ||
| 191 | |||
| 192 | static bool | ||
| 190 | check_vfs_filename (Lisp_Object encoded, const char *reason) | 193 | check_vfs_filename (Lisp_Object encoded, const char *reason) |
| 191 | { | 194 | { |
| 192 | #if defined HAVE_ANDROID && !defined ANDROID_STUBIFY | 195 | #if defined HAVE_ANDROID && !defined ANDROID_STUBIFY |
| @@ -194,11 +197,16 @@ check_vfs_filename (Lisp_Object encoded, const char *reason) | |||
| 194 | 197 | ||
| 195 | name = SSDATA (encoded); | 198 | name = SSDATA (encoded); |
| 196 | 199 | ||
| 197 | if (android_is_special_directory (name, "/assets")) | 200 | if (android_is_special_directory (name, "/assets") |
| 198 | xsignal2 (Qfile_error, build_string (reason), encoded); | 201 | || android_is_special_directory (name, "/content")) |
| 202 | { | ||
| 203 | if (!reason) | ||
| 204 | return true; | ||
| 205 | |||
| 206 | xsignal2 (Qfile_error, build_string (reason), encoded); | ||
| 207 | } | ||
| 199 | 208 | ||
| 200 | if (android_is_special_directory (name, "/content")) | 209 | return false; |
| 201 | xsignal2 (Qfile_error, build_string (reason), encoded); | ||
| 202 | #endif /* defined HAVE_ANDROID && !defined ANDROID_STUBIFY */ | 210 | #endif /* defined HAVE_ANDROID && !defined ANDROID_STUBIFY */ |
| 203 | } | 211 | } |
| 204 | 212 | ||
| @@ -3657,8 +3665,14 @@ command from GNU Coreutils. */) | |||
| 3657 | return call4 (handler, Qset_file_modes, absname, mode, flag); | 3665 | return call4 (handler, Qset_file_modes, absname, mode, flag); |
| 3658 | 3666 | ||
| 3659 | encoded = ENCODE_FILE (absname); | 3667 | encoded = ENCODE_FILE (absname); |
| 3660 | check_vfs_filename (encoded, "Trying to change access modes of file" | 3668 | |
| 3661 | " within special directory"); | 3669 | /* Silently ignore attempts to change the access modes of files |
| 3670 | within /contents on Android, preventing errors within backup file | ||
| 3671 | creation. */ | ||
| 3672 | |||
| 3673 | if (check_vfs_filename (encoded, NULL)) | ||
| 3674 | return Qnil; | ||
| 3675 | |||
| 3662 | char *fname = SSDATA (encoded); | 3676 | char *fname = SSDATA (encoded); |
| 3663 | mode_t imode = XFIXNUM (mode) & 07777; | 3677 | mode_t imode = XFIXNUM (mode) & 07777; |
| 3664 | if (fchmodat (AT_FDCWD, fname, imode, nofollow) != 0) | 3678 | if (fchmodat (AT_FDCWD, fname, imode, nofollow) != 0) |