| 1 |
|
| 2 |
"""KI-73 regression: a `.cvsignore` containing only `!` (the clear-list token) |
| 3 |
must not abort rsync in -C (cvs-exclude) mode. |
| 4 |
|
| 5 |
In exclude.c the CLEAR_LIST branch guarded its trailing-character check with |
| 6 |
`rule->rflags & FILTRULE_NO_PREFIXES`, but NO_PREFIXES is a template-level flag |
| 7 |
that is intentionally NOT inherited by individual rules (it is excluded from |
| 8 |
FILTRULES_FROM_CONTAINER). The guard therefore always evaluated as "prefixes |
| 9 |
allowed" for CVS rules and rsync hit exit_cleanup(RERR_SYNTAX) instead of |
| 10 |
clearing the list. The fix checks `template->rflags` instead. |
| 11 |
|
| 12 |
# Verifies: SW-REQ-078 |
| 13 |
""" |
| 14 |
|
| 15 |
from rsyncfns import ( |
| 16 |
FROMDIR, TODIR, |
| 17 |
assert_exists, makepath, rmtree, run_rsync, |
| 18 |
) |
| 19 |
|
| 20 |
src = FROMDIR |
| 21 |
rmtree(src) |
| 22 |
rmtree(TODIR) |
| 23 |
makepath(src) |
| 24 |
|
| 25 |
|
| 26 |
(src / 'keep1.txt').write_text('one\n') |
| 27 |
(src / 'keep2.txt').write_text('two\n') |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
(src / '.cvsignore').write_text('!\n') |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
run_rsync('-a', '-C', f'{src}/', f'{TODIR}/') |
| 36 |
|
| 37 |
assert_exists(TODIR / 'keep1.txt', label='clear-list .cvsignore kept keep1') |
| 38 |
assert_exists(TODIR / 'keep2.txt', label='clear-list .cvsignore kept keep2') |
| 39 |
|
| 40 |
print("ki73: cvs-exclude .cvsignore '!' clear-list token no longer aborts") |