Debian Codegraph @

test/integration/targets/group/files/get_free_gid.py

raw
1
2 from __future__ import annotations
3
4 import grp
5
6
7 def main():
8 gids = [g.gr_gid for g in grp.getgrall()]
9
10 # Start the gid numbering with 1
11 # FreeBSD doesn't support the usage of gid 0, it doesn't fail (rc=0) but instead a number in the normal
12 # range is picked.
13 i = 1
14 while True:
15 if i not in gids:
16 print(i)
17 break
18 i += 1
19
20
21 if __name__ == '__main__':
22 main()