Debian Codegraph @

testsuite/operator-path-log-file_test.py

raw symbols SCIP
1 #!/usr/bin/env python3
2 # --log-file symlink policy matrix. --log-file already refuses a foreign-owned
3 # symlink (it uses the ownership walk), but it does NOT honor --insecure-links --
4 # so this matrix is RED on the insecure cells: the local opt-out must restore
5 # legacy following uniformly across operator paths.
6
7 import subprocess
8
9 from rsyncfns import rsync_argv, run_symlink_matrix, plant_operator_symlink
10
11
12 def case(ctx):
13 src = ctx.base / 'src'
14 dest = ctx.base / 'dest'
15 src.mkdir()
16 dest.mkdir()
17 (src / 'f0').write_text("data\n")
18 opt, victim = plant_operator_symlink(ctx, ctx.base, kind='file')
19 extra = ['--insecure-links'] if ctx.insecure else []
20 subprocess.run(
21 rsync_argv('-a', '-i', f'--log-file={opt}', *extra, 'src/', 'dest/'),
22 cwd=str(ctx.base), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
23 # Followed == the log was written through the symlink to the out-of-tree file.
24 return victim.is_file() and victim.stat().st_size > 0
25
26
27 run_symlink_matrix('--log-file', case)
28 print("--log-file symlink policy matrix: enforced")