summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGiacomo Leidi <therewasa@fishinthecalculator.me>2025-11-15 11:18:40 +0100
committerLudovic Courtès <ludo@gnu.org>2025-12-11 15:43:16 +0100
commitfdb46ae7b19d45a6a1f5adb660283981bf4b7a1d (patch)
tree60efdabf153b672904448ba918f2e97dd19b4856 /tests
parent94b26ff2841b90826968386de0b71a46284d2ee0 (diff)
system: Relax subordinate ID validation.
https://codeberg.org/guix/guix/issues/3925 raised the inabilityy of the subordinate IDs service of handling externally managed sub{u,g}id file entries. This patch relaxes the checks in place for existing ranges, by allowing subid-range records lower than %subordinate-id-min, leaving all the space from subid 0 to %subordinate-id-min - 1 to external users. Generic ranges are still allocated within %subordinate-id-min and %subordinate-id-max. * gnu/build/accounts.scm (<unused-id-range>)[min]: Change default value to 0, allowing subid-ranges with a start lesser than %subordinate-id-min. (allocate-generic-range): Allocate generic ranges starting from %subordinate-id-min, leaving ranges starting before %subordinate-id-min. (allocate-specific-range): Move bounds check to... (allocate-subids): ...here. Now bound validation is applied only to user provided ranges. * tests/accounts.scm: Test new behavior. Fixes: guix/guix#3925 Change-Id: Id923b122c97a20f148684f5fb144fd9422810612 Signed-off-by: Ludovic Courtès <ludo@gnu.org> Merges: #4235
Diffstat (limited to 'tests')
-rw-r--r--tests/accounts.scm17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/accounts.scm b/tests/accounts.scm
index 41ed706e9ed..60a8f4bf66d 100644
--- a/tests/accounts.scm
+++ b/tests/accounts.scm
@@ -271,6 +271,23 @@ ada:100600:300\n")
271 (start %subordinate-id-min) 271 (start %subordinate-id-min)
272 (count 100))))) 272 (count 100)))))
273 273
274(test-equal "allocate-subids with externally managed state"
275 (list (subid-entry (name "guix-daemon") (start 904) (count 1))
276 (subid-entry (name "alice") (start 1085) (count 100))
277 (subid-entry (name "t") (start %subordinate-id-min) (count 899))
278 (subid-entry (name "x") (start 100899) (count 200)))
279 (allocate-subids (list
280 (subid-range (name "x") (count 200))
281 (subid-range (name "t") (count 899)))
282 ;; Test use case from
283 ;; https://codeberg.org/guix/guix/issues/3925
284 (list (subid-range (name "guix-daemon")
285 (start 904)
286 (count 1))
287 (subid-range (name "alice")
288 (start 1085)
289 (count 100)))))
290
274(test-equal "allocate-subids with requested IDs ranges" 291(test-equal "allocate-subids with requested IDs ranges"
275 ;; Make sure the requested sub ID for "k" and "root" are honored. 292 ;; Make sure the requested sub ID for "k" and "root" are honored.
276 (list (subid-entry (name "x") (start %subordinate-id-min) (count 200)) 293 (list (subid-entry (name "x") (start %subordinate-id-min) (count 200))