-
Notifications
You must be signed in to change notification settings - Fork 178
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
Cannot restore a file from a mounted cifs volume #314
Comments
Note: I was able to find the trashed file by searching for the newest files in my computer: |
You are using an old version of trash-cli. Please uninstall trash-cli and reinstall using If the problem persists update me adding another comment here. |
I iused trash-cli version 0.23.9.23 ; what's the latest one? |
Yes, it is a recent version. Can you please run
There are some symlink in the components of |
Here is the test:
Note that
|
Unfortunately I didn't have never tested directly CIFS. Please search in the volume trashdirs:
There should be two files:
Please check also the permission of the trash directories:
Thanks |
There are tons of files in the Here is the content of
The file The permissions: Thanks! |
Please check if any of these command is able to see your trashed file:
And try to execute these python commands:
Thank you |
Thank you |
Sorry, but I'm not still able to figure out the problem. The file is going to the "(2)" trash dir, $topdir/.Trash-$uid (by the specs: https://specifications.freedesktop.org/trash-spec/trashspec-latest.html) . It seems that you have this directory and its name is
The trashinfo seems well formed:
It's seems all ok. I have prepared a version with some additional debug message that can help me to understand the situation.
The debug print I have added are expressed in this patch commit 005a363181fd9a3802a18f343962c7f1336fe2ea
Author: Andrea Francia <[email protected]>
Date: Thu Nov 9 12:00:07 2023 +0100
Add some debug prints to solve https://github.com/andreafrancia/trash-cli/issues/314
diff --git a/trashcli/restore/info_dir_searcher.py b/trashcli/restore/info_dir_searcher.py
index 12577bc..215aa23 100644
--- a/trashcli/restore/info_dir_searcher.py
+++ b/trashcli/restore/info_dir_searcher.py
@@ -1,7 +1,10 @@
-from typing import NamedTuple, Iterable, Optional
+from typing import Iterable
+from typing import NamedTuple
+from typing import Optional
from trashcli.restore.info_files import InfoFiles
from trashcli.restore.trash_directories import TrashDirectories
+from trashcli.trash import debug_print
class InfoDirSearcher:
@@ -17,6 +20,7 @@ class InfoDirSearcher:
): # type: (...) -> Iterable[FileFound]
for trash_dir_path, volume in self.trash_directories.list_trash_dirs(
trash_dir_from_cli):
+ debug_print(">>>> found trash dir: %s" % trash_dir_path)
for type, path in self.info_files.all_info_files(trash_dir_path):
yield FileFound(type, path, volume)
diff --git a/trashcli/restore/info_files.py b/trashcli/restore/info_files.py
index 4cf1938..f0bf0a7 100644
--- a/trashcli/restore/info_files.py
+++ b/trashcli/restore/info_files.py
@@ -1,6 +1,7 @@
import os
from trashcli.restore.file_system import ListingFileSystem
+from trashcli.trash import debug_print
class InfoFiles:
@@ -14,9 +15,10 @@ class InfoFiles:
info_dir = os.path.join(norm_path, 'info')
try:
for info_file in self.fs.list_files_in_dir(info_dir):
+ debug_print(">>>> info_file: %s" % info_file)
if not os.path.basename(info_file).endswith('.trashinfo'):
yield ('non_trashinfo', info_file)
else:
yield ('trashinfo', info_file)
- except OSError: # when directory does not exist
- pass
+ except OSError as e: # when directory does not exist
+ debug_print(">>>> exception: %s" % e)
diff --git a/trashcli/restore/trash_directories.py b/trashcli/restore/trash_directories.py
index 4f1c180..73f5661 100644
--- a/trashcli/restore/trash_directories.py
+++ b/trashcli/restore/trash_directories.py
@@ -1,14 +1,17 @@
# Copyright (C) 2007-2023 Andrea Francia Trivolzio(PV) Italy
-from abc import abstractmethod, ABCMeta
+from abc import ABCMeta
+from abc import abstractmethod
+from typing import Optional
import six
-from typing import Optional
from trashcli.fstab.volume_of import VolumeOf
from trashcli.fstab.volumes import Volumes
from trashcli.lib.environ import Environ
-from trashcli.lib.trash_dirs import (
- volume_trash_dir1, volume_trash_dir2, home_trash_dir)
+from trashcli.lib.trash_dirs import home_trash_dir
+from trashcli.lib.trash_dirs import volume_trash_dir1
+from trashcli.lib.trash_dirs import volume_trash_dir2
+from trashcli.trash import debug_print
@six.add_metaclass(ABCMeta)
@@ -65,6 +68,7 @@ class TrashDirectories1:
def all_trash_directories(self):
volumes_to_check = self.volumes.list_mount_points()
+ debug_print(">>>> volumes_to_check: %s" % volumes_to_check)
for path1, volume1 in home_trash_dir(self.environ, self.volumes):
yield path1, volume1
for volume in volumes_to_check:
diff --git a/trashcli/trash.py b/trashcli/trash.py
index db1a088..30f61ee 100644
--- a/trashcli/trash.py
+++ b/trashcli/trash.py
@@ -1,3 +1,11 @@
# Copyright (C) 2007-2011 Andrea Francia Trivolzio(PV) Italy
version = '0.23.9.23'
+
+
+def debug_print(msg):
+ import os
+ import sys
+ if os.environ.get('TRASHCLI_DEBUG') == '1':
+ print(msg, file=sys.stderr)
+ |
Describe the bug
I remove a file located in a remote cifs volume with
trash /remote_volume_path/test_file.txt
, and when I trytrash-restore
it says:No files trashed from current dir ('/remote_volume_path/')
.trash-cli version
0.23.9.23
Are you using the latest version of trash-cli?
Yes
Have you tried if the bug is present in the latest version of trash-cli?
Yes
Operating system:
Ubuntu 18.04.6 LTS
To Reproduce
trash-list
does not help either (showing trashed files from other locations).Expected behavior
Trash cli should show the file I just trashed.
Volumes detail
The text was updated successfully, but these errors were encountered: