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:   Wed, 8 Feb 2023 16:19:04 +0100
From:   Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To:     Boqun Feng <boqun.feng@...il.com>
Cc:     linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org,
        Miguel Ojeda <ojeda@...nel.org>,
        Alex Gaynor <alex.gaynor@...il.com>,
        Wedson Almeida Filho <wedsonaf@...il.com>,
        Gary Guo <gary@...yguo.net>,
        Björn Roy Baron <bjorn3_gh@...tonmail.com>,
        Vincenzo Palazzo <vincenzopalazzodev@...il.com>,
        Will Deacon <will@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Mark Rutland <mark.rutland@....com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Sergio González Collado <sergio.collado@...il.com>,
        Finn Behrens <fin@...ntec.com>
Subject: Re: [PATCH v2 2/2] sample: rust: print: Add sampe code for Arc printing

On Tue, Feb 7, 2023 at 7:52 PM Boqun Feng <boqun.feng@...il.com> wrote:
>
> +    // Uses `dbg` to print, will move `c`.
> +    dbg!(c);

Perhaps:

    // Uses `dbg` to print, will move `c` (for temporary debugging purposes).
    dbg!(c);

To make it clear it is not meant to be usually committed into the tree.

> +    // Prints debug fmt with pretty-print "#" and number-in-hex "x".
> +    pr_info!("{:#x?}", a);

Apparently, `:#x?` is a bit of an accident: `#` means "alternate"
form, but it turns out it applies to both `x` and `?`, i.e. it is not
that `#` alone implies pretty-printing.

Given the above and that there are improvements under discussion
upstream, perhaps we could avoid giving details for the moment and
just say what it does as a whole, e.g.

    // Pretty-prints the debug formatting with lower-case hexadecimal integers.
    pr_info!("{:#x?}", a);

Some links for those interested:
https://doc.rust-lang.org/std/fmt/index.html#sign0,
https://github.com/rust-lang/rust/issues/75766,
https://github.com/rust-lang/rust/pull/99138#issuecomment-1385331055
and https://github.com/rust-lang/libs-team/issues/165.

Finally, there is a small typo in the commit title. What about:

    rust: samples: print: add sample code for `Arc` printing

I can change these bits on my side if you want & agree with them, to
avoid a v3 just for this.

Thanks for these patches, Boqun!

Cheers,
Miguel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ