From 2efa09dd07b1e5b23ed52e18c73ed2541d0f16f0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 18 Oct 2026 08:28:21 +0530 Subject: [PATCH] Fix #10684 --- docs/changelog.rst | 53 ++++++++++++++++++-------------------- docs/graphics-protocol.rst | 13 +++++++++- kitty/graphics.c | 6 ++--- kitty_tests/graphics.py | 9 ++++++- 4 files changed, 47 insertions(+), 34 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 099885ab9..26fde909e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -231,7 +231,18 @@ Detailed list of changes 0.50.0 [future] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Fix cursor position reports returning the wrong row in origin mode (:pull:`10682`) +- Custom shaders: New :code:`cursor-trail-railgun`, :code:`cursor-trail-torpedo` + and :code:`cursor-trail-pixiedust` shaders that make particles fly off the + cursor as it moves, in the style of neovide (:iss:`10587`) + +- Allow docking kitty windows to the edges of other windows or of the tab, for + status bars, file trees, etc. Create them with :code:`launch --type=window-dock` + or :code:`launch --type=tab-dock`, see :ref:`docks` + +- Graphics protocol: Add two new :ref:`indexed color image formats + ` whose pixels are indices into the terminal color + palette, so that images automatically change color along with the terminal + color scheme (:iss:`9379`) - macOS: A new option :opt:`restore_session_after_logout` to save the state of every kitty instance, including the scrollback of every window, encrypted with @@ -239,16 +250,6 @@ Detailed list of changes computer and restore it the next time kitty is started, see :ref:`restore_after_logout` (:iss:`1197`, :pull:`10659`) -- Sessions: A new ``os_window_position`` keyword and a new - ``--os-window-geometry`` option for :ac:`save_as_session` to save the size, - position and state of OS Windows in session files - -- Ignore initial OS Window positions that are not on any connected monitor, for - example, because the monitor was disconnected - -- Sessions: Fix the OS Window size specified in a session being ignored when - :opt:`remember_window_size` is enabled - - Fix kitty repeatedly calling ``on_quit`` watchers when a watcher aborts a quit requested by the OS, for example, via the macOS menu or Dock @@ -258,20 +259,10 @@ Detailed list of changes - diff kitten: Fix comparing remote directories over SSH failing when they contain read-only directories (:pull:`10676`) -- Graphics protocol: Add two new :ref:`indexed color image formats - ` whose pixels are indices into the terminal color - palette, so that images automatically change color along with the terminal - color scheme (:iss:`9379`) - -- Allow docking kitty windows to the edges of other windows or of the tab, for - status bars, file trees, etc. Create them with :code:`launch --type=window-dock` - or :code:`launch --type=tab-dock`, see :ref:`docks` - - Vertical tab bars: When :opt:`tab_title_max_length` is set, size the tab bar to fit the decorations of the current :opt:`tab_bar_style` rather than always adding eight cells, allowing much narrower tab bars (:iss:`10680`) - - quick-access-terminal kitten: A new :option:`kitty +kitten quick_access_terminal --if-running` option to run a program in a new tab or window of an already running quick access terminal and a new :option:`kitty +kitten quick_access_terminal --listen-on` option @@ -304,9 +295,7 @@ Detailed list of changes :ac:`shader_event` action, :code:`user:` animation events and the :code:`animation_toggle` pipeline directive, see :ref:`custom_shader_mappings` (:iss:`10667`) -- Custom shaders: The :code:`pointer_map()` function of shaders that move - content is now also used for groups that are turned on and off by events, - while they are active +- Fix cursor position reports returning the wrong row in origin mode (:pull:`10682`) - Add English and Spanish subtitles to the intro video shown at the top of the documentation @@ -333,6 +322,11 @@ Detailed list of changes actions and the choose-files kitten also match the aliases of the detected MIME type, for example, ``text/x-sh`` matches shell scripts (:iss:`3056`) +- Graphics protocol: Allow shared memory object names without a leading slash + again, as sandboxed macOS applications cannot use names with a leading + slash. Clients are still recommended to use a leading slash when possible + (:iss:`10684`) + - Graphics protocol: Fix a fragment of a Unicode placeholder image sometimes reappearing over unrelated text on the bottom line after the screen is scrolled down with reverse index and then scrolled up again @@ -387,10 +381,6 @@ Detailed list of changes - macOS: Fix OS windows not staying on all spaces when kitty is assigned to All Desktops via its Dock icon (:iss:`10581`) -- Custom shaders: New :code:`cursor-trail-railgun`, :code:`cursor-trail-torpedo` - and :code:`cursor-trail-pixiedust` shaders that make particles fly off the - cursor as it moves, in the style of neovide (:iss:`10587`) - - Cursor trail: Always show the trail when focus moves to a different window, regardless of :opt:`cursor_trail_start_threshold` (:iss:`10591`) @@ -497,6 +487,13 @@ Detailed list of changes - macOS: Fix a memory leak when getting the list of all processes, for example, when querying the memory used by child processes (:iss:`10673`) +- Sessions: A new ``os_window_position`` keyword and a new + ``--os-window-geometry`` option for :ac:`save_as_session` to save the size, + position and state of OS Windows in session files + +- Sessions: Fix the OS Window size specified in a session being ignored when + :opt:`remember_window_size` is enabled + - Sessions: Fix ``os_window_title`` having no effect on the first OS Window created when starting kitty with a session file (:iss:`10675`) diff --git a/docs/graphics-protocol.rst b/docs/graphics-protocol.rst index 14e18ce32..0ac0cb1b4 100644 --- a/docs/graphics-protocol.rst +++ b/docs/graphics-protocol.rst @@ -403,7 +403,18 @@ Value of `t` Meaning ``s`` A *shared memory object*, which on POSIX systems is a `POSIX shared memory object `_ and on Windows is a - `Named shared memory object `_. On POSIX SHM names **must** start with a :file:`/` and have no other :file:`/` characters and must be no longer than the maximum SHM name size supported by the OS + `Named shared memory object `_. + On POSIX, clients *should* use SHM names that start with + a :file:`/` and have no other :file:`/` characters, + whenever possible. However, some platforms require + other forms, for example, sandboxed applications on + macOS can only use names of the form + :file:`app-group-id/name`, with no leading slash. So + terminal emulators **must** accept names without a + leading slash and pass the name unmodified to + :code:`shm_open()` and :code:`shm_unlink()`. Names must + be no longer than the maximum SHM name size supported + by the OS. The terminal emulator must read the data from the memory object and then unlink and close it on POSIX and just close it on Windows. diff --git a/kitty/graphics.c b/kitty/graphics.c index 1809c0294..db5647141 100644 --- a/kitty/graphics.c +++ b/kitty/graphics.c @@ -737,10 +737,8 @@ load_image_data_from_file( int fd; *was_opened = false; if (is_shm) { - if (fname[0] != '/') { - FAIL_IMAGE_FILE("Failed to open shared memory object: %s with error: %s", fname, "POSIX SHM names must start with /"); - return false; - } + // Names without a leading slash are allowed, as, for example, macOS + // sandboxed applications can only use names of the form group-id/name fd = safe_shm_open(fname, O_RDONLY, 0); } else { // The policy check has to happen before the file is opened. Merely diff --git a/kitty_tests/graphics.py b/kitty_tests/graphics.py index a8f8fdb56..75e0b3f54 100644 --- a/kitty_tests/graphics.py +++ b/kitty_tests/graphics.py @@ -669,7 +669,14 @@ class TestGraphics(BaseTest): # A shared memory object that could not be opened must also be # removed, and reported with the same generic error self.ae(pl('/kitty-test-shm-missing', s=1024, v=8, t='s'), generic_error) - self.ae(pl('kitty-test-shm-no-leading-slash', s=1024, v=8, t='s'), generic_error) + self.ae(pl('kitty-test-shm-missing-no-leading-slash', s=1024, v=8, t='s'), generic_error) + + # Names without a leading slash must be accepted, as, for example, + # sandboxed applications on macOS cannot use a leading slash + name = 'kitty-test-shm-no-leading-slash' + shm_write(name, random_data) + sl(name, s=1024, v=8, t='s', expecting_data=random_data) + self.assertRaises(FileNotFoundError, shm_unlink, name) # check that the object was deleted s.reset() self.assertEqual(g.disk_cache.total_size, 0)