[LTP] [PATCH v5 02/10] shell API/tests: Require root for format/mount tests

Cyril Hrubis chrubis@suse.cz
Mon Sep 12 12:24:18 CEST 2022


Hi!
> > > Although the warning is quite obvious:
> > > tst_device.c:101: TINFO: Not allowed to open /dev/loop-control. Are you root?: EACCES (13)
> > > tst_device.c:140: TINFO: No free devices found
> > > TBROK: Failed to acquire device
> 
> > > It's safer to expect root to get valid result.
> 
> > Another option would actually be to make the TST_NEED_DEVICE flag imply
> > TST_NEEDS_ROOT flag, but I do not think that we have that for the C
> > library either.
> No, it does not imply in C API either. Yes, that would make sense for both API.
> But I'd keep it as it is now and I'll do this change after the release,
> Because I have other small fixes on API I'd like to post before the release.
> 
> BTW I always wondered why it was not done from the start, I thought there is a
> reason for that (i.e. some special user with approved permissions).

Well technically you can be added into whatever group is set to
/dev/loop-control e.g. disk group and then you can create devices
without a need to be a root.

So the most correct solution would be checking if we can access
/dev/loop-control if tst_test.needs_device is set and if not we would
imply needs_root. However this would need to be rethinked properly so
that we do not end up creating something complex and not really
required.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list