cobalt.rs
cobalt.rs copied to clipboard
Crash when creating a new blog post
I'm not sure what I did to reproduce this exactly, but it happened earlier today. Cobalt would crash whenever I ran cobalt new in a freshly created blog. Backtrace: cobalt-crash.txt
15: 0x5595501d2903 - core::result::unwrap_failed::h7047a123950875be
at /builddir/build/BUILD/rustc-1.55.0-src/library/core/src/result.rs:1599:5
16: 0x55955035f655 - cobalt::args::get_config::hb2d756c7b0ad5814
17: 0x55955034c03a - cobalt::new::new_command::hfd308009428d6717
18: 0x559550334287 - cobalt::main::h74f06b9bf20f7ee9
Did it print any messages with it? I'm not seeing any unwrap calls but I do see an expect which would print "How does this fail?". That expect is from trying to look up the current working directory.
That was the full log (you can see I included the command invocation at the top to make that clearer). Maybe I just had managed to end up in a nonexistent working directory somehow. I'll report back when I'm on my laptop again.
Oh. missed that, thanks!
It does intrigue me that someone ran into this and maybe I should actually gracefully fail.
I found two simple if contrived ways to recreate this.
Deleting the current working directory:
$ cobalt init /tmp/blog
$ cd /tmp/blog
$ rm -r /tmp/blog
$ cobalt new test
# Well, this is embarrassing.
Removing execute permissions from the use for the directory
$ cobalt init /tmp/blog
$ cd /tmp/blog
$ sudo chmod 600 .
$ cobalt new test
# Well, this is embarrassing.
Notably, if I have execute permissions but not write permissions then I get a more helpful error instead of a crash
$ sudo chmod 500 .
$ cobalt new test
# Error: Could not create document
# Info: caused by Failed to create file /private/tmp/blog/test.md
# Info: caused by Permission denied (os error 13)