| 1 |
From 3d2caaa0cb1b316f60b57a4036b42cd687eea561 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Zen Dodd <[email protected]> |
| 3 |
Date: Sun, 16 Aug 2026 21:55:00 +1000 |
| 4 |
Subject: [PATCH] testsuite: bound the unshare probe (#1049) |
| 5 |
|
| 6 |
--- |
| 7 |
testsuite/protected-regular_test.py | 16 +++++++++++----- |
| 8 |
1 file changed, 11 insertions(+), 5 deletions(-) |
| 9 |
|
| 10 |
diff --git a/testsuite/protected-regular_test.py b/testsuite/protected-regular_test.py |
| 11 |
index b7d982582..4094534b2 100644 |
| 12 |
--- a/testsuite/protected-regular_test.py |
| 13 |
+++ b/testsuite/protected-regular_test.py |
| 14 |
@@ -49,11 +49,17 @@ def _chown_5001(path: Path) -> bool: |
| 15 |
if not os.environ.get('RSYNC_UNSHARED'): |
| 16 |
unshare = shutil.which('unshare') |
| 17 |
if unshare is not None: |
| 18 |
- probe = subprocess.run( |
| 19 |
- [unshare, '--user', '--map-root-user', |
| 20 |
- '--map-users', '5001:100000:1', 'true'], |
| 21 |
- capture_output=True, |
| 22 |
- ) |
| 23 |
+ try: |
| 24 |
+ probe = subprocess.run( |
| 25 |
+ [unshare, '--user', '--map-root-user', |
| 26 |
+ '--map-users', '5001:100000:1', 'true'], |
| 27 |
+ stdin=subprocess.DEVNULL, |
| 28 |
+ stdout=subprocess.DEVNULL, |
| 29 |
+ stderr=subprocess.DEVNULL, |
| 30 |
+ timeout=5, |
| 31 |
+ ) |
| 32 |
+ except subprocess.TimeoutExpired: |
| 33 |
+ test_skipped("Can't chown (unshare probe timed out)") |
| 34 |
if probe.returncode == 0: |
| 35 |
print("Re-running under unshare with UID mapping...") |
| 36 |
env = os.environ.copy() |