Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panicking in item_sort_list/resolver when trying to parse time #36

Closed
caemor opened this issue Feb 14, 2022 · 3 comments
Closed

Panicking in item_sort_list/resolver when trying to parse time #36

caemor opened this issue Feb 14, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@caemor
Copy link

caemor commented Feb 14, 2022

Image Sieve panics when I try to add my image folders in the following line:

let date_time =
NaiveDateTime::parse_from_str(&date_time_str, "%Y-%m-%d %H:%M:%S")
.unwrap();

The time information seems to be stored slightly different than what the parser expects: YYYY:MM:DD HH:MM:SS (2021:09:26 18:22:29)

The crash message with RUST_BACKTRACE=1:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: ParseError(OutOfRange)', /home/caemor/.cargo/registry/src/github.com-1ecc6299db9ec823/image_sieve-0.5.2/src/item_sort_list/resolvers.rs:101:34
stack backtrace:
   0: rust_begin_unwind
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:498:5
   1: core::panicking::panic_fmt
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panicking.rs:107:14
   2: core::result::unwrap_failed
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/result.rs:1613:5
   3: <image_sieve::item_sort_list::resolvers::ExifResolver as image_sieve::item_sort_list::item_traits::PropertyResolver>::get_timestamp
   4: image_sieve::item_sort_list::file_item::FileItem::new
   5: image_sieve::item_sort_list::item_list::ItemList::check_and_add
   6: image_sieve::synchronize::synchronize_run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: PoisonError { .. }', /home/caemor/.cargo/registry/src/github.com-1ecc6299db9ec823/image_sieve-0.5.2/src/main_window.rs:145:47
stack backtrace:
   0: rust_begin_unwind
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:498:5
   1: core::panicking::panic_fmt
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panicking.rs:107:14
   2: core::result::unwrap_failed
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/result.rs:1613:5
   3: image_sieve::main_window::MainWindow::run
   4: image_sieve::main
@Futsch1 Futsch1 added the bug Something isn't working label Feb 15, 2022
@Futsch1 Futsch1 changed the title Packing in item_sort_list/resolver when trying to parse time Panicking in item_sort_list/resolver when trying to parse time Feb 15, 2022
@Futsch1
Copy link
Owner

Futsch1 commented Feb 15, 2022

First of all, many thanks for providing the issue report and the traceback!

The format of the date returned by kamadak-exif is always in exactly this format: YYYY-MM-DD HH:MM:SS (see https://github.com/kamadak/exif-rs/blob/ab77d185919e256e87fd271dd881ef84f10dff8d/src/tiff.rs#L389).

According to the trace, the reason is the ParseError(OutOfRange) returned by chrono. So the root cause for the error should be an invalid datetime in the exif data of an image (like, a month > 12). However, this error should be handled gracefully by using the file timestamp instead in this case.

@Futsch1
Copy link
Owner

Futsch1 commented Feb 16, 2022

Fix was committed, will be fixed in next release.

@Futsch1 Futsch1 closed this as completed Feb 16, 2022
@caemor
Copy link
Author

caemor commented Feb 16, 2022

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants