Want to allow Podman to print helpful error message when
users runs out of UIDs to use with podman run --userns=auto.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
We now use the golang error wrapping format specifier `%w` instead of the
deprecated github.com/pkg/errors package.
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
when the container specifies some mappings to be applied, verify that
they are not overlapping and give a clearer error message.
Closes: https://github.com/containers/storage/issues/1127
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This implements the algorithm proposed in
https://github.com/containers/storage/issues/852#issuecomment-798954173,
which is:
1. find available IDs from subuid/subgid file; by subtracting the used
IDs (from other containers) as well as additional IDs, we get the IDs
available to allocate;
2. target ID range is [0, requestedSize), subtract the additional IDs;
3. allocate IDs from range in step 1; the number to allocate is the
number of IDs in step 2;
4. generate a mapping from IDs in step 3 to the ones in step 2.
Closes: https://github.com/containers/storage/issues/852
Signed-off-by: Kan Li <likan@google.com>