Skip to content
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

Missing sub-directory in logged file name #157

Open
3 tasks done
leggewie opened this issue Jan 12, 2021 · 3 comments
Open
3 tasks done

Missing sub-directory in logged file name #157

leggewie opened this issue Jan 12, 2021 · 3 comments
Assignees
Labels
🐛 bug Something isn't working, or a fix is proposed

Comments

@leggewie
Copy link
Contributor

Preliminary checks

As you can see in #155 errors in files are being logged with the filename being logged as /home/user/Maildir/.Erledigt:1406922416.M923538P22149.giga,W=2249,S=2199 for example. That looks like the filepath, but it isn't quite it. First the path to the directory ends in : and not / as well as missing /cur/. Furthermore, the filename in this case lacks a few more characters :2,S. The correct and complete filenpath would be /home/user/Maildir/.Erledigt/cur/1406922416.M923538P22149.giga,W=2249,S=2199:2,S. This thwarts any attempts at copy and pasting the filepath to inspect the file directly.

Am I correct to assume this is not intended behaviour?

@kdeldycke
Copy link
Owner

You're right there is an issue here. As the mail source is a Maildir, we should expect the output to be real, fully-qualified path, and must indeed be allowed to be copy-pasted without effort.

The root cause should be somewhere around these lines:

path = Path(path)
if not box_type:
box_type = autodetect_box_type(path)
else:
logger.warning(f"Forcing {box_type} format.")
constructor = BOX_TYPES[box_type]
# Do not allow the constructor to create a new mailbox if not found.
box = constructor(path, create=False)
. In which the recursive opening of maildir subfolders happens.

If you could come up with a fix, feel free to propose a PR! :)

@kdeldycke kdeldycke changed the title logged file name Missing sub-directory in logged file name Jan 20, 2021
@leggewie
Copy link
Contributor Author

I'm not sure about that. I believe

def __repr__(self):
return f"<{self.__class__.__name__} {self.source_path}:{self.mail_id}>"

is where it's at.

leggewie added a commit to leggewie/mail-deduplicate that referenced this issue May 19, 2021
@leggewie
Copy link
Contributor Author

Indeed, leggewie@62e3b1d results in a string that can be copied&pasted straight off the terminal. Obviously, it's not the right fix.

Questions:

  • what is responsible for truncating file names after a : colon?
  • why does source_path not include {tmp,cur,new}?
  • how does this affect mailbox formats other than maildir?

@kdeldycke kdeldycke added 🐛 bug Something isn't working, or a fix is proposed and removed bug labels Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working, or a fix is proposed
Projects
None yet
Development

No branches or pull requests

2 participants