shk
February 14, 2021, 9:20am
1
Hi,
I got an error when launching the serve command :
Building site...
-> Creating 2 pages (0 orphan), 1 sections, and processing 0 images
Done in 48ms.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Io(Os { code: 9, kind:
Other, message: "Bad file descriptor" })', src/cmd/serve.rs:281:59
stack backtrace:
0: 0x55aa55623ef0 - <unknown>
1: 0x55aa550f934c - <unknown>
2: 0x55aa55623691 - <unknown>
3: 0x55aa55622f8b - <unknown>
4: 0x55aa5563f378 - <unknown>
5: 0x55aa5563f344 - <unknown>
6: 0x55aa5563f2fd - <unknown>
7: 0x55aa550f6a30 - <unknown>
8: 0x55aa550fd992 - <unknown>
9: 0x55aa54fe49fa - <unknown>
10: 0x55aa54ff487a - <unknown>
11: 0x55aa54f97973 - <unknown>
12: 0x55aa54ff8685 - <unknown>
13: 0x7fa3977b8e0a - __libc_start_main
at /builddir/glibc-2.32/csu/../csu/libc-start.c:314
14: 0x55aa54f4e1da - <unknown>
15: 0x0 - <unknown>
The build is ok, but not the serve.
I’m working on Void Linux, Zola 0.13.0, Rust 1.48.0.
If anyone have an idea.
keats
February 14, 2021, 10:07am
2
That’s interesting. Can you try the first example in notify - Rust ?
shk
February 14, 2021, 10:24am
3
To be honest, I never used rust, so I hope I made it well.
Using this code:
extern crate notify;
use notify::{Watcher, RecursiveMode, watcher};
use std::sync::mpsc::channel;
use std::time::Duration;
fn main() {
// Create a channel to receive the events.
let (tx, rx) = channel();
// Create a watcher object, delivering debounced events.
// The notification back-end is selected based on the platform.
let mut watcher = watcher(tx, Duration::from_secs(10)).unwrap();
// Add a path to be watched. All files and directories at that path and
// below will be monitored for changes.
watcher.watch("/home/test/notify", RecursiveMode::Recursive).unwrap();
loop {
match rx.recv() {
Ok(event) => println!("{:?}", event),
Err(e) => println!("watch error: {:?}", e),
}
}
}
[11:22] >> rustc test.rs
error[E0463]: can't find crate for `notify`
--> test.rs:1:1
|
1 | extern crate notify;
| ^^^^^^^^^^^^^^^^^^^^ can't find crate
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
Looks like you haven’t installed notify.
shk
February 15, 2021, 8:09am
5
When I try a cargo install notify, I get:
[08:55] >> cargo install notify
Updating crates.io index
Downloaded notify v4.0.15
Downloaded 1 crate (54.9 KB) in 1.08s
error: specified package `notify v4.0.15` has no binaries
keats
February 15, 2021, 4:02pm
6
You need to do cargo new testnotify --bin
and add notify = "4.0.15"
in the Cargo.toml file in the testnotify
directory. Then you can replace the content of src/main.rs
with what you have in this thread and run cargo run
shk
February 15, 2021, 5:37pm
7
Thank you for your explanations. I did it, but I got the same error I get when launching zola serve:
cargo run
Updating crates.io index
Downloaded mio-extras v2.0.6
Downloaded lazycell v1.3.0
Downloaded mio v0.6.23
Downloaded net2 v0.2.37
Downloaded notify v4.0.15
Downloaded filetime v0.2.14
Downloaded inotify v0.7.1
Downloaded same-file v1.0.6
Downloaded log v0.4.14
Downloaded inotify-sys v0.1.5
Downloaded walkdir v2.3.1
Downloaded libc v0.2.86
Downloaded 12 crates (845.6 KB) in 1.26s
Compiling libc v0.2.86
Compiling log v0.4.14
Compiling cfg-if v1.0.0
Compiling cfg-if v0.1.10
Compiling bitflags v1.2.1
Compiling slab v0.4.2
Compiling lazycell v1.3.0
Compiling same-file v1.0.6
Compiling walkdir v2.3.1
Compiling net2 v0.2.37
Compiling iovec v0.1.4
Compiling inotify-sys v0.1.5
Compiling filetime v0.2.14
Compiling inotify v0.7.1
Compiling mio v0.6.23
Compiling mio-extras v2.0.6
Compiling notify v4.0.15
Compiling testnotify v0.1.0 (/home/testing/testnotify)
Finished dev [unoptimized + debuginfo] target(s) in 1m 33s
Running `target/debug/testnotify`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Io(Os { code: 9, kind: Other, message: "Bad file descriptor" })', src/main.rs:9:60
stack backtrace:
0: 0x55b234771610 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc5cc02b3e453225b
1: 0x55b23478b63c - core::fmt::write::h5437b03347b2ec7a
2: 0x55b23476e195 - std::io::Write::write_fmt::h16241c6ed218e16f
3: 0x55b2347739ad - std::panicking::default_hook::{{closure}}::h345f4275bb854b6c
4: 0x55b234773658 - std::panicking::default_hook::he532b712c71e2106
5: 0x55b234774091 - std::panicking::rust_panic_with_hook::hf0f7347c753b38c2
6: 0x55b234773c39 - std::panicking::begin_panic_handler::{{closure}}::h274b8a0752683642
7: 0x55b234771a7c - std::sys_common::backtrace::__rust_end_short_backtrace::hdb383c60eb8b212f
8: 0x55b234773bf9 - rust_begin_unwind
9: 0x55b23478a951 - core::panicking::panic_fmt::h8d2c19297fe96b44
10: 0x55b23478a773 - core::option::expect_none_failed::h1a6f64ce49780e5b
11: 0x55b2346b8690 - core::result::Result<T,E>::unwrap::h153698ba41e7649b
at /builddir/rustc-1.48.0-src/library/core/src/result.rs:973
12: 0x55b2346afc67 - testnotify::main::hc6d080588637a33e
at /home/testing/testnotify/src/main.rs:9
13: 0x55b2346ad74b - core::ops::function::FnOnce::call_once::hc7cabb8185039193
at /builddir/rustc-1.48.0-src/library/core/src/ops/function.rs:227
14: 0x55b2346af67e - std::sys_common::backtrace::__rust_begin_short_backtrace::he0bb11180eda92c4
at /builddir/rustc-1.48.0-src/library/std/src/sys_common/backtrace.rs:137
15: 0x55b2346ad201 - std::rt::lang_start::{{closure}}::h7d1e44096e4ec86b
at /builddir/rustc-1.48.0-src/library/std/src/rt.rs:66
16: 0x55b2347744b7 - std::rt::lang_start_internal::h0c3fae9f987cf9c0
17: 0x55b2346ad1d7 - std::rt::lang_start::h13b856a3d9a8c2be
at /builddir/rustc-1.48.0-src/library/std/src/rt.rs:65
18: 0x55b2346aff5a - main
19: 0x7fd8c666ae0a - __libc_start_main
at /builddir/glibc-2.32/csu/../csu/libc-start.c:314
20: 0x55b2346ad0ca - _start
21: 0x0 - <unknown>
I’m confused. I never touched to Rust, so it’s new stuff for me.
keats
February 16, 2021, 10:14am
8
Ok so it looks like a bug in the notify library then.
@shk any chance you can open an issue in Issues · notify-rs/notify · GitHub ? I tried to do it but it asks things like filesystem and I don’t know your full setup. You can link back to this issue.