[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [rdiff-backup-users] [bug] Excluding hidden files the wrong way does
From: |
Ilario |
Subject: |
Re: [rdiff-backup-users] [bug] Excluding hidden files the wrong way doesn't result in an error |
Date: |
Thu, 5 Jan 2017 17:40:34 +0100 |
2017-01-05 16:25 GMT+01:00 Robert Nichols <address@hidden>:
> On 01/04/2017 01:00 PM, Ilario wrote:
>>
>> Excluding a hidden file without full path doesn't rise an error (as
>> happens with non hidden files) and copies it anyway
>
> The only thing that is strange
> here is that you are not getting the "cannot match any files in the
> base directory" error. For some reason, dotfiles in an exclude do
> not trigger that message.
This is exactly my point :)
I think I spotted something related looking into the code:
https://github.com/sol1/rdiff-backup/blob/4864f2fcc195a1a0b3d303766505b58f16223bff/rdiff-backup/rdiff_backup/selection.py#L402
That line should rise an error if the exclusion doesn't include the
origin path. But it just compares text strings, without a directory
separator (e.g. the slash).
So in some cases (like mine) the error doesn't rise, e.g.:
rdiff-backup --exclude data origin backup # it fails, as expected
rdiff-backup --exclude origin/data origin backup # it does not fail,
as expected (doesn't matter if origin/data esists)
rdiff-backup --exclude origindata origin backup # it does not fail,
but it should!
Fixing the linked line of code should be easy (appending a "/"
literally or using os.path.join() prior to string comparison).