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

Visual glitches in folders with files named "Icon." #39

Closed
eugenesan opened this issue Jul 5, 2024 · 7 comments · Fixed by #40
Closed

Visual glitches in folders with files named "Icon." #39

eugenesan opened this issue Jul 5, 2024 · 7 comments · Fixed by #40
Labels
bug Something isn't working

Comments

@eugenesan
Copy link

eugenesan commented Jul 5, 2024

I've noticed that when files named "Icon." exist in the folder, the line of the file is not cleared and characters from previous screen remains on the line.

Also when the line with the file is selected it becomes completely empty while still displaying details in the pop-up.

Those files appear in Dropbox folders on old OSX versions (circa 2014).
Actual file name is:

`Icon'$'\r'

or in hex

00000000  49 63 6f 6e 0d 0a                                 |Icon..|
00000006

P.S.
I didn't notice any issues with regular unicode and legacy encodings, even with Right-to-Left languages ;-)
So the issues seems to be specific to filenames containing "control" characters and might be in one of the libraries used by redu.

P.P.S
After thinking about it, I am not sure if it would possible to "Mark" those files and pass to restic.
So maybe they should be just ignored since they are taking zero space.

@drdo drdo added the bug Something isn't working label Jul 7, 2024
@drdo
Copy link
Owner

drdo commented Jul 7, 2024

I've reproduced the issue and confirm that this is a problem.

There are two things here:

  1. Escaping control characters when displaying so we don't mess things up visually
  2. Escaping special characters into a format that works on a restic exclude file (https://pkg.go.dev/path/filepath#Match)

@drdo
Copy link
Owner

drdo commented Jul 7, 2024

1 is easily solvable but I don't think 2 can be fully solved while keeping the exclude-file compatible output.

I was looking at restic's exclude file parsing code and I believe there is no way to match a newline in the filename.

Edit: It might be possible with a character class excluding everything except newline.

@eugenesan
Copy link
Author

Thank you.
If it's too much work to add those files to exclusion list, I think displaying those files as "grayed out" might be a good solution.

@drdo
Copy link
Owner

drdo commented Jul 7, 2024

I have a solution which seems to work, the only problem is that the exclude file will look a bit strange when viewed with standard text tools if you have carriage returns or newlines.

But it appears to work, with restic doing the right thing when passed that exclude file.

It seems like a good solution, if you have carriage returns and newlines in your filenames you are doing something odd anyway :)

@drdo
Copy link
Owner

drdo commented Jul 7, 2024

I've opened the PR (#40). Could you possibly test it with your repo and let me know how it goes?

@eugenesan
Copy link
Author

Thank you.
Works as expected.

redu shows the file as:

0 B                  Icon\r

in exclude file it appears as:

/Dropbox/Icon[^^@-^L^N-.]

restic successfully removed the file:

excluding /Dropbox/Icon
saved new snapshot 791a6238
removed old snapshot 4d7f2fc4

@drdo
Copy link
Owner

drdo commented Jul 7, 2024

Thank you. Merging the PR.

@drdo drdo closed this as completed in #40 Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants