Skip to content

Fix/medium bugs - #107

Merged
THIONG merged 52 commits into
mainfrom
fix/medium-bugs
Nov 16, 2026
Merged

THIONG merged 52 commits into
mainfrom
fix/medium-bugs

Conversation

@THIONG

@THIONG THIONG commented Nov 16, 2026

Copy link
Copy Markdown
Member

No description provided.

THIONG and others added 30 commits November 16, 2026 01:14
A tarball whose paths run past 100 bytes, which GNU tar writes with an
"L" header and pax with an "x" record, failed with "GNU tar long headers
are not supported yet" or listed the pax records as junk files with the
names cut short. GitHub and `git archive` tarballs also start with a
global pax header that was extracted as a file.

The reader now applies "L" and pax path, size and mtime to the entry
that follows and skips "K" and global headers, with every payload held
to a limit before it is read. Sizes and times in GNU's base-256 form
are read. A tar made with `tar -C folder .` names everything "./…" and
adds "./" for the folder; the prefix is dropped and the folder is no
longer an entry, which made extraction fail with "empty name". A
.tar.gz split across several gzip members, as pigz writes them, is read
to the end instead of stopping after the first.

interop.sh now extracts GNU, pax and split tarballs with long names and
compares them with the source.

Closes #102

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A tar entry has no compressed size of its own: the whole stream is
compressed, so each one reports its own size. Adding those up made the
status bar say every .tar.xz saved 0.0% and was as large as its
contents.

For the tar family the packed size is now the archive file's, read once
when the listing arrives, and the saving of a plain .tar, a little
larger than what it holds, shows as 0% rather than negative. The
Packed and Saved columns stay empty for their entries, which have
neither.

Closes #103

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every size was divided by 1024 and labelled KB, MB or GB, which read
the other way is several percent too large: a 17.4 MiB file showed as
"17.4 MB" while file managers that count in powers of 1000 said 18.2.
The window, Properties and the CLI now say KiB, MiB and GiB, and the
CLI's rate MiB/s. Properties uses the list's formatter instead of a
copy of its own.

Closes #104

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The disk view's menu showed Ctrl+D next to Duplicate, but nothing
listened for the key. It now duplicates the selection on disk, where the
menu offers it, and not while typing in a field. The shortcut help and
the guide list it.

Closes #101

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It had fallen behind the English one: the path bar keys, F2 on disk,
new folder, Alt+Enter, Alt+P, Ctrl+W, Shift+F10, the mouse side buttons,
the shared clipboard, Esc for a pending cut, and double-click to open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
While a large archive was read, the list said "This folder is empty",
and only the status bar said otherwise. The list now shows the Arca mark
fading in and out above "Opening…" and the archive's name, in the
details view and in the active pane, and screen readers are told it is
opening rather than empty. It gives way to the entries, to the password
prompt or to the error as soon as the listing ends.

Closes #105

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With --on-conflict overwrite, two entries of one name both went to the
thread pool, and two threads could write the same file at the same time
and leave a mix of the two. The later entry, which is what extracting in
order leaves, is now the only one written. The test accepted either
entry and failed about one run in ten; it now expects the later one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It asked for a new frame as soon as one was drawn, which kept the window
redrawing as fast as it could for the whole listing; a fade over 1.6
seconds needs far fewer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every file came out of a tarball without execute permission, so on
Linux and macOS an application shipped as a .tar.gz, such as the one in
#102, extracted correctly but would not start. The reader now keeps each
entry's Unix mode, and extraction in the window and the CLI adds its
execute bits to the file. Nothing is ever taken away, and setuid and
the other special bits are never applied. Windows has no such bits and
is unchanged.

interop.sh checks a program and a plain file from a GNU tar.gz.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The window wrote every .tar and .tar.gz entry dated 1970, and both the
window and the CLI recorded every file as 0644, so a program packed on
Linux or macOS came out of the tarball unable to run. Entries now carry
the file's own date everywhere and, on Unix, its own permissions; other
systems keep 0644.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rograms

7z creation put every file in a block of its own and ran LZMA2 on one
thread, and extraction decoded on one thread too.

Files now go into solid blocks of up to 256 MiB, sorted by extension as
7-Zip does, with x86 executables in blocks of their own behind the BCJ
filter. LZMA2 runs multithreaded within the 2 GiB budget the .xz encoder
already keeps to, and files are opened only when their block reaches
them. Decoding uses every core where the stream was written in chunks;
the vendored decoder now caps its threads so that one dictionary each
stays within four times the single-thread limit, since the archive
names the dictionary size.

Measured with `arca create out.7z <dir> -l <level>` and `arca extract`
on 144 MiB of this repository's source, four vendored crates' sources
and three release executables (1,382 files), Windows 11, 16 threads:
fast 9.8 s -> 1.5 s (15.1% -> 14.3% of the input), normal
50.1 s -> 17.9 s (13.5% -> 11.6%), best 57.1 s -> 43.1 s
(13.5% -> 9.9%), extraction 6.4 s -> 3.0 s. WinRAR extracts the result
byte for byte, executables and AES included, and interop.sh now has
7-Zip check an executable and a filtered library.

Entries are listed in the grouped order, like 7-Zip's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Extracting a ZIP whose two entries share a name, both answered Replace,
wrote the two from two threads at the same time, and what was left could
be a mix of both. The later entry, which extracting in order leaves, is
now the only one written, as the CLI already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both are done: the tar reader applies GNU and pax long names, and 7z
creation writes solid blocks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The RAR writer's speed is in the encoder's search and parse, which the
crate does not let a caller tune, so the crate is brought in as
arca-7z's 7z backend was: copied from the crates.io archive (SHA-256
0665518097392be04a322dec9eba41e88028f6aca85f5d61f8abb068691f2266) and
applied with [patch.crates-io], outside the workspace.

This commit is the published source as it is, so the changes that
follow can be read on their own. Only the packaging differs: the
[[bench]] targets go with the omitted benches/, the manifest gains an
empty [workspace] so its own tests run with --manifest-path, and a
.gitattributes keeps every file byte for byte.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Creating a RAR at Normal took 284 s on 144 MiB of source and
executables (1,382 files), against 2.8 s for WinRAR -m3. The time went
three ways:

- The crate's parallel feature was off, and with it on, the 256 MiB
  writer budget admitted one job at a time: the writer charges each job
  about 260 MiB, though sixteen of them stayed under 230 MiB resident.
  The feature is now on and the budget 4 GiB.
- The optimal parse searched a member's first block with the binary
  tree and every later block with hash chains, which carry that load
  worst. A member with no history now keeps the tree throughout.
- Normal (rars level 3) searched 128 candidates out to 512 bytes and
  priced each block three times. It now searches 32 out to 64 bytes and
  prices twice; level 2 prices once. Levels 4 and 5, which Arca's levels
  7 to 9 use, keep the full parse.

Measured with `arca create out.rar <dir> -l <level>` on that corpus,
Windows 11, 16 threads, each run varying by about a fifth:
normal 284 s -> 26-43 s (21.0 -> 21.6 MiB, WinRAR -m3 20.9 MiB),
best -> about 130-220 s at 20.9 MiB. Fast is byte-identical to before.
Every archive passes UnRAR t. The crate's own RAR 5 tests pass (572);
the one failing test in its whole suite, a timestamp boundary, fails
the same way unpatched. --threads is no longer refused for .rar, which
now always uses the cores its budget allows.

The patches are listed in arca-rar/vendor/PATCHES.md, the new crates
the parallel feature brings are in RAR-NOTICES.txt, and the
distribution plan records the change of scope.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The multithreaded LZMA2 reader turned on in f62e151 decodes each run
between dictionary resets into memory in full, and a stream without
resets is one run as large as its block. A small crafted 7z could make
test, preview or extraction allocate gigabytes and abort the window.
Decoding is back on one thread until the reader is bounded; creation
keeps every core, and the vendored thread cap stays for when it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The writer had only ustar's fields, and three things went wrong:

- A size from 8 GiB up lost its top digits, so the archive recorded a
  smaller size than it held and every reader fell out of step on the
  next header. It is now written in base 256 and in a pax record.
- Splitting a name of more than 100 bytes sliced the string at byte 156,
  which panics inside a multi-byte character such as ñ or a CJK one and,
  with panic = abort, closed the window. The split now happens on bytes,
  at an ASCII slash.
- A name that ustar cannot hold at all, or a time before 1970, made the
  archive fail; both now go in a pax header, which GNU tar reads (checked
  with GNU tar 1.35 on a 310-byte name of ñ, é and ü).

A source that grew after its size was taken now writes only the size
recorded, instead of extra bytes ahead of the error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iles

A tar cut inside a header listed as complete with its later entries
missing, because any short read was taken as the end, and that included
the "unexpected end" a gzip or xz decoder reports when its stream is
cut. Data cut at a block boundary was not noticed either, having no
padding to read. Only a tar that stops where a header would start now
ends quietly; anything else is an error.

Every entry type was extracted as a regular file, so hard and symbolic
links came out as empty files and a GNU sparse file came out as its
compacted data. Entries now carry their type: the CLI and the window
skip links, devices and pipes when extracting, and sparse and
multivolume entries are refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A deflate stream that inflates far past its declared size kept writing
until the disk was full, and entries pointing at the same data let a few
kilobytes expand to terabytes. Decompression now stops one byte past the
declared size, and the reader refuses entries whose data overlaps.

The reader also walks every central directory header instead of stopping
at the end record's count, which writers store modulo 65,536 past 65,535
entries; such archives used to be listed short and lose entries when
rewritten. The writer switches to Zip64 at 65,535 entries and refuses
names longer than the reader accepts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Removing, renaming or adding files rebuilt every surviving entry: it reset
the external attributes to 0644, dropped the extra fields and the entry
comment, re-encoded CP437 names as UTF-8, encrypted plain entries of a
mixed archive with the password and turned ZipCrypto entries into AES.
Losing the executable bit or the NTFS times on a remove is data loss.

When the password does not change, surviving entries are now copied as
they stand, local header and compressed bytes included, with the central
directory fields carried over. No password is needed to remove or rename
in an encrypted archive; a password given for added files is checked
against the archive first. Streamed ZipCrypto entries keep flag bit 3 and
get a fresh data descriptor, since their password check uses the time.
A password change still re-encrypts but keeps attributes and extras.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overwriting during ZIP extraction truncated the target before the entry
was decoded, so a wrong password or a corrupt entry destroyed the file it
was meant to replace; the window then deleted what was left. Entries that
replace a file, and every large entry in the CLI, are now written to a
temporary file beside the target and renamed over it only on success.
Small CLI entries are decoded into memory before the file is opened.

Names handed out during one extraction are now compared the way the file
system compares them: on Windows and macOS `A.txt` and `a.txt` are one
file, and two threads writing them at once left a mix of both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ZIP, TAR and TAR.GZ were written straight over the output, so a stop or
an error halfway destroyed the archive being replaced, and the window
replaced them without asking; only 7z asked. Every format now asks before
replacing a file, and ZIP and TAR are built under a temporary name and
renamed into place once complete, as TAR.XZ and XZ already were.

An archive written into a folder it is made from also took itself in,
or the older archive it was replacing. The output and its temporary are
now left out of the walk in the CLI and the window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The undo step was recorded when an edit started, so an edit that failed
still offered Undo, and it could put back a stale copy left beside the
archive by an earlier session. It is now kept on the task and offered
once the task is done, or when a rewrite failed after moving the archive
aside and the kept copy is the only one left.

Undo itself removed the archive before renaming the kept copy over it,
which lost the archive if the rename failed and failed outright when a
rewrite had left no archive. It is now a single rename.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Windows an entry named `file:stream` was written into an alternate
data stream of `file`, which can sit outside anything the archive
created. Extraction now refuses a colon anywhere in a name there.

Moving a symbolic link to the Linux trash canonicalized the whole path,
so the file the link pointed at was trashed and the link left behind.
Only the parent folder is made absolute now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ywhere

Closing the window during an install, by its button, Alt+F4 or the
taskbar, stopped it halfway and left a folder that was neither version.
Close is now refused until the install has finished.

The installer killed Explorer with taskkill /F whenever the shell
extension was in use, closing every open folder window. The locked DLL
is already renamed aside and replaced, so the restart is gone; the new
menu loads with the next Explorer.

The leftover sweep deleted any file whose name held ".old-" in the
install folder, which can be a folder of the user's choosing. It now
removes only numbered copies of Arca's own files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refusing a colon stopped the whole extraction at the first entry with
one, and names like `10:30.log` are common in archives made on Linux or
macOS. The colon is now written as `_` there, as other Windows tools
do, which still keeps every entry out of NTFS alternate data streams.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The rows of the open folder were rebuilt from every entry two to four
times a frame (list, footer, preview, each pane), and checking whether a
folder row was picked walked the whole archive with an allocation per
entry, for every visible folder. With 100,000 entries that was about
50 ms a build.

Rows are now kept per (folder, filter, order, view) and rebuilt only
when one of those or the entries change; every change to the entry list
bumps a generation that drops them. Folder checks use an index sorted by
name, so they look only at the entries under the folder.

Measured with:
cargo test -p arca-gui --release rows_of_a_large_archive -- --ignored --nocapture

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The sidebar looked at every drive letter from A to Z, the user folders
and, on Linux, user-dirs.dirs on every frame, and ran lsblk on the UI
thread every three seconds. A mapped network drive nobody answers for
blocks that call until the network gives up, so the window froze.

All of it is now read on a thread every three seconds, and the window
draws the last reading. It runs from the main frame, so search still
sees the drives when the sidebar is hidden.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An indeterminate progress bar was animated, which asks egui for a frame
at the display's rate for as long as it shows, though with rounded
corners there is no spinner drawn in it. Resting on a folder asked for
a frame every 120 ms for as long as the pointer stayed, after the peek
card had long appeared. A paused task kept the 100 ms poll running.

The bar is no longer animated, the peek asks for one frame when its
card is due, and paused tasks are not polled until they are resumed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move to and Copy to opened the native folder picker on the UI thread,
so the window stopped painting and task progress froze while it was
open; every other picker already ran on a thread, and so do these now.

Properties walked a folder of up to 50,000 entries before it opened,
which on a network share or a slow disk froze the window for seconds.
It now opens at once and fills in the size and counts when a walk on
its own thread finishes.

The compress dialog read the size and kind of every input on every
frame and laid out every row; with a thousand dropped files that was
two thousand file system calls a frame. It reads them once per list
and lays out only the rows in view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
THIONG and others added 22 commits November 16, 2026 20:37
The band remembered the selection per archive entry and each row read
it back by its position on screen. Inside any folder those orders
differ, so a Ctrl-drag dropped rows picked earlier and picked rows whose
position matched an entry checked somewhere else. It now remembers one
flag per row on show.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Before every job the window checked the RAR password by testing the
whole archive, so a multi-gigabyte encrypted RAR was decoded in full
before anything was extracted, and again for the next job. The check
now decodes up to the first encrypted file and stops there; volume sets
still test in full, since they cannot stop early.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Files came out of a RAR on Linux and macOS readable by their owner
alone, because each is written through a temporary file, which is
created 0600, and renamed into place. The temporary is now created
0666 so the umask decides, as for any new file, and the execute bits
a member recorded on Unix are added, as the other formats do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7z and the disk list name a folder by its bare name, where ZIP adds a
trailing slash. A folder row is matched against the entries starting
with its path and a slash, so an empty 7z folder matched nothing and
could not be ticked, and a 7z folder's own entry was left out when the
folder was picked. Folder entries are now compared with the slash on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reading a large archive showed the opening screen with no way out
until it finished. It now has a Cancel button, and Escape does the same:
the reading thread is told to stop, nothing it still sends is applied,
and the window goes back to the folder it came from.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
File managers put copied files on the clipboard as a text/uri-list,
whose lines end in CRLF as its RFC says. arboard splits the list at the
line feed alone and leaves the carriage return on every path, so each
named a file that did not exist and the paste did nothing. The return
is now taken off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A task asking whether to replace a file waits for the answer and does
not look at its stop flag meanwhile, so pressing stop on it did nothing
until somebody answered a question that was no longer on screen.
Stopping it now answers Cancel and takes the question away.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Windows and macOS the disk ignores case, so renaming note.txt to
Note.txt found the new name already taken, by the file itself, and
refused. A name that differs only in case from the old one is now
renamed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The band was cleared only by the drag-stopped event of the blank space
that started it. When rows filled that space mid-drag the space was no
longer there to report the release, and the band stayed alive, forcing
the selection on every later frame. It now ends on any frame where the
primary button is up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RAR creation moved to every core and ignored -j, while the creation
stress harness still expected -j 4 to be refused, so CI failed on it.
-j now sets the size of the pool the writer runs on, as it does for
ZIP and XZ, and the harness checks that -j 4 makes an archive UnRAR
accepts and that the summary says four threads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Extraction opened every folder on the way to the destination without
following links, so a destination under a link was refused with "Not
a directory". On macOS /tmp and /var are links, which made extracting
a TAR, 7z or XZ into the temporary folder fail, and the new CLI test
for archives made inside their own folder failed on macOS CI for it.

The folder somebody names is now resolved once, links included, as the
disk has it. Everything under it is still opened without following
links and stays pinned for the rest of the extraction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous change resolved the whole destination path, the named
folder included, so `-o out` with `out` a link to somewhere else was
followed instead of refused, which the 7z symlink test exists to catch.
Only the folders above the named one are resolved now; the named folder
and everything under it are opened without following links, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The member permissions recorded for extraction are only read by the
reader behind the rar feature, so a build without it failed on a field
that was never read. The field is now behind the feature as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fuzz crate is a workspace of its own, so it did not see the root
[patch] that points rars at the vendored copy, and its Cargo.lock still
described the crates.io release without rayon. CI builds it with
--locked, which refused to update the lock. It now patches rars the
same way the workspace does, and the lock records the vendored backend
and the rayon it uses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@THIONG
THIONG merged commit 4d3931a into main Nov 16, 2026
17 checks passed
@THIONG
THIONG deleted the fix/medium-bugs branch November 17, 2026 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant