<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>13995</bug_id>
          
          <creation_ts>2020-08-03 10:40:44 +0000</creation_ts>
          <short_desc>\ without a newline passes the parser</short_desc>
          <delta_ts>2025-01-04 11:50:49 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>BitBake</product>
          <component>bitbake</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>5.99</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>kweihmann</reporter>
          <assigned_to name="Unassigned">unassigned</assigned_to>
          <cc>akuster</cc>
    
    <cc>mark.asselstine</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>randy.macleod</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>87874</commentid>
    <comment_count>0</comment_count>
    <who name="">kweihmann</who>
    <bug_when>2020-08-03 10:40:44 +0000</bug_when>
    <thetext>A statement like &apos;A = &quot;a b c \&quot;&apos; passes the parser, although &apos;\&apos; should be an undesired symbol in the final variable.
&apos;A = &quot;a b c \\n&quot;&apos; on the other hand is correctly expanded into the desired state of &apos;A = &quot;a b c &quot;&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97098</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-10-30 15:37:24 +0000</bug_when>
    <thetext>Build move to 5.0 -- ../Randy</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98819</commentid>
    <comment_count>2</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-04-25 01:13:52 +0000</bug_when>
    <thetext>Bulk move of 5.0 medium importance issues to 5.99.
Move to 5.1 if you want to actively work on an issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98859</commentid>
    <comment_count>3</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-04-25 01:23:11 +0000</bug_when>
    <thetext>Move to 5.99 since no one is actively working on this issue.
Move to 5.x if you start on a task, please.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100514</commentid>
    <comment_count>4</comment_count>
    <who name="Mark">mark.asselstine</who>
    <bug_when>2024-12-28 16:14:59 +0000</bug_when>
    <thetext>(In reply to kweihmann from comment #0)
&gt; A statement like &apos;A = &quot;a b c \&quot;&apos; passes the parser, although &apos;\&apos; should be
&gt; an undesired symbol in the final variable.
&gt; &apos;A = &quot;a b c \\n&quot;&apos; on the other hand is correctly expanded into the desired
&gt; state of &apos;A = &quot;a b c &quot;&apos;

Can you expand on &quot;undesired symbol&quot;?

According to the documentation - https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-metadata.html#line-joining &quot;BitBake joins any line ending in a backslash character (”\”) with the following line before parsing statements&quot;. In your example the &apos;\&apos; is not the last character, so does not trigger line joining.

Additionally &quot;BitBake does not interpret escape sequences like “\n” in variable values.&quot;. As such the single &apos;\&apos; is essentially dropped from the string, as is happening.

Thus my question, what is it that you are expecting to see?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100521</commentid>
    <comment_count>5</comment_count>
    <who name="">kweihmann</who>
    <bug_when>2025-01-03 07:36:35 +0000</bug_when>
    <thetext>&apos;A = &quot;a b c \&quot;&apos; literally remains &apos;A = &quot;a b c \&quot;&apos; after parsing.
As in the statement it is the end of the line, I would expect it to be &apos;A = &quot;a b c&quot;&apos; after parsing, but it isn&apos;t - and that&apos;s the bug for me, as I read the documentation in that way, that it will remove &apos;\&apos; from the output.
The &apos;\n&apos;  was just for illustration of the issue</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100531</commentid>
    <comment_count>6</comment_count>
    <who name="Mark">mark.asselstine</who>
    <bug_when>2025-01-03 15:52:56 +0000</bug_when>
    <thetext>Thanks for the additional information.

Just so we are clear, for:

A = &quot;a b c \&quot;

The &quot; character is the last character of the line
The \ character is the last character of the string

So again referring to the manual in the &quot;Line Joining&quot; section there is a NOTE 

&quot;BitBake does not interpret escape sequences like “\n” in variable values. For these to have an effect, the value must be passed to some utility that interprets escape sequences, such as printf or echo -n.&quot;

Since the &apos;\&apos; is not the last character in the line, line joining is not applied here. Since &apos;\&apos; is in the string, the NOTE does apply and the escape sequence does not get interpreted. So a &quot;\&quot; character in the string, remains in the string. The behavior is matching the documentation and so I don&apos;t believe this is a bug.

I know that you were using &quot;\\n&quot; to illustrate your point, but I am actually unable to reproduce your results. Building hello-world (https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-hello.html) with &apos;A = &quot;a b c \\n&quot;&apos; in printhello.bb along with &apos;bb.plain(d.getVar(&quot;A&quot;))&apos; added to do_build() results in the string being output as &quot;a b c \\n&quot;. Again this follows what is described in the NOTE. Are you able to provide an example which can be reproduced?

PS. In my earlier comment I incorrectly said the &quot;\&quot; would be dropped, I had meant to say it would remain, as-is, again based on the documented behavior.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100532</commentid>
    <comment_count>7</comment_count>
    <who name="">kweihmann</who>
    <bug_when>2025-01-04 11:50:49 +0000</bug_when>
    <thetext>If &apos;\&quot;&apos; is interpreted as an escape sequence, then I would at least expect the variable set operation to fail, as the &apos;&quot;a b c \&quot;&apos; would have an opened double quote but no closing one.
None of that happens, it just will be passed on leading to in this particular case very hard to debug problems, if the value of the escape &apos;&quot;&apos; will be passed on into e.g. a shell call.

All of the documentation mentions &apos;&quot;&lt;something something&gt;&quot;&apos; or &quot;&apos;&lt;something something&gt;&apos;&quot; as the only valid syntax for variable ops, so I honestly believe the parser should at least pass a warning that a quote wasn&apos;t closed.

And that is the bug to me</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>