| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
import os |
| 9 |
import subprocess |
| 10 |
|
| 11 |
from rsyncfns import ( |
| 12 |
SCRATCHDIR, rmtree, rsync_argv, start_test_daemon, test_fail, write_daemon_conf, |
| 13 |
) |
| 14 |
|
| 15 |
base = SCRATCHDIR / 'mkdirx' |
| 16 |
rmtree(base) |
| 17 |
base.mkdir() |
| 18 |
mod = base / 'mod' |
| 19 |
pub = mod / 'public' |
| 20 |
pub.mkdir(parents=True) |
| 21 |
(pub / 'served.txt').write_text("served\n") |
| 22 |
os.symlink('public', mod / 'blink') |
| 23 |
src = base / 'src' |
| 24 |
src.mkdir() |
| 25 |
(src / 'f0').write_text("NEW\n") |
| 26 |
|
| 27 |
conf = write_daemon_conf( |
| 28 |
[('mod', {'path': str(mod), 'read only': 'no', 'exclude': '/public/pdir/'})]) |
| 29 |
url = start_test_daemon(conf, 12913) |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
subprocess.run( |
| 34 |
rsync_argv('-a', '--delay-updates', '--partial-dir=/blink/pdir', f'{src}/', f'{url}mod/'), |
| 35 |
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) |
| 36 |
|
| 37 |
if not (pub / 'pdir').exists(): |
| 38 |
test_fail( |
| 39 |
"the daemon refused to create public/pdir via a --partial-dir symlink that " |
| 40 |
"stock rsync (3.2.7) creates. The daemon exclude filter is name-based " |
| 41 |
"('blink' is not excluded), not a symlink boundary; it must not block this.") |
| 42 |
print("daemon exclude is name-based: an operator-path symlink creates a " |
| 43 |
"dir-excluded leaf in a served dir (3.2.7-equivalent)") |