Commit graph

2204 commits

Author SHA1 Message Date
Kovid Goyal
02b2b10d10
Fix flaky test
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
2026-10-29 22:05:37 +05:30
Kovid Goyal
cb88028abd
dnd kitten: Fix filesystem case sensitivity never being detected
is_case_sensitive_filesystem lost its true default when it moved into
the dnd struct, so remote drops always treated names differing only in
case as conflicting. Detect it properly and also probe for Unicode
normalization aliasing, since a case sensitive filesystem can still
treat differently normalized names as the same.
2026-10-29 21:46:25 +05:30
Kovid Goyal
1647103c57
Cleanup previous PR
- List the existing files that will be overwritten under the names they
  are stored as in the destination, not the dropped names
- Treat symlinks to directories in the destination as directories in
  find_overwrites, matching rename_contents, so the files that will be
  overwritten inside the symlink target are listed
- Replace an existing file or dangling symlink with a dropped directory
  instead of failing the drop after the user confirmed the overwrite
- Fail up front when a dropped file would replace an existing directory
- Also fold Unicode normalization when uniqifying remote drop names
- Probe for filesystem aliasing once before running the alias test
2026-10-29 21:41:44 +05:30
Zhizhen He
924dacc955
dnd: Detect filesystem aliases before overwrite confirmation 2026-10-29 23:55:24 +08:00
Kovid Goyal
40562972f4
Cleanup previous PR
Walk up from the drop destination using .. relative to its file
descriptor instead of its path, so the check is not fooled if the
destination is moved or replaced while the kitten is running. Also skip
the staging directory when copying, which guards against routes to it
the up-front check cannot see, such as bind mounts. Use readable
subtest names, check the chmod error in test cleanup and link the PR in
the changelog.
2026-10-29 17:32:35 +05:30
Zhizhen He
1a1495f564 dnd: Reject directory drops into their own descendants 2026-10-29 18:22:19 +08:00
Zhizhen He
ed4d37a9fa dnd: Skip local moves into the source directory 2026-10-28 20:36:04 +08:00
Kovid Goyal
c514311380
dnd: Use the existing conflict name template for local drops
Keeps conflict naming consistent between local and remote drops.
2026-10-28 17:38:44 +05:30
Zhizhen He
b7b29fe444 dnd: Preserve same-named local drop sources
Staging two entries with the same basename could fall back from a hard link to a truncating copy and overwrite the first source. Give each local source an unused staging name and use exclusive file and directory creation. Add regressions for files, directories, repeated paths, case conflicts, existing staging entries and symbolic links.
2026-10-28 19:45:51 +08:00
Zhizhen He
1e273aa289 Docs: Correct protocol references, examples and generated help 2026-10-28 13:24:43 +08:00
Zhizhen He
849c04153c choose-fonts: Fix style ordering for negative axis values 2026-10-27 22:52:24 +08:00
devangpratap
2519974e84 desktop-ui: Fix an invalid accent_color breaking the appearance settings 2026-10-26 14:05:23 -04:00
Kovid Goyal
a2086eb6a4
clipboard: Name both outputs when a case alias is detected
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
Identify the colliding output by comparing the probe files, matching the
message used for exact duplicates. Skip creating probe files when fewer
than two file outputs are given, so that a single output does not touch
the destination directory. Check both directories for leftover probes in
the test.
2026-10-26 20:18:48 +05:30
Zhizhen He
f0c67e1b97
clipboard: Reject output files with case aliases 2026-10-26 22:21:29 +08:00
Zhizhen He
4596a9baab
clipboard: Match duplicate checks to atomic write resolution 2026-10-26 13:36:01 +08:00
Zhizhen He
49e5695188
clipboard: Resolve symlinks before cleaning output paths 2026-10-26 13:12:42 +08:00
Kovid Goyal
a082d0b9ab
Fix test failure on macOS 2026-10-26 09:36:39 +05:30
Kovid Goyal
ddeb15b05a
clipboard: Download data once for outputs sharing a MIME type
Rather than every output sharing a remote MIME type writing its own
temporary copy of the data and decoding images separately, store the
data in a single temporary file per MIME type, decode images once and
save all outputs for that MIME type sequentially from it. The temporary
file is created in the directory of the first output where that is
possible, so a missing directory for one output does not affect others.

Also reject output files that resolve to the same path, following
symlinks as the atomic file update does, since saving to them would race
with the last write winning.
2026-10-26 08:53:47 +05:30
Kovid Goyal
3723c447aa
clipboard: Reject duplicate stream outputs for the same MIME type
Stream outputs write data as it arrives, so with fan-out to all outputs
sharing a remote MIME type, two outputs to the same stream would
interleave their data chunk by chunk, or encode two images into the
stream concurrently. Reject such duplicates with an error instead.
Also add a changelog entry for saving all outputs sharing a MIME type.
2026-10-26 08:48:06 +05:30
Zhizhen He
88fc77a5d6
clipboard: Save all outputs sharing a remote MIME type 2026-10-26 11:05:55 +08:00
Kovid Goyal
8280cd4ad0
clipboard: Replace the MIME list PTY test with a Go unit test
Move writing the MIME list into Output.write_mime_list() and test it
directly. Committing, permission preservation and failure cleanup are
already covered by the existing Output commit tests, so the PTY test
that spawned the kitten only added coverage for the missing commit.
2026-10-26 07:50:36 +05:30
Zhizhen He
bb956c7c6b
clipboard: Commit MIME list output when saving to a file 2026-10-26 10:05:45 +08:00
Zhizhen He
7fdd2af0fc
clipboard: Preserve dangling output symlinks 2026-10-25 22:21:52 +05:30
Kovid Goyal
68f242b7d9
clipboard: Cleanup atomic replacement of output files
Follow up to the merge of #10738. Use utils.AtomicUpdateFile to move
downloaded data into place instead of hand rolling the stat/chmod/rename
sequence. This fixes:

- Permissions of existing destination files not being preserved, as the
  chmod was applied to an already closed file
- An empty file being left at the destination if the rename failed, as
  the permissions probe opened the destination with O_CREATE
- Symlinks at the destination being replaced by regular files
- No fsync before the rename

Also encode converted images into memory and write them atomically, so
a failed encode no longer truncates and then deletes an existing
destination file.
2026-10-25 20:33:25 +05:30
Zhizhen He
0fae8bb9bd
clipboard: Replace existing output files atomically 2026-10-25 22:40:47 +08:00
Kovid Goyal
d53ad3fd3a
ssh kitten: Resolve HOME when using --symlink-strategy=resolve
The copied paths have their symlinks resolved, so files under a HOME that is
itself reached via a symlink, such as /home -> /usr/home, were not
recognized as being in HOME and were copied to an absolute path on the
remote machine. Also add the PR reference to the changelog entry for #10737.
2026-10-25 19:09:11 +05:30
Zhizhen He
814e7429ae
ssh: Fix HOME prefix matching for copied paths 2026-10-25 20:54:39 +08:00
Kovid Goyal
81535d9b33
hints: Cleanup previous PR
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
- Guard against the quotes post processor producing start > end for a match
  consisting of just a single ASCII quote
- Use char_before() in the URL trailing punctuation loop and avoid computing
  the closing bracket twice
- Add PR reference to changelog entry
2026-10-24 06:36:26 +05:30
xucian
f9b2fbb3b1 hints: Fix Unicode quotes not being removed from paths and URLs
The post-processors index the text by byte, so when looking at the
character before a position they decoded only the last byte of
multi-byte quotes such as ‘’ and “” and never matched them. URLs kept
the closing quote and paths kept both quotes. When the closing quote was
just outside the match, the start was also advanced by a single byte,
splitting the opening quote and producing invalid UTF-8, for example,
for the file name in wget's "Saving to: ‘index.html’".

This worked before the hints kitten was ported to Go.
2026-10-23 23:40:40 +03:00
Kovid Goyal
8538e82c05
ssh kitten: Preserve permissions of copied directories
The archive reused the metadata of the top level directory for all nested
directories and both bootstrap implementations recreated directories with
the remote umask.

Stat every directory when building the archive, passing the stat result
explicitly to the header callback and skipping directories that vanish or
are replaced by something else while being copied.

When deploying, move directories not present at the destination intact,
replacing any dangling symlink or file in the way, and merge into existing
directories keeping their permissions. The shell implementation falls back
to creating the directory and merging if the move fails. Make the
temporary directory deletable before removing it as copied directories can
lack write or search permission.

Closes #10727
2026-10-23 20:44:23 +05:30
Kovid Goyal
3867ffa92b
choose-fonts: Show styles in axis value order
styles_in_family sorted every style group alphabetically, discarding the
axis value order computed by styles_with_attribute_data, so weights were
listed as, for example, Bold, Light, Regular instead of Light, Regular,
Bold. Only sort by name when falling back to the style names of the fonts.
2026-10-23 19:11:29 +05:30
Kovid Goyal
2df0dcc5e5
Cleanup previous PR 2026-10-23 19:10:14 +05:30
Kovid Goyal
edac9e3f18
Merge PR #10726: choose-fonts: Fix missing styles when a family has several font files 2026-10-23 19:08:30 +05:30
devangpratap
6ee17085ab choose-fonts: Fix missing styles when a family has several font files 2026-10-23 09:08:09 -04:00
Kovid Goyal
1fee9e89f6
ssh kitten: Allow per-host color schemes for dark and light mode
New color_scheme_dark, color_scheme_light and color_scheme_no_preference
options. When any of them is set, the ssh kitten sends the color schemes
for all three system color schemes to kitty, which applies the one
matching the current system color scheme and switches between them when
the system color scheme changes. color_scheme is used for modes without
a specific color scheme.

The colors are applied in a new session color layer, above the colors of
the window and below colors set by programs. They are associated with the
color stack entry pushed by the ssh kitten and are removed when it is
popped, so nested sessions work and the colors are restored on exit.

Configs that only use color_scheme continue to use escape codes exactly
as before, as does the kitten when running inside tmux.

Fixes #10724
2026-10-23 09:37:50 +05:30
Kovid Goyal
ef58de6850
Transfer kitten: Replace existing links when receiving files
Receiving a regular file over an existing symlink or hard link used to
truncate and overwrite the file the link points to. Instead, write
received files to a temporary file in the destination directory and
atomically rename it into place once the transfer completes, as was
already done for delta transfers. This also means interrupted transfers
no longer leave truncated files behind.

If the destination directory is not writable, fall back to writing in
place, but only for regular files with a single link, so that no other
file can be affected.

Also use stat rather than lstat when deciding whether to use delta
transfers, so that symlinks to large files can use them, and remove
the temporary file of failed or aborted delta transfers.

Closes #10713
2026-10-21 20:35:07 +05:30
Kovid Goyal
cda133cd26
Fix #10711 2026-10-21 10:45:01 +05:30
Kovid Goyal
05d3ee35ff
Transfer kitten: Clearer errors when the destination is a directory
Refuse to replace an existing directory, or a symlink to a directory, with
a file, reporting EISDIR before any data is transferred instead of a raw
OSError (or silently replacing the symlink). Report failures to create
parent directories with the actual errno and directory name. When a send
fails, the kitten now prints hints for the common causes: a missing
trailing slash on a directory destination and a ~ expanded by the shell
on the remote machine.

Fixes #8118
Closes #10710
2026-10-21 06:14:21 +05:30
Kovid Goyal
4cb9765743
ssh kitten: Reconnect when a shared connection has silently died
When the connection of an existing ControlMaster to the server dies
without the master noticing, for example after a network change or
suspend, new sessions using it hang. ssh -O check does not detect this
as it only talks to the master over its local socket.

Check the master in parallel with starting the session, using a request
that requires a round trip to the server, so that there is no added
latency when the master is healthy. If the master does not respond in
time, kill the stuck session, stop the master and start the session
again over a new connection. Similarly time out the port forward request
used by forward_remote_control and retry it with a new master.

Fixes #10691
2026-10-19 07:20:03 +05:30
Kovid Goyal
56deb9e86d
transfer kitten: Fix receiving empty files
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
The output file for a regular file was only created when the
decompressor first emitted data, which never happens for an empty file.
So empty files were not created and existing destination files were
left with their old contents. Open the output file as soon as the first
chunk for a regular file arrives instead.

Closes #10689
2026-10-18 14:33:13 +05:30
Kovid Goyal
f426c08f5d
Apply deferred directory permissions children first when extracting tar
A parent directory without search permission prevents changing the
permissions of its children, so apply the deferred chmods in reverse
order, as GNU tar does. Also add a test and changelog entry for #10676.
2026-10-16 19:12:51 +05:30
devangpratap
6e41991430 Fix extracting tar archives with read-only directories 2026-10-16 09:26:26 -04:00
Kovid Goyal
163e271250
Fix #10658 2026-10-13 08:21:05 +05:30
Kovid Goyal
4fa2cf249d
Cleanup previous PR
Require ModeSymlink when checking the SymlinkToDir marker as it shares a
bit with the other-execute permission, use a single helper for the check,
avoid stat() on hidden entries that will be skipped and treat symlinks to
directories as directories in save file path completion.
2026-10-12 09:36:21 +05:30
Zhizhen He
38ed84edf5
choose-files: Handle symlinks to directories
Recognize the existing directory-symlink marker when scanning, filtering
and deciding which results can be selected. Resolve symlinks before file
filters and cover directory selection and filtered navigation.
2026-10-12 10:08:06 +08:00
Kovid Goyal
216c77fdda
Fix #10651 2026-10-11 20:22:52 +05:30
Kovid Goyal
b00de8c4bb
more minor fixes inspired by previous PR 2026-10-10 11:29:31 +05:30
Kovid Goyal
c406b136cb
Cleanup previous PR
- Only restore entry sizes in the Splits layout resize mode was opened in;
  otherwise fall back to the default reset rather than refusing to reset
- Do not take a snapshot lazily from already resized sizes when resize mode
  was opened in another layout
- Running the resize kitten while its overlay is open replaces the overlay so
  the new options take effect, keeping the original-size snapshot
- Newer edge statuses replace older local messages, and edge failures beep
- Switching strategy no longer discards a --fraction command-line override
- Compute divider room without deep copying the pair subtree
- Fractional resize in other layouts adopts the probed state instead of
  replaying every step
2026-10-09 19:51:38 +05:30
Kovid Goyal
bbe1f53bd6 Merge branch 'pr-10636' 2026-10-09 19:42:48 +05:30
Kovid Goyal
e55d14085a
Cleanup previous PR
- Parse in-band resize reports robustly: require the 48; prefix, accept
  extra parameters and reject negative values instead of panicking
- Handle bracketed paste in parse_input_from_terminal with a dedicated
  scan for the end of paste marker so pasted escape bytes are never lost
- Guard against NaN in scroll_by_pixels and scroll_to_absolute, clamp
  negative absolute scroll targets, let infinite fractional scrolls clamp
  and propagate overflow errors from PyLong_AsDouble
- Empty disk cache entries no longer claim offset 0 in the cache file and
  defrag only moves entries actually written to disk
- Reject zero and too large block sizes in rsync signature headers
- Only replace the encryptor tag once it has been read successfully
2026-10-09 18:37:48 +05:30