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

dump_data() issues #29

Closed
divergentdave opened this issue Jul 27, 2019 · 2 comments
Closed

dump_data() issues #29

divergentdave opened this issue Jul 27, 2019 · 2 comments

Comments

@divergentdave
Copy link
Contributor

I tried parsing a corrupt PDF file, and the program panicked with the following error. The unwrap() was in dump_data().

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Custom { kind: NotFound, error: PathError { path: "/tmp/pdf/oTRQva", err: Os { code: 2, kind: NotFound, message: "No such file or directory" } } }', src/libcore/result.rs:999:5

After I created a /tmp/pdf directory, the panic went away. However, since I didn't have logging on, it created a file in /tmp/pdf without notifying me of its presence. I'd recommend two changes to this function:

  • Instead of specifying a subdirectory, use the OS's default directory, and provide a file name prefix like pdf-
  • Only write files out when an environment variable is set, and log a message with instructions on setting the environment variable to dump the buffer if the environment variable is not set
@s3bk
Copy link
Contributor

s3bk commented Jul 27, 2019

it will now only write if you set PDF_OUT to a directory.

@divergentdave
Copy link
Contributor Author

Sounds good, thanks!

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

No branches or pull requests

2 participants