pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Patch for a panic in the file manager due to the lack of system-wide trash in NetBSD
Module Name: pkgsrc-wip
Committed By: ci4ic4 <ci4ic4%gmail.com@localhost>
Pushed By: ci4ic4
Date: Sun Aug 16 22:01:39 2026 +0100
Changeset: 03bd9222171f70dcb13e00f4c482377dcf0730af
Modified Files:
fresh/distinfo
Added Files:
fresh/patches/patch-crates_fresh-editor_src_app_file__explorer.rs
Log Message:
Patch for a panic in the file manager due to the lack of system-wide
trash in NetBSD
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=03bd9222171f70dcb13e00f4c482377dcf0730af
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
fresh/distinfo | 1 +
...h-crates_fresh-editor_src_app_file__explorer.rs | 71 ++++++++++++++++++++++
2 files changed, 72 insertions(+)
diffs:
diff --git a/fresh/distinfo b/fresh/distinfo
index bc92d41953..64ff315bf0 100644
--- a/fresh/distinfo
+++ b/fresh/distinfo
@@ -2190,3 +2190,4 @@ Size (zmij-1.0.21.crate) = 26665 bytes
BLAKE2s (zopfli-0.8.3.crate) = c2105011678b54b1fb8ecea296684f7fb4446e4f5d1c866b09d2e996f67610bc
SHA512 (zopfli-0.8.3.crate) = 564453096c9352d732c76b3eec69c3f454cbdf64f99926f676e845fc5312fa6833bcaa3a451ed87b7c7038bb5ec2bcb1467e21b29250a7524b78421ac987cd33
Size (zopfli-0.8.3.crate) = 51589 bytes
+SHA1 (patch-crates_fresh-editor_src_app_file__explorer.rs) = bba71f441ed16a95d6a86d0532d1d546fadb6493
diff --git a/fresh/patches/patch-crates_fresh-editor_src_app_file__explorer.rs b/fresh/patches/patch-crates_fresh-editor_src_app_file__explorer.rs
new file mode 100644
index 0000000000..4b4be6e5b1
--- /dev/null
+++ b/fresh/patches/patch-crates_fresh-editor_src_app_file__explorer.rs
@@ -0,0 +1,71 @@
+$NetBSD$
+
+Do not use the system trash when deleting from the file explorer on NetBSD.
+
+NetBSD has no system-wide trash facility, so the trash crate cannot honour
+trash::delete() there and the editor aborts instead of reporting a plain
+error to the user. On NetBSD, move the file to the editor's own trash
+directory (~/.local/share/fresh/trash/) directly; on every other platform,
+keep using the system trash and fall back to that directory only when
+trash::delete() fails.
+
+Not yet submitted upstream.
+
+--- crates/fresh-editor/src/app/file_explorer.rs.orig 2026-08-11 21:11:11.000000000 +0000
++++ crates/fresh-editor/src/app/file_explorer.rs
+@@ -643,6 +643,7 @@ impl Editor {
+ /// Perform the actual file explorer delete operation (called after prompt confirmation)
+ /// For local files: moves to system trash/recycle bin
+ /// For remote files: moves to ~/.local/share/fresh/trash/ on remote
++ /// Falls back to ~/.local/share/fresh/trash/ when system trash is unavailable (e.g. NetBSD).
+ pub fn perform_file_explorer_delete(&mut self, path: std::path::PathBuf, _is_dir: bool) {
+ let name = path
+ .file_name()
+@@ -650,7 +651,7 @@ impl Editor {
+ .unwrap_or_default();
+
+ // For remote files, move to remote trash directory
+- // For local files, use system trash
++ // For local files, try system trash, then fall back to local trash directory
+ let delete_result = if self
+ .authority()
+ .filesystem
+@@ -659,7 +660,7 @@ impl Editor {
+ {
+ self.move_to_remote_trash(&path)
+ } else {
+- trash::delete(&path).map_err(std::io::Error::other)
++ self.try_system_trash_or_local(&path)
+ };
+
+ match delete_result {
+@@ -770,6 +771,29 @@ impl Editor {
+
+ // Move to trash
+ self.authority().filesystem.rename(path, &trash_path)
++ }
++
++ /// Try system trash, falling back to the local trash directory on failure.
++ /// On platforms where the `trash` crate is known to be unreliable (e.g. NetBSD),
++ /// skip the system trash attempt entirely.
++ #[cfg(target_os = "netbsd")]
++ fn try_system_trash_or_local(&self, path: &std::path::Path) -> std::io::Result<()> {
++ tracing::info!("NetBSD detected — skipping system trash, using local trash directory instead.");
++ self.move_to_remote_trash(path)
++ }
++
++ #[cfg(not(target_os = "netbsd"))]
++ fn try_system_trash_or_local(&self, path: &std::path::Path) -> std::io::Result<()> {
++ match trash::delete(path) {
++ Ok(()) => Ok(()),
++ Err(e) => {
++ tracing::warn!(
++ "System trash failed for {:?}: {}. Falling back to local trash directory.",
++ path, e
++ );
++ self.move_to_remote_trash(path)
++ }
++ }
+ }
+
+ pub fn file_explorer_rename(&mut self) {
Home |
Main Index |
Thread Index |
Old Index