[PATCH v1] update quotactl to not print QCMD macro under Xraw

shankarapailoor shankarapailoor at gmail.com
Sat Dec 22 02:22:13 UTC 2018


Hi,

>First of all, I tried to build strace with this patch applied but
got a lot of similar errors of the following kind:

What version of gcc do you use? I don't see these errors when running
make check. I use gcc 7.3.0

> Please add an empty line after the first line of commit message,
otherwise it becomes a single line of enormous length.

Ack

> Why -a1?

I noticed that quotactl-Xraw would fail because there would be large
numbers of spaces between the right parentheses ')' and the equals
sign. In my test it assumed only one space. Specifying -a1 worked.

>Please keep this list sorted.

I placed these according to unix sort utility which said -Xabbrev
should go before -xfs. Do you want capital letters after lowercase?

> tests/quotactl.h is included by more than one source file but these functions are defined only in one of them. What was the rationale for this design decision?

My habit is to put macro definitions in the header file. Apologies, will move.

On Fri, Dec 21, 2018 at 4:46 PM Dmitry V. Levin <ldv at altlinux.org> wrote:
>
> Hi Shankara,
>
> On Wed, Dec 19, 2018 at 05:21:11AM -0800, shankarapailoor wrote:
> > Hi Dmitry,
> >
> > Attached is an updated version which I think addresses your comments above.
>
> First of all, I tried to build strace with this patch applied but
> got a lot of similar errors of the following kind:
>
> In file included from ../../tests/quotactl-Xverbose.c:2:
> ../../tests/quotactl.c: In function 'main':
> ../../tests/quotactl.c:209:54: error: '%s' directive output may be truncated writing up to 1023 bytes into a region of size 1010 [-Werror=format-truncation=]
>   snprintf(quotacmd_str, sizeof(quotacmd_str), "%u /* %s */", cmd, abbrev_str);
>                                                       ^~
> ../../tests/quotactl.c:259:2:
>   check_quota(CQF_NONE, bogus_cmd, gen_quotacmd(invalid_cmd_str, bogus_cmd),
>   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>        bogus_special, bogus_special_str, bogus_id, bogus_addr);
>        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from /usr/include/stdio.h:862,
>                  from ../../tests/quotactl.c:21,
>                  from ../../tests/quotactl-Xverbose.c:2:
> /usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 18 and 1041 bytes into a destination of size 1024
>    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
>           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>         __bos (__s), __fmt, __va_arg_pack ());
>         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> > From f4cc5d7b1181aeee038566d3ae752669d234ae0f Mon Sep 17 00:00:00 2001
> > From: Shankara Pailoor <shankarapailoor at gmail.com>
> > Date: Wed, 19 Dec 2018 05:01:40 -0800
> > Subject: [PATCH v1] quotactl: change quotactl to properly handle -Xraw
> >  * quota.c: add new function print_qcmd that properly handles -Xraw, -Xverbose
> >  * tests/quotactl.c: extend quotactl tests to properly handle -Xraw, -Xverbose
> >  * tests/quotactl.h: Likewise
> >  * tests/quotactl-Xabbrev.c: New tests for handle -X flags
> >  * tests/quotactl-Xraw.c: Likewise
> >  * tests/quotactl-Xverbose.c: Likewise
> >  * tests/pure_executables.list: Add new tests
> >  * tests/gen_tests.in: Likewise
> >  * tests/.gitignore: Likewise
>
> Please add an empty line after the first line of commit message,
> otherwise it becomes a single line of enormous length.
>
> > diff --git a/tests/.gitignore b/tests/.gitignore
> > index 918b95be..ecf30855 100644
> > --- a/tests/.gitignore
> > +++ b/tests/.gitignore
> > @@ -412,10 +412,13 @@ quotactl
> >  quotactl-success
> >  quotactl-success-v
> >  quotactl-v
> > +quotactl-Xabbrev
> >  quotactl-xfs
> >  quotactl-xfs-success
> >  quotactl-xfs-success-v
> >  quotactl-xfs-v
> > +quotactl-Xraw
> > +quotactl-Xverbose
> >  read-write
> >  readahead
> >  readdir
>
> Please keep this list sorted.
>
> > diff --git a/tests/gen_tests.in b/tests/gen_tests.in
> > index 9f7e605c..8b81b4d6 100644
> > --- a/tests/gen_tests.in
> > +++ b/tests/gen_tests.in
> > @@ -334,10 +334,13 @@ pselect6
> >  ptrace       -a23 -e signal=none
> >  ptrace_syscall_info  -a35 -e signal=none -e trace=ptrace
> >  pwritev      -a22 -s7
> > -quotactl
> > +quotactl -a1
>
> Why do you need to change this?
>
> >  quotactl-v   -v -e trace=quotactl
> >  quotactl-xfs -e trace=quotactl
> >  quotactl-xfs-v       -v -e trace=quotactl
> > +quotactl-Xabbrev -a1 -Xabbrev -e trace=quotactl
> > +quotactl-Xraw        -a1     -Xraw -e trace=quotactl
> > +quotactl-Xverbose    -a1     -Xverbose -e trace=quotactl
>
> Why -a1?
>
> >  read-write   -a15 -eread=0,5 -ewrite=1,4 -e trace=read,write -P read-write-tmpfile -P /dev/zero -P /dev/null
> >  readahead    -a1
> >  readdir      -a16
> > diff --git a/tests/pure_executables.list b/tests/pure_executables.list
> > index b8120f2b..afd00cab 100755
> > --- a/tests/pure_executables.list
> > +++ b/tests/pure_executables.list
> > @@ -340,6 +340,9 @@ ptrace_syscall_info
> >  pwritev
> >  quotactl
> >  quotactl-xfs
> > +quotactl-Xabbrev
> > +quotactl-Xraw
> > +quotactl-Xverbose
> >  read-write
> >  readahead
> >  readdir
>
> Please keep this list sorted.
>
> > diff --git a/tests/quotactl.h b/tests/quotactl.h
> > index e624c6ae..15996c44 100644
> > --- a/tests/quotactl.h
> > +++ b/tests/quotactl.h
> > @@ -39,6 +39,10 @@
> >  #  define PRJQUOTA 2
> >  # endif
> >
> > +#define QUOTA_STR(_arg) (_arg), gen_quotacmd(#_arg, _arg)
> > +#define QUOTA_ID_STR(_arg) (_arg), gen_quotaid(#_arg, _arg)
> > +#define QUOTA_STR_INVALID(_arg, str) (_arg), gen_quotacmd(str, _arg)
> > +
>
> tests/quotactl.h is included by more than one source file but
> these functions are defined only in one of them.
> What was the rationale for this design decision?
>
>
> --
> ldv
> --
> Strace-devel mailing list
> Strace-devel at lists.strace.io
> https://lists.strace.io/mailman/listinfo/strace-devel



-- 
Regards,
Shankara Pailoor


More information about the Strace-devel mailing list