[LTP] [PATCH v2 2/2] Add chdir() test for unprivileged user

Martin Doucha mdoucha@suse.cz
Fri Jul 24 16:47:26 CEST 2020


On 24. 07. 20 15:32, Petr Vorel wrote:
> Hi Martin,
> 
>> +++ b/runtest/syscalls
>> @@ -54,6 +54,7 @@ capset04 capset04
>>  cacheflush01 cacheflush01
> 
>>  chdir01 chdir01
>> +chdir02 chdir02
>>  chdir01A symlink01 -T chdir01
>>  chdir04 chdir04
> You missed to add chdir02 to runtest/quickhit. I guess this was deliberate,
> right?
> (I wonder if we really need runtest/quickhit anyway).

Yes, this was deliberate since only chdir02 was there originally (the
one that was checking only chdir("/"); and chdir("/etc");.

> I like both tests (nice work, thanks!), just don't like the duplicity. Isn't
> there a way to use getopt parameter for one of the variants and have just single
> test? But understand if you don't bother with it (maybe better duplicity but
> simpler code).
> 
> Other that that LGTM.
> Reviewed-by: Petr Vorel <pvorel@suse.cz>

I could add a second set of expected values to the test case list and do
it like this:

static void run(unsigned int n) {
	TEST(chdir(tc->name));
	/* result validation here */
	SAFE_SETEUID(ltpuser->pw_uid);
	TEST(chdir(tc->name));
	SAFE_SETEUID(0);
	/* result validation here */
}

Should I resubmit that as v3?

-- 
Martin Doucha   mdoucha@suse.cz
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic


More information about the ltp mailing list