filed: skip stripped top level directories#1686
Conversation
|
I think the problem here is that the It seems like our strip function should take that fact into consideration. Could you verify whether this change fixes the issue for you ? @@ -1789,9 +1790,12 @@ void StripPath(FindFilesPacket* ff_pkt)
* is a different link string, attempt to strip the link. If it fails,
* back them both back. Do not strip symlinks. I.e. if either stripping
* fails don't strip anything. */
- if (!do_strip(ff_pkt->StripPath, ff_pkt->fname)) {
- UnstripPath(ff_pkt);
- goto rtn;
+ if ((ff_pkt->type != FT_DIREND && ff_pkt->type != FT_REPARSE)
+ || ff_pkt->fname == ff_pkt->link) {
+ if (!do_strip(ff_pkt->StripPath, ff_pkt->fname)) {
+ UnstripPath(ff_pkt);
+ goto rtn;
+ }
} |
Hi, thanks. I'll give that a try. Earlier I did try using Note the empty first line. This is probably because it stores an entry for |
|
You are right. There is this entry. Thankfully the restore itself works correctly and the permissions/etc. of the "root" directory are also restored. I'm not sure what the best approach is here but i think not backing up a directory that was explicitly included in the backup is not a good idea (normally being top level actually ignores some checks that would cause such a file not to be backed up for example). |
|
Ah I see - if that's the intended behaviour then that's fine! Makes things a lot simpler. |
|
I've now undone my changes and applied your fix instead 👍 |
|
Hm, looks like Verify jobs with level DiskToCatalog don't work together with Strip Path. |
|
I've now also added a fix and tests for the issue with the verify jobs. |
sebsura
left a comment
There was a problem hiding this comment.
Thanks for the work! There are some small issues but as a whole the changes are great.
systemtests/tests/strippath/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
Outdated
Show resolved
Hide resolved
systemtests/tests/strippath/etc/bareos/bareos-fd.d/client/myself.conf.in
Outdated
Show resolved
Hide resolved
systemtests/tests/strippath/etc/bareos/bareos-dir.d/director/bareos-dir.conf.in
Outdated
Show resolved
Hide resolved
ccb99d2 to
ada50f7
Compare
|
We had some CI changes, so i rebased it onto master so it could be build again. |
sebsura
left a comment
There was a problem hiding this comment.
Thanks for the great work! The only thing left is to squash the fixup commits!
813b3a0 to
39828bf
Compare
|
Done. Thanks for your help! |
5f8ed2c to
3bcd414
Compare
|
Should I create backports of this PR? Currently |
|
Since both StripPath and Verify jobs are very rarely done, we decided on not backporting these changes. |
|
@SamuelBoerlin If you create a backport to 23, we can merge it. |
Thank you for contributing to the Bareos Project!
Currently when you have a fileset with an include with e.g.
File = /some/pathandStrip Path = 2the backup will always end up with an empty directory called/some/pathin it.This PR changes this behaviour to skip saving top level directories like in the example if they're stripped away exactly.
Like so the backup won't contain an unnecessary empty directory and the restored files match exactly with what was backed up.
Before this change a restore with
where=/some/pathwould create an empty/some/path/some/pathdirectory (which didn't exist before the restore) whereas the rest of the files are restored correctly at e.g./some/path/somefilejust like where they were before the restore.Please check
If you have any questions or problems, please give a comment in the PR.
Helpful documentation and best practices
Checklist for the reviewer of the PR (will be processed by the Bareos team)
Make sure you check/merge the PR using
devtools/pr-toolto have some simple automated checks run and a proper changelog record added.General
Check backport lineRequired backport PRs have been createdSource code quality
Tests