summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2022-03-07 17:03:14 +0100
committerCanop <cano.petrole@gmail.com>2022-03-07 17:03:14 +0100
commitc2efd0444ecaba5fd592d7c5b5c5f3b4a61123d6 (patch)
tree99757bc5d0c2c450ac6d6db964b6aae5836699a0
parenta4aac491fcbfaa35eabe4a8ce8666895b7ab94d4 (diff)
don't query size of remote volumes
This prevents a temporary hang when running broot with size option or in filesystem state if a remote volume is unreachable.
-rw-r--r--CHANGELOG.md3
-rw-r--r--Cargo.lock70
-rw-r--r--Cargo.toml7
-rwxr-xr-xcompile-all-targets.sh1
-rw-r--r--src/filesystems/filesystems_state.rs10
-rw-r--r--src/filesystems/mount_list.rs10
-rw-r--r--src/filesystems/mount_space_display.rs2
7 files changed, 72 insertions, 31 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 950f9a6..d039452 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+### next
+- don't query size of remote filesystems anymore. This fixes some 10 seconds hangs in some cases (e.g. filesystem screen) when a remote filesystem is unreachable
+
### v1.9.3 - 2022-02-15
<a name="v1.9.3"></a>
- keep same line visible in preview when resizing
diff --git a/Cargo.lock b/Cargo.lock
index 8857baa..5b91f74 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -61,9 +61,9 @@ dependencies = [
[[package]]
name = "anyhow"
-version = "1.0.53"
+version = "1.0.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "94a45b455c14666b85fc40a019e8ab9eb75e3a124e05494f5397122bc9eb06e0"
+checksum = "159bb86af3a200e19a068f4224eae4c8bb2d0fa054c7e5d1cacd5cef95e684cd"
[[package]]
name = "argh"
@@ -140,7 +140,7 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "broot"
-version = "1.9.3"
+version = "1.9.4-dev"
dependencies = [
"ahash 0.7.6",
"ansi_colours",
@@ -169,7 +169,7 @@ dependencies = [
"libc",
"memmap",
"once_cell",
- "open 2.0.3",
+ "open 2.1.0",
"pathdiff",
"phf",
"rayon",
@@ -204,9 +204,9 @@ dependencies = [
[[package]]
name = "bytemuck"
-version = "1.7.3"
+version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "439989e6b8c38d1b6570a384ef1e49c8848128f5a97f3914baef02920842712f"
+checksum = "0e851ca7c24871e7336801608a4797d7376545b6928a10d32d75685687141ead"
[[package]]
name = "byteorder"
@@ -216,9 +216,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "cc"
-version = "1.0.72"
+version = "1.0.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
+checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
dependencies = [
"jobserver",
]
@@ -573,6 +573,12 @@ dependencies = [
]
[[package]]
+name = "doc-comment"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
+
+[[package]]
name = "either"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -645,9 +651,9 @@ dependencies = [
[[package]]
name = "getrandom"
-version = "0.2.4"
+version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c"
+checksum = "d39cd93900197114fa1fcb7ae84ca742095eed9442088988ae74fa744e930e77"
dependencies = [
"cfg-if",
"libc",
@@ -873,20 +879,20 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "lfs-core"
-version = "0.4.2"
+version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ddf01952bd55b12b51fcd9eba796443b2009ce83d55a1eed3fa13c2f635c232c"
+checksum = "f350c0a93811c29222fb92129c9d98182859208ceeaa3964023c95e22b71889e"
dependencies = [
"lazy-regex",
"libc",
- "thiserror",
+ "snafu",
]
[[package]]
name = "libc"
-version = "0.2.118"
+version = "0.2.119"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "06e509672465a0504304aa87f9f176f2b2b716ed8fb105ebe5c02dc6dce96a94"
+checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4"
[[package]]
name = "libgit2-sys"
@@ -1168,9 +1174,9 @@ dependencies = [
[[package]]
name = "open"
-version = "2.0.3"
+version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4b1e014096a08da72e3287119e0c69a8f6fce61a031a55b1ce2607fe9c2b5a67"
+checksum = "5a82915836ef43159bb6a3c64d884c42329ccd0b8afdca737cf1e3dd701709dc"
dependencies = [
"pathdiff",
"winapi",
@@ -1394,9 +1400,9 @@ dependencies = [
[[package]]
name = "redox_syscall"
-version = "0.2.10"
+version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff"
+checksum = "8380fe0152551244f0747b1bf41737e0f8a74f97a14ccefd1148187271634f3c"
dependencies = [
"bitflags",
]
@@ -1445,9 +1451,9 @@ dependencies = [
[[package]]
name = "rgb"
-version = "0.8.31"
+version = "0.8.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a374af9a0e5fdcdd98c1c7b64f05004f9ea2555b6c75f211daa81268a3c50f1"
+checksum = "e74fdc210d8f24a7dbfedc13b04ba5764f5232754ccebfdf5fff1bad791ccbc6"
dependencies = [
"bytemuck",
]
@@ -1594,6 +1600,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
[[package]]
+name = "snafu"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2eba135d2c579aa65364522eb78590cdf703176ef71ad4c32b00f58f7afb2df5"
+dependencies = [
+ "doc-comment",
+ "snafu-derive",
+]
+
+[[package]]
+name = "snafu-derive"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a7fe9b0669ef117c5cabc5549638528f36771f058ff977d7689deb517833a75"
+dependencies = [
+ "heck",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
name = "splitty"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index ca2d335..b9b6746 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "broot"
-version = "1.9.3"
+version = "1.9.4-dev"
authors = ["dystroy <denys.seguret@gmail.com>"]
repository = "https://github.com/Canop/broot"
documentation = "https://dystroy.org/broot"
@@ -11,7 +11,7 @@ license = "MIT"
categories = ["command-line-utilities"]
readme = "README.md"
build = "build.rs"
-rust-version = "1.58"
+rust-version = "1.59"
exclude = ["website", "broot*.zip"]
[features]
@@ -68,7 +68,7 @@ unicode-width = "0.1.8"
glassbench = "0.3.0"
[target.'cfg(unix)'.dependencies]
-lfs-core = "0.4.2"
+lfs-core = "0.11.0"
users = "0.11"
[target.'cfg(windows)'.dependencies]
@@ -84,6 +84,7 @@ debug = false
debug = false
lto = true
codegen-units = 1 # this removes a few hundred bytes from the final exec size
+strip = true
[[bench]]
name = "fuzzy"
diff --git a/compile-all-targets.sh b/compile-all-targets.sh
index 583d6b0..b67ac94 100755
--- a/compile-all-targets.sh
+++ b/compile-all-targets.sh
@@ -21,7 +21,6 @@ echo " build cleaned"
# build the linux version
echo -e "${H2}Compiling the linux version${EH}"
cargo build --release --features "clipboard"
-strip target/release/broot
mkdir build/x86_64-linux/
cp target/release/broot build/x86_64-linux/
diff --git a/src/filesystems/filesystems_state.rs b/src/filesystems/filesystems_state.rs
index fd83857..903e909 100644
--- a/src/filesystems/filesystems_state.rs
+++ b/src/filesystems/filesystems_state.rs
@@ -66,7 +66,7 @@ impl FilesystemState {
if show_only_disks {
mount.disk.is_some()
} else {
- mount.stats.is_some()
+ mount.stats().is_some()
}
})
.cloned()
@@ -407,7 +407,7 @@ impl PanelState for FilesystemState {
cw.queue_char(border_style, '│')?;
}
// size, used, free
- if let Some(stats) = mount.stats.as_ref().filter(|s| s.size() > 0) {
+ if let Some(stats) = mount.stats().filter(|s| s.size() > 0) {
let share_color = super::share_color(stats.use_share());
// used
if e_use {
@@ -430,7 +430,11 @@ impl PanelState for FilesystemState {
cw.queue_g_string(&share_style, format!("{:>4}", file_size::fit_4(stats.available())))?;
cw.queue_char(border_style, '│')?;
// size
- cw.queue_g_string(txt_style, format!("{:>4}", file_size::fit_4(mount.size())))?;
+ if let Some(stats) = mount.stats() {
+ cw.queue_g_string(txt_style, format!("{:>4}", file_size::fit_4(stats.size())))?;
+ } else {
+ cw.repeat(txt_style, &SPACE_FILLING, 4)?;
+ }
cw.queue_char(border_style, '│')?;
} else {
// used
diff --git a/src/filesystems/mount_list.rs b/src/filesystems/mount_list.rs
index cad0e7c..03e044e 100644
--- a/src/filesystems/mount_list.rs
+++ b/src/filesystems/mount_list.rs
@@ -7,6 +7,7 @@ use {
DeviceId,
Mount,
read_mounts,
+ ReadOptions,
},
};
@@ -24,10 +25,15 @@ impl MountList {
/// try to load the mounts if they aren't loaded.
pub fn load(&mut self) -> Result<&Vec<Mount>, ProgramError> {
if self.mounts.is_none() {
- match read_mounts() {
+ let mut options = ReadOptions::default();
+ options.remote_stats(false);
+ match read_mounts(&options) {
Ok(mut vec) => {
debug!("{} mounts loaded", vec.len());
- vec.sort_by_key(|m| u64::MAX - m.size());
+ vec.sort_by_key(|m| {
+ let size = m.stats().map_or(0, |s| s.size());
+ u64::MAX - size
+ });
self.mounts = Some(vec);
}
Err(e) => {
diff --git a/src/filesystems/mount_space_display.rs b/src/filesystems/mount_space_display.rs
index 13871d7..0570c6e 100644
--- a/src/filesystems/mount_space_display.rs
+++ b/src/filesystems/mount_space_display.rs
@@ -48,7 +48,7 @@ impl<'m, 's> MountSpaceDisplay<'m, 's> {
};
cond_bg!(txt_style, self, selected, self.skin.default);
let w_fs = self.mount.info.fs.chars().count();
- if let Some(s) = &self.mount.stats {
+ if let Some(s) = &self.mount.stats() {
//- width computation
let mut e_fs = false;
let dsk = self.mount.disk.as_ref().map_or("", |d| d.disk_type());