arx icon indicating copy to clipboard operation
arx copied to clipboard

Arx crash if given path doesn't exist.

Open mathe00 opened this issue 1 year ago • 1 comments

Hi,

I'd like to report a crash in arx. Apologies if this is a duplicate issue, I’m reporting it quickly.

Steps to Reproduce:

  1. Tried running the following command:

    arx create --outfile ExampleArchive ExampleArchive.arx
    
  2. arx crashed with the following error message:

    Well, this is embarrassing.
    arx had a problem and crashed...
    
  3. Retried with:

    arx create --outfile ExampleArchive/ ExampleArchive.arx
    

    It crashed again with a similar error.

Environment:

  • OS: Arch Linux [64-bit]
  • arx version: 0.2.1
  • Crate version: 0.2.1

Error Details:

  • The crash occurred in the file /libarx-0.2.1/src/create/fs_adder.rs at line 143.
  • Cause: called Result::unwrap() on an Err value: Error { depth: 0, inner: Io { path: Some("ExampleArchive.arx"), err: Os { code: 2, kind: NotFound, message: "No such file or directory" } } }.

Crash Report (as extracted):

"name" = "arx"
"operating_system" = "Arch Linux [64-bit]"
"crate_version" = "0.2.1"
"explanation" = """
Panic occurred in file '/home/temo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libarx-0.2.1/src/create/fs_adder.rs' at line 143
"""
"cause" = 'called `Result::unwrap()` on an `Err` value: Error { depth: 0, inner: Io { path: Some("ExampleArchive.arx"), err: Os { code: 2, kind: NotFound, message: "No such file or directory" } } }'
"method" = "Panic"
"backtrace" = """

   0: 0x5e85a33ebce6 - core::result::unwrap_failed::h635713c629d81684
   1: 0x5e85a33ff8d7 - libarx::create::fs_adder::FsAdder::add_from_path_with_filter::h3eaec6ef31c11959
   2: 0x5e85a34071cc - arx::create::create::hb3e18840522cc531
   3: 0x5e85a3423601 - arx::main::h417fd83e1d4276d2
   4: 0x5e85a3416b03 - std::sys_common::backtrace::__rust_begin_short_backtrace::h95ea882ff6bfd673
   5: 0x5e85a3426a39 - std::rt::lang_start::{{closure}}::ha16fb5f386b2120b
   6: 0x5e85a377ab40 - std::rt::lang_start_internal::h5add80e16e4e0045
   7: 0x5e85a3426a25 - main
   8: 0x73b12df7de08 - <unresolved>
   9: 0x73b12df7decc - __libc_start_main
  10: 0x5e85a33ebf05 - _start
  11:        0x0 - <unresolved>"""

Thanks for looking into this! Let me know if you need further details.

mathe00 avatar Sep 24 '24 19:09 mathe00

This is because the value after the option --outfile must be the name of the archive to create. Here you pass the directory to archive as outfile. And arx try to archive the archive itself (which doesn't exist yet) The syntax is arx create --outfile archive_path.arx directory/to/archive

But anyway, arx should properly exit with an error message and not crash as it is now. Thanks for the report, I will fix it.

mgautierfr avatar Sep 25 '24 08:09 mgautierfr