[PATCH] Failed test: scm_rights-fd.test for path containing '>', '}' or non-printable characters
Dmitry V. Levin
ldv at altlinux.org
Wed Mar 23 20:15:10 UTC 2016
On Thu, Mar 24, 2016 at 01:02:53AM +0530, Jay Joshi wrote:
[...]
> >From 03529696dce8254555f01a4ecc9a3bc326926fbf Mon Sep 17 00:00:00 2001
> From: JayRJoshi <jay.r.joshi100 at gmail.com>
> Date: Thu, 24 Mar 2016 00:43:13 +0530
> Subject: [PATCH] tests: fix pathname regex
This way it's non-obvious where is the bug being fixed.
I'd change the wording to
tests/scm_rights-fd.test: fix pathname regex
> Pathname containing >,} or non-printable characters was resulting in
> failing of test.
>
> * tests/scm_rights-fd.test: fix pathname regex and simplify things
In ChangeLog entries, every sentence starts capitalized and ends with
a period.
> ---
> tests/scm_rights-fd.test | 22 ++++++++++++++++------
> 1 file changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/tests/scm_rights-fd.test b/tests/scm_rights-fd.test
> index 48c5028..db1eeeb 100755
> --- a/tests/scm_rights-fd.test
> +++ b/tests/scm_rights-fd.test
> @@ -51,16 +51,26 @@ touch -- "$file" ||
> run_prog ./scm_rights /dev/zero
> run_strace -y -x -enetwork $args "$file"
>
> -sample='\\xf1\\xf2\\xf3\\xf4\\xf5\\xf6\\xf7\\xf8\\xf9\\xfa\\xfb\\xfc\\xfd\\xfe\\xff'
> +hex='[0-9a-f]'
Or even [[:xdigit:]] instead of [0-9a-f].
> n='[1-9][0-9]*'
> -msg='\{msg_name\(0\)=NULL, msg_iov\(1\)=\[\{"'"$sample"'", 15\}\],
> msg_controllen='"$n"
> -rights='\{cmsg_len='"$n"', cmsg_level=SOL_SOCKET,
> cmsg_type=SCM_RIGHTS, \[4</dev/null>, 5</dev/zero>,
> 6</[^}>]*/(A\\n){127}Z>\]\}'
> -creds='\{cmsg_len='"$n"', cmsg_level=SOL_SOCKET,
> cmsg_type=SCM_CREDENTIALS, \{pid='"$n"', uid=[0-9]+, gid=[0-9]+\}\}'
> +sample="$(for i in $(seq 1 15); do printf '\\\\xf%x' $i; done)"
> +socket='<socket:\[[0-9]+\]>'
> +
> +path6='(/.*/(A\\n){127}Z|\\x2f(\\x'"$hex""$hex"')*\\x2f(\\x41\\x0a){127}\\x5a)'
"$hex""$hex" could be replaced with "$hex$hex" with the same effect.
> +cmsg_head='cmsg_len='"$n"', cmsg_level=SOL_SOCKET'
> +rights_data='\[4</dev/null>, 5</dev/zero>, 6<'"$path6"'>\]'
> +iov='\[\{"'"$sample"'", 15\}\]'
> +ids='\{pid='"$n"', uid=[0-9]+, gid=[0-9]+\}'
> +
> +msg='\{msg_name\(0\)=NULL, msg_iov\(1\)='"$iov"', msg_controllen='"$n"
> +rights='\{'"$cmsg_head"', cmsg_type=SCM_RIGHTS, '"$rights_data"'\}'
> +creds='\{cmsg_len='"$n"', cmsg_level=SOL_SOCKET,
> cmsg_type=SCM_CREDENTIALS, '"$ids"'\}'
Let's reuse cmsg_head in definition of creds.
> EXPECTED="$LOG.expected"
>
> cat > "$EXPECTED" << __EOF__
> -sendmsg\\(3<socket:\\[[0-9]+\\]>, $msg, \\[$rights\\],
> msg_flags=0\\}, 0\\) = 15
> -recvmsg\\(0<socket:\\[[0-9]+\\]>, $msg, \\[$creds, $rights\\],
> msg_flags=0\\}, 0\\) = 15
> +sendmsg\\(3$socket, $msg, \\[$rights\\], msg_flags=0\\}, 0\\) = 15
> +recvmsg\\(0$socket, $msg, \\[$creds, $rights\\], msg_flags=0\\}, 0\\) = 15
btw, your email client has wrapped all long lines, thus making the patch
inapplicable.
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160323/c64be06b/attachment.bin>
More information about the Strace-devel
mailing list