public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Garrett Cooper <yanegomi@gmail.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] fix lchown tests
Date: Fri, 26 Nov 2010 15:27:04 +0100	[thread overview]
Message-ID: <20101126142704.GA3587@saboteur.suse.cz> (raw)
In-Reply-To: <AANLkTimFfK-34NALnKWMmOUqRhVfF70KMnWup8TiEp1C@mail.gmail.com>

Hi!
> > Folowing patch fixes/cleanups lchown tests.
> >
> > lchown01 changes:
> >
> > * make a better use of ltp test interface
> > * make error messages consistent
> > * various coding style issues
> >
> > lchown02 changes:
> >
> > * all test setups are now done in setup functions
> > * eliminated need for external script for preparing tempfile
> > * make a better use of ltp test interface
> > * make error messages consistent
> > * various coding style issues
> > * fix lchown02 invocation in runtest files
> 
> ...
> 
> +CFLAGS+=-W -Wall
> +
> 
> gcooper> Please remove.

Okay.

> ...
> 
> +				if (user_id == (uid_t)-1)
> +					user_id = test_cases[i - 1].user_id;
> +				if (group_id == (gid_t)-1)
> +					group_id = test_cases[i - 1].group_id;
> 
> gcooper> These assume that i is >= 1. Could you please add that
> conditional to the overall block so someone doesn't delete the
> subtestcase, break the test and come back to us later and gripe about
> how it's accessing memory out of bounds?
 
Okay.

> +				if ((stat_buf.st_uid != user_id) ||
> +				    (stat_buf.st_gid != group_id)) {
>  					tst_resm(TFAIL,
>  						 "%s: Incorrect ownership set, "
>  						 "Expected %d %d", SFILE,
> 
> gcooper> Technically it's %u.

Okay.

> +	return 0;
> +}
> 
> gcooper> If it gets down here, it should be return 1;
> 

Well, the return 0; is there just to silent compiler as cleanup() calls
tst_exit(); The best solution is IMHO add noreturn attribute to
cleanup() and remove the return 0;

> ...
> 
> +	if (close(fd) == -1)
> +		tst_brkm(TBROK | TERRNO, cleanup, "close(2) %s", TESTFILE);
> 
> gcooper> Wouldn't worry about the close.
 
Checking it doesn't do any harm. ;)

> ...
> 
> -	/* fix permissions on the tmpdir */
> -	if (chmod(".", 0711) != 0) {
> -		tst_brkm(TBROK | TERRNO, cleanup, "chmod() failed");
> 
> gcooper> The directory mode for tst_tmpdir is different:
> 
> #define DIR_MODE        0777  /* mode of tmp dir that will be created */

As far as I understand the tests, changing permissions on tmp directory
is not needed as the test is testing permissions on symlinks created
inside of it (so we only need that the content of the directory is
accesible). I susspect that this is some workaround that wasn't removed
when test was ported for LTP.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  parent reply	other threads:[~2010-11-26 14:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25 16:40 [LTP] [PATCH] fix lchown tests Cyril Hrubis
     [not found] ` <AANLkTimFfK-34NALnKWMmOUqRhVfF70KMnWup8TiEp1C@mail.gmail.com>
2010-11-26 14:27   ` Cyril Hrubis [this message]
     [not found]     ` <AANLkTim4PpA-aWoW_+cbB--cC6fj9qADhJEPf69S-BpW@mail.gmail.com>
2010-12-02 13:13       ` Cyril Hrubis
2010-12-03 14:49       ` Cyril Hrubis
2010-12-10 13:11         ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101126142704.GA3587@saboteur.suse.cz \
    --to=chrubis@suse.cz \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=yanegomi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox