<div dir="ltr"><div class="gmail_default" style="color:#000000">Hi Dmitry,</div><div class="gmail_default" style="color:#000000"><br></div><div class="gmail_default" style="color:#000000">Sorry for the late reply.</div><div class="gmail_default" style="color:#000000"><br></div><div class="gmail_default" style="color:#000000">><span style="color:rgb(34,34,34)">Why do you handle XLAT_STYLE_VERBOSE as XLAT_STYLE_RAW here?</span></div><div class="gmail_default" style="color:#000000"><span style="color:rgb(34,34,34)"><br></span></div><div class="gmail_default" style="color:#000000"><span style="color:rgb(34,34,34)">Good question. I think I handled both cases the same because I didn't know if verbose should print the auxiliary string after the return value. If you think it should then I'm ok with leaving it back in.</span></div><div class="gmail_default" style="color:#000000"><span style="color:rgb(34,34,34)"><br></span></div><div class="gmail_default" style="color:#000000"><span style="color:rgb(34,34,34)">></span><span style="color:rgb(34,34,34)">The check for XLAT_STYLE_RAW seems to be redundant here.</span><span style="color:rgb(34,34,34)"><br></span></div><div class="gmail_default" style="color:#000000"><span style="color:rgb(34,34,34)"><br></span></div><div class="gmail_default" style="color:#000000"><span style="color:rgb(34,34,34)">Sorry but I don't see how it is. If I don't include the check, then under XLAT_STYLE_RAW, we will call </span><span style="color:rgb(34,34,34)">tprints(sprint_ioprio(tcp->u_</span><span style="color:rgb(34,34,34)">arg[2]) after printing the raw value which seems wrong.</span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 8, 2019 at 7:37 PM Dmitry V. Levin <<a href="mailto:ldv@altlinux.org">ldv@altlinux.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
On Fri, Jan 11, 2019 at 09:02:50PM -0800, shankarapailoor wrote:<br>
> Hi,<br>
> <br>
> I noticed that strace doesn't properly handle xlat_styles when<br>
> decoding the ioprio_who field in ioprio_set. This patch fixes that.<br>
> <br>
> Regards,<br>
> Shankara Pailoor<br>
<br>
> From 842f09d4f91b6b9fae82f9e6eb81d4b241f9e546 Mon Sep 17 00:00:00 2001<br>
> From: Shankara Pailoor <<a href="mailto:shankarapailoor@gmail.com" target="_blank">shankarapailoor@gmail.com</a>><br>
> Date: Fri, 11 Jan 2019 20:59:00 -0800<br>
> Subject: [PATCH v1] handle xlat_styles when decoding ioprio_get and set<br>
> <br>
> * ioprio.c (ioprio_get, SYS_FUNC(ioprio_set)): Only print auxstring in abbrev.<br>
> Handle xlat_styles.<br>
> * tests/ioprio.c: Add xlat macros.<br>
> * tests/ioprio-Xabbrev.c: New test.<br>
> * tests/ioprio-Xraw.c: Likewise.<br>
> * tests/ioprio-Xverbose.c: Likewise.<br>
> * tests/pure_executables.list: Add new tests ioprio-Xabbrev, ioprio-Xraw,<br>
> ioprio-Xverbose.<br>
> * tests/<a href="http://gen_tests.in" rel="noreferrer" target="_blank">gen_tests.in</a>: Likewise.<br>
> * tests/.gitignore: Likewise.<br>
> ---<br>
> ioprio.c | 16 ++++++++++---<br>
> tests/.gitignore | 3 +++<br>
> tests/<a href="http://gen_tests.in" rel="noreferrer" target="_blank">gen_tests.in</a> | 3 +++<br>
> tests/ioprio-Xabbrev.c | 1 +<br>
> tests/ioprio-Xraw.c | 2 ++<br>
> tests/ioprio-Xverbose.c | 2 ++<br>
> tests/ioprio.c | 47 +++++++++++++++++++++++++++++++++----<br>
> tests/pure_executables.list | 3 +++<br>
> 8 files changed, 69 insertions(+), 8 deletions(-)<br>
> create mode 100644 tests/ioprio-Xabbrev.c<br>
> create mode 100644 tests/ioprio-Xraw.c<br>
> create mode 100644 tests/ioprio-Xverbose.c<br>
> <br>
> diff --git a/ioprio.c b/ioprio.c<br>
> index 2d7c4f6a..9b378450 100644<br>
> --- a/ioprio.c<br>
> +++ b/ioprio.c<br>
> @@ -45,8 +45,11 @@ SYS_FUNC(ioprio_get)<br>
> } else {<br>
> if (syserror(tcp))<br>
> return 0;<br>
> -<br>
> - tcp->auxstr = sprint_ioprio(tcp->u_rval);<br>
> + if ((xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW) ||<br>
> + (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE))<br>
> + tcp->auxstr = NULL;<br>
> + else<br>
> + tcp->auxstr = sprint_ioprio(tcp->u_rval);<br>
> return RVAL_STR;<br>
<br>
Why do you handle XLAT_STYLE_VERBOSE as XLAT_STYLE_RAW here?<br>
<br>
> }<br>
> }<br>
> @@ -58,7 +61,14 @@ SYS_FUNC(ioprio_set)<br>
> /* int who */<br>
> tprintf(", %d, ", (int) tcp->u_arg[1]);<br>
> /* int ioprio */<br>
> - tprints(sprint_ioprio(tcp->u_arg[2]));<br>
> + if (xlat_verbose(xlat_verbosity) != XLAT_STYLE_ABBREV)<br>
> + tprintf("%d", (int) tcp->u_arg[2]);<br>
> +<br>
> + if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW)<br>
> + return RVAL_DECODED;<br>
> +<br>
> + (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE<br>
> + ? tprints_comment : tprints)(sprint_ioprio(tcp->u_arg[2]));<br>
> <br>
> return RVAL_DECODED;<br>
<br>
The check for XLAT_STYLE_RAW seems to be redundant here.<br>
<br>
<br>
-- <br>
ldv<br>
-- <br>
Strace-devel mailing list<br>
<a href="mailto:Strace-devel@lists.strace.io" target="_blank">Strace-devel@lists.strace.io</a><br>
<a href="https://lists.strace.io/mailman/listinfo/strace-devel" rel="noreferrer" target="_blank">https://lists.strace.io/mailman/listinfo/strace-devel</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">Regards,<div>Shankara Pailoor</div></div>