Skip to content

Commit 7f00fa5

Browse files
authored
Merge pull request #669 from emmertex/fix/release-26.44.1-ci2
Release 26.44.1: full-CI fixes (2)
2 parents 8c6e7aa + f929d90 commit 7f00fa5

11 files changed

Lines changed: 46 additions & 11 deletions

File tree

‎crates/catalog/src/safe_file.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,9 @@ mod tests {
585585
let _smb = full_sync_unsupported();
586586
write_atomic(&d.join("DSC_0001.xmp"), b"<x/>").unwrap();
587587
}
588-
assert_eq!(plain_fsyncs_on_this_thread() - before, 2, "the file and its folder");
588+
// (Windows can't open a folder to flush it: NTFS journals the rename, `sync_dir`)
589+
let expected = if cfg!(windows) { 1 } else { 2 };
590+
assert_eq!(plain_fsyncs_on_this_thread() - before, expected, "the file and its folder");
589591
assert_eq!(names(&d), vec!["DSC_0001.xmp"]);
590592
assert!(flush_unsupported(&enotsup()));
591593
assert!(!flush_unsupported(&io::Error::from(io::ErrorKind::StorageFull)));

‎crates/engine/src/cmd/plugins.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1551,7 +1551,7 @@ mod tests {
15511551
assert_eq!(std::fs::read_to_string(&job).unwrap(), "1\n", "the files are written before the start");
15521552
let started = desktop.requests();
15531553
assert!(
1554-
matches!(started.as_slice(), [crate::desktop::Request::StartProgram { args, tmp, .. }] if args == &[job.display().to_string()] && tmp == &folder),
1554+
matches!(started.as_slice(), [crate::desktop::Request::StartProgram { args, tmp, .. }] if args == &[format!("{}/job.txt", folder.display())] && tmp == &folder),
15551555
"{started:?}"
15561556
);
15571557
let rows: Vec<_> = s.activity.list().into_iter().filter(|t| t.kind == "pluginProgram").collect();

‎crates/engine/src/tests_folder_metadata.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ fn a_file_imported_while_a_background_save_waits_is_named_as_the_photo_command_w
485485
s.execute("folder.saveMetadata", &json!({"path": src.join("d").to_string_lossy(), "background": true})).unwrap();
486486
// x.png joins d/ before the first pump: it sorts before x.tif, so it now owns the stem sidecar x.xmp
487487
std::fs::copy(src.join("other/x.png"), src.join("d/x.png")).unwrap();
488-
s.execute("library.import", &json!({"paths": [src.join("d/x.png").to_string_lossy()]})).unwrap();
488+
s.execute("library.import", &json!({"paths": [src.join("d").join("x.png").to_string_lossy()]})).unwrap();
489489
let r = s.execute("folder.metadataPump", &json!({})).unwrap();
490490
assert_eq!(r["result"]["total"], 1, "{r}");
491491
let id = s.catalog.photos().find(|p| p.file_name == "x.tif").unwrap().id;

‎crates/fetch/src/tests.rs‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,10 +494,13 @@ fn the_overall_deadline_stops_a_trickling_server() {
494494

495495
#[test]
496496
fn file_urls_are_percent_decoded_but_bare_paths_keep_their_percent_signs() {
497-
let bare = mirrors(Some("/models/50%20off"), None, &[]);
497+
// an absolute path on this OS (`/models` is relative on Windows)
498+
let root = if cfg!(windows) { "C:/models" } else { "/models" };
499+
let bare = mirrors(Some(&format!("{root}/50%20off")), None, &[]);
498500
assert_eq!(bare.len(), 1);
499-
assert_eq!(local_path(&bare[0]), Some(std::path::PathBuf::from("/models/50%20off")));
500-
assert_eq!(local_path("file:///models/my%20sam3"), Some(std::path::PathBuf::from("/models/my sam3")));
501+
assert_eq!(local_path(&bare[0]), Some(std::path::PathBuf::from(format!("{root}/50%20off"))));
502+
let url = format!("file:///{}/my%20sam3", root.trim_start_matches('/'));
503+
assert_eq!(local_path(&url), Some(std::path::PathBuf::from(format!("{root}/my sam3"))));
501504
for hostile in ["file:///x%", "file:///x%2", "file:///x%zz", "file:///x%ff", "file:///x%0a"] {
502505
assert_eq!(local_path(hostile), None, "{hostile}");
503506
}

‎crates/plugins/src/safe_io.rs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,18 @@ pub(crate) fn write_checked(path: &Path, bytes: &[u8]) -> std::io::Result<()> {
8888
})
8989
}
9090

91+
/// Read at most `max` bytes of the app's own file at `path` (no link check: the path is the app's,
92+
/// not one a plug-in named, and needn't be canonical, e.g. `/var` vs `/private/var` on macOS).
93+
pub(crate) fn read_capped(path: &Path, max: u64) -> std::io::Result<Vec<u8>> {
94+
let f = File::open(path)?;
95+
let mut out = Vec::new();
96+
f.take(max.saturating_add(1)).read_to_end(&mut out)?;
97+
if out.len() as u64 > max {
98+
return Err(std::io::Error::new(std::io::ErrorKind::InvalidData, format!("larger than {max} bytes")));
99+
}
100+
Ok(out)
101+
}
102+
91103
/// Read at most `max` bytes of the regular file at the resolved `path`, refusing a link swapped
92104
/// in after the check (the opened file must be the very file at `path`, not reached through a
93105
/// link).

‎crates/plugins/src/settings.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl SettingsStore {
7373
/// moves it aside).
7474
pub fn open(path: PathBuf) -> (SettingsStore, Option<String>) {
7575
let mut store = SettingsStore { path: Some(path.clone()), ..SettingsStore::default() };
76-
let read = match crate::safe_io::read_checked(&path, MAX_SETTINGS_BYTES as u64) {
76+
let read = match crate::safe_io::read_capped(&path, MAX_SETTINGS_BYTES as u64) {
7777
Ok(b) => serde_json::from_slice::<File>(&b)
7878
.map_err(|e| e.to_string())
7979
.and_then(|f| if f.format > FORMAT { Err(format!("written by a newer version (format {})", f.format)) } else { Ok(f) }),

‎crates/plugins/tests/abi.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ fn program_start_writes_the_files_then_starts_one_run_at_a_time() {
327327
assert_eq!(run.found.bundle_id.as_deref(), Some("org.example.conv"), "the first installed bundle id in the entry's order");
328328
}
329329
let job = run.dir.path().join("job.txt");
330-
assert_eq!(run.args, vec!["-i".to_string(), job.display().to_string()]);
330+
// `{tmpDir}` is replaced as written: on Windows that is `C:…un/job.txt`, a valid path
331+
assert_eq!(run.args, vec!["-i".to_string(), format!("{}/job.txt", run.dir.path().display())]);
331332
assert_eq!(std::fs::read_to_string(&job).unwrap(), "a\nb\n");
332333

333334
// the run is active: a second start fails and starts nothing

‎crates/ui-egui/src/panels/detail.rs‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4343,7 +4343,16 @@ pub(crate) fn filmstrip(app: &mut LccApp, ui: &mut egui::Ui, r: Rect) {
43434343
let map = app.ui.module == crate::module::ModuleId::Map;
43444344
// in a regular album they are dragged along the strip to put them in Custom Order
43454345
let reorder = !map && super::grid::custom_order_album(app).is_some();
4346-
let resp = ui.interact(cr, egui::Id::new(("film", id.0)), if map || reorder { Sense::click_and_drag() } else { Sense::click() });
4346+
// cells drawn ahead of the scroll (off view, under the side panels) take no clicks or
4347+
// keyboard focus: Tab never lands on a thumbnail nobody can see
4348+
let sense = if !local.intersects(vp) {
4349+
Sense::hover()
4350+
} else if map || reorder {
4351+
Sense::click_and_drag()
4352+
} else {
4353+
Sense::click()
4354+
};
4355+
let resp = ui.interact(cr, egui::Id::new(("film", id.0)), sense);
43474356
let failed = app.renderer.thumb(*id).is_none() && app.renderer.failure(Slot::Thumb(*id)).is_some();
43484357
crate::widgets::announce(&resp, film_spoken(app.session.catalog.photo(*id).map_or("", |p| p.file_name.as_str()), failed));
43494358
if (map || reorder) && resp.drag_started() {

‎crates/ui-egui/src/tests_folder_drop.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ fn dont_ask_again_moves_the_next_drop_at_once() {
364364
fn dont_ask_again_is_kept_only_when_the_move_began() {
365365
let (root, trip, home) = folders("dont-ask-refused");
366366
let mut h = app(&[(trip.join("beach.png"), false), (home.join("garden.png"), false)]);
367-
click(&mut h, &format!("libraryFolderToggle:{}", root.display()));
367+
click(&mut h, &format!("libraryFolderToggle:{}", tree_path(&root)));
368368
let target = folder_row(&h, &home).unwrap();
369369
let beach = id_of(&h, "beach.png");
370370
// a file of that name is in the folder already (not in the library): the move is refused
@@ -385,7 +385,7 @@ fn dont_ask_again_is_kept_only_when_the_move_began() {
385385
fn dont_ask_again_is_kept_only_when_a_photo_moved() {
386386
let (root, trip, home) = folders("dont-ask-already");
387387
let mut h = app(&[(trip.join("beach.png"), false), (home.join("garden.png"), false)]);
388-
click(&mut h, &format!("libraryFolderToggle:{}", root.display()));
388+
click(&mut h, &format!("libraryFolderToggle:{}", tree_path(&root)));
389389
let target = folder_row(&h, &home).unwrap();
390390
let beach = id_of(&h, "beach.png");
391391
drop_beach(&mut h, beach, target);

‎docs/changelog/26.44.1.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747

4848
## Fixes
4949

50+
- **Plug-in settings kept on macOS and Windows:** a plug-in's settings and remembered dialog values were saved
51+
but read back as the defaults, because the read refused a settings path that wasn't already canonical
52+
(`/var` vs `/private/var`, the `\\?\` prefix on Windows). (no PR)
53+
- **Tab skips hidden filmstrip thumbnails:** thumbnails drawn ahead of the filmstrip's scroll, under the side
54+
panels, no longer take keyboard focus. (no PR)
5055
- **Samsung NX1 / NX500 / NX3000 / NX mini raws are raws again:** the file sniffer counts TIFF compression 32772 or
5156
32773 as raw data only with a Samsung Make and a CFA pattern in the same directory (IFD0 or a SubIFD), so these
5257
SRWs route to the raw decoder while an ordinary PackBits TIFF stays a TIFF. Thanks @Kaan88. (no PR)

0 commit comments

Comments
 (0)