Repository navigation
Clashing file names are numbered by one rule, and a name that can't be numbered fails instead of reusing a taken one - #1842
Merged
Conversation
…back to a taken name Export, Edit In, Hard Drive publishing, a catalog's copied originals and a tethered download each numbered a clashing name with a copy of the rule, and the copies had drifted. Trigger -> wrong outcome: a catalog export with 10,000 same-named originals returned the taken name after the last number (`unwrap_or(first)`), and the copy then overwrote the file there; a tethered download fell back to `name-x.ext` and renamed over it when that was taken; publishing fell back to the wanted name; Edit In named an OpenEXR copy's XMP sidecar by its own search (`a.xmp` beside `a-3.exr`), so the sidecar was named for an older copy; the limits were 10,000, 10,000, unbounded, 10,000 and 1,000,000, and one site split a hidden file's name differently. Change: `lcc_catalog::safe_file` gets `split_extension`, `numbered_name`, `first_free_numbered` and `NUMBERED_NAME_TRIES` (1,000,000). The export Placer (and its `split_file_name`), Edit In (`unique_path`, with a group variant that reserves the sidecar's name with the file's), Hard Drive publishing and catalog transfer consume them. Transfer, publishing and the tethered download now fail with "no free file name" when every number is taken instead of using a taken name. The tether crate sits below the catalog and cannot depend on it, so it keeps its own loop (starting at -1 as ever) with the same limit and the same failure. Names given in the cases that worked are unchanged; the one name that differs is a hidden file copied to a catalog's Originals (`.hid` is now `.hid-2`, was `-2.hid`). Tests (each fails with the old behaviour put back: fallback to the taken name in transfer, publish and tether; sidecar reservation in Edit In; an inclusive bound in the helper): `numbered_names_split_at_the_last_dot_and_start_where_asked`, `a_copied_original_takes_a_free_name_and_never_a_taken_one`, `hard_drive_free_name_steps_over_taken_numbers_and_fails_when_none_is_left`, `a_download_takes_a_free_name_and_never_a_taken_one`, `a_copy_takes_the_first_free_number_and_a_sidecar_goes_with_its_file`. Manual: library/stacks, output/publish-services Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1838 (entry 16).
In short: five places pick "the next free numbered name" (
-2,-3…) separately: export, Edit In, publish to a folder, copying originals into the library, and the tether download. They disagreed on where to start, how far to go and what to do when there is none. Three of them fell back to a name that was already taken: copying an original into the library's Originals folder, publish, and tether (name-x.ext, which may itself be taken). The copy into Originals then overwrote the existing file. They now share one helper and fail with "no free file name" instead.Change
lcc_catalog::safe_filegainssplit_extension,numbered_name,first_free_numberedandNUMBERED_NAME_TRIES(1,000,000). Export's placer, Edit In, publish and the library's transfer use them..xmpwas searched on its own, so it could be named for an older copy..hidbecomes.hid-2, was-2.hid) and that Edit In EXR sidecar (a-3.xmpbesidea-3.exr, wasa.xmp). Names produced by the cases that worked are otherwise unchanged.lcc-*dependencies, so it keeps its own loop, with the same limit and the same failure.library/stacks,output/publish-services. What's new and changelog entries.How it was checked
numbered_names_split_at_the_last_dot_and_start_where_asked,a_copied_original_takes_a_free_name_and_never_a_taken_one,hard_drive_free_name_steps_over_taken_numbers_and_fails_when_none_is_left,a_download_takes_a_free_name_and_never_a_taken_oneanda_copy_takes_the_first_free_number_and_a_sidecar_goes_with_its_filefail with the old behaviour put back. Exhaustion at 1,000,000 can't be built on disk, so each caller has a variant with a small bound (at, below and above pinned). The four sites that look at the disk ask the volume, so they inherit its case rule; no case divergence was found.Questions: see the umbrella (entry 16).
cargo xtask ci --quick --base origin/stagingon this branch (macOS, stagingd4c89211fmerged): fmt, brand, quarantine, docs, notes, i18n, windows, clippy and stamp pass. Tests of lcc-catalog, lcc-engine, lcc-publish and lcc-tether: all pass exceptdevice_sync::tests::a_shared_collection_brings_photos_files_and_edits_both_ways(environmental on that machine) andptp::tests::session_capture_download_delete_over_every_transport(a 5-second wait in the tether simulator: it fails about one run in three on plainstagingtoo, and passed three of three alone on this branch). Parity, layers, assets, wasm and deny: pass.The five branches of this batch (this one and its neighbours) were also merged together on current
stagingand gated as one: fmt, brand, quarantine, docs, notes, i18n, windows, clippy, heif, stamp, parity, layers, assets, wasm and deny pass; the tests fail only where plainstagingfails too (device_sync,translated_catalogs_do_not_use_missing_menu_triangles,tests_phone_menus), plus one timing test inio_schedthat passes alone.🤖 Generated with Claude Code