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, 30 Aug 2023 20:33:56 +0900
From:   Masahiro Yamada <masahiroy@...nel.org>
To:     Nicolas Schier <nicolas@...sle.eu>
Cc:     linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
        Christophe Leroy <christophe.leroy@...roup.eu>,
        Michael Ellerman <mpe@...erman.id.au>,
        Nathan Chancellor <nathan@...nel.org>,
        Nicholas Piggin <npiggin@...il.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH] kbuild: single-quote the format string of printf

On Wed, Aug 30, 2023 at 10:00 AM Nicolas Schier <nicolas@...sle.eu> wrote:
>
> On Tue 29 Aug 2023 20:35:31 GMT, Masahiro Yamada wrote:
> > Use single-quotes to avoid escape sequences (\\n).
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
> > ---
>
> Is this really necessary?  Testing w/ GNU Make 4.3, bash 5.2.15 or
> dash 0.5.12-6 and a stupid Makefile snippet I cannot see any difference
> between these three:
>
> print:
>         @printf "hello med single-backslash and double quotes\n"
>         @printf 'hello med single-backslash and single quotes\n'
>         @printf "hello med double-backslash and double quotes\\n"
>
> Only double-backslash+n in single-quotes does not work, for obvious
> reasons.


You are right.

I was misunderstanding the backslash-escaping in double-quotes.

I always used single-quotes when I wanted to avoid
escape sequences.

The following POSIX spec applies here:


  2.2.3 Double-Quotes

  The <backslash> shall retain its special meaning as an escape character
  (see Escape Character (Backslash)) only when followed by one of the
  following characters when considered special:

  $   `   "   \   <newline>




https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html


All of "\\n", "\n", '\n' are the same.



-- 
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ