[PATCH] tests/stat: support fstatat syscall for stat()

Chris Metcalf cmetcalf at tilera.com
Mon May 6 16:43:28 UTC 2013


On 5/6/2013 12:10 PM, Mike Frysinger wrote:
> On Monday 06 May 2013 11:21:13 Chris Metcalf wrote:
>> -LC_ALL=C grep -x 'stat\(64\)\?("sample", {st_mode=S_IFREG|0644, st_size=46118400000, \.\.\.}) \+= 0' check.log > /dev/null ||
>> +LC_ALL=C grep -x 'f\?stat\(at\)\?\(64\)\?(\(AT_FDCWD, \)\?"sample", {st_mode=S_IFREG|0644, st_size=46118400000, \.\.\.}\(,
> 0\)\?) \+= 0' check.log > /dev/null ||
>
> i know it's not a new issue w/your patch, but could you change this to use
> grep -E instead ?  that will require a escaping the plain ( and ), but i think
> that's better since the current syntax is not in POSIX afaik and you end up
> with less total escapes ...
>
> LC_ALL=C grep -x 'f?stat(at)?(64)?\(((AT_FDCWD, )?"sample", .........

The regexp I modified certainly gets better, but the others get a little worse due to the syscall parens and the pipe symbol in "S_IFREG|0644".  (Also, following the advice in the grep info page, I use "[{]" to indicate a non-meta curly bracket, so that's a little clunky too.)  But it's still probably better on  balance to use egrep syntax.

We could switch only the one I modified to use '-E', but that feels really confusing to future folks who come and modify.

I think the same risk of confusion is true of the fact that only one of the tests doesn't use "-x"; I think it's better to add leading and trailing ".*" to the regexps and use "-x" for that one too.  In the spirit of general cleanup I added that to my patch as well.  See following email; I tested the result on tilegx and x86_64.

-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20130506/9d506d73/attachment.html>


More information about the Strace-devel mailing list