lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 15 Jun 2021 07:18:01 +0000
From:   Justin He <Justin.He@....com>
To:     Rasmus Villemoes <linux@...musvillemoes.dk>,
        Petr Mladek <pmladek@...e.com>
CC:     Steven Rostedt <rostedt@...dmis.org>,
        Sergey Senozhatsky <senozhatsky@...omium.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Jonathan Corbet <corbet@....net>,
        Alexander Viro <viro@...iv.linux.org.uk>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        Eric Biggers <ebiggers@...gle.com>,
        "Ahmed S. Darwish" <a.darwish@...utronix.de>,
        "linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>
Subject: RE: [PATCH RFCv3 2/3] lib/vsprintf.c: make %pD print full path for
 file



> -----Original Message-----
> From: Rasmus Villemoes <linux@...musvillemoes.dk>
> Sent: Tuesday, June 15, 2021 3:15 PM
> To: Justin He <Justin.He@....com>; Petr Mladek <pmladek@...e.com>
> Cc: Steven Rostedt <rostedt@...dmis.org>; Sergey Senozhatsky
> <senozhatsky@...omium.org>; Andy Shevchenko
> <andriy.shevchenko@...ux.intel.com>; Rasmus Villemoes
> <linux@...musvillemoes.dk>; Jonathan Corbet <corbet@....net>; Alexander
> Viro <viro@...iv.linux.org.uk>; Linus Torvalds <torvalds@...ux-
> foundation.org>; Peter Zijlstra (Intel) <peterz@...radead.org>; Eric
> Biggers <ebiggers@...gle.com>; Ahmed S. Darwish <a.darwish@...utronix.de>;
> linux-doc@...r.kernel.org; linux-kernel@...r.kernel.org; linux-
> fsdevel@...r.kernel.org
> Subject: Re: [PATCH RFCv3 2/3] lib/vsprintf.c: make %pD print full path for
> file
>
> On 15/06/2021 08.48, Justin He wrote:
> > Hi Petr
> >
>
> >>> +   /* no filling space at all */
> >>> +   if (buf >= end || !buf)
> >>> +           return buf + reserved_size;
> >>> +
> >>> +   /* small space for long name */
> >>> +   if (buf < end && prepend_len < 0)
> >>> +           return string_truncate(buf, end, p, dpath_len, spec);
> >>
> >> We need this only because we allowed to write the path behind
> >> spec.field_width. Do I get it right?
> >
> > Both of field_width and precision:
> > "%.14pD" or "%8.14pD"
>
> Precision is never gonna be used with %p (or any of its kernel
> extensions) because gcc would tell you
>
> foo.c:5:13: warning: precision used with �%p� gnu_printf format [-
> Wformat=]
>     5 |  printf("%.5p\n", foo);
>
> and there's no way -Wformat is going to be turned off to allow that usage.
>
> IOW, there's no need to add complexity to make "%.3pD" of something that
> would normally print "/foo/bar" merely print "/fo", similar to what a
> precision with %s would mean.
>
Aha, this answer my question in last email.
Thank you


--
Cheers,
Justin (Jia He)


> As for field width, I don't know if it's worth honouring, but IIRC the
> original %pd and %pD did that (that's where we have widen_string etc. from).
>
> Other %p extensions put the field with to some other use (e.g. the
> bitmap and hex string printing), so they obviously cannot simultaneously
> use it in the traditional sense.
>
> Rasmus
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ