<?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>7389</bug_id>
          
          <creation_ts>2015-03-04 00:08:49 +0000</creation_ts>
          <short_desc>menuconfig runs malformed run.do_terminal shell script when certain environment variables are present</short_desc>
          <delta_ts>2015-04-17 16:24:14 +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>OE-Core</product>
          <component>core</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>x86_64</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Low</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>1.8 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Haris Okanovic">haris.okanovic</reporter>
          <assigned_to name="Alejandro Hernandez">alejandro.hernandez</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>Unknown (Hard to categorize)</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>49166</commentid>
    <comment_count>0</comment_count>
    <who name="Haris Okanovic">haris.okanovic</who>
    <bug_when>2015-03-04 00:08:49 +0000</bug_when>
    <thetext>Try to run `export FOO=&apos;${}&apos; &amp;&amp; bitbake -c menuconfig busybox;` in the dizzy branch of openembedded-core (bitbake 1.24). Assuming tmux is installed and selected by OE/bitbake, you should see several messages like this before bitbake bails out:

  Trying to run: tmux att -t devshell-31784
  session not found: devshell-31784

The tmux window tries to run a generated shell script `run.do_terminal.##` under tmp-glibc which contains a malformed line `export FOO=&quot;${}&quot;`. /bin/sh (dash in my case) immediately fails to parse it with a &quot;Bad substitution&quot; error. As a result, the tmux session ends before bitbake can attach.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49185</commentid>
    <comment_count>1</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2015-03-04 21:58:33 +0000</bug_when>
    <thetext>Can you be more clear what your use case is for this?  We know that there are 
some issues with dash, so if you are setting an  export with a bad substitution 
for DASH, that does not make sense and will fail, if you can use bash does it 
work correctly?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49225</commentid>
    <comment_count>2</comment_count>
    <who name="Haris Okanovic">haris.okanovic</who>
    <bug_when>2015-03-05 16:29:33 +0000</bug_when>
    <thetext>(In reply to comment #1)

&gt; Can you be more clear what your use case is for this?
Our build system is orchestrated by GNU Make, which sets up the bitbake
environment to build OE, run menuconfig, etc. That process (and I don&apos;t
know the exact details atm) sets MAKEOVERRIDES to something resembling
a shell substitution, which gets incorrectly translated into the
aforementioned run.do_terminal.## script.

&gt; so if you are setting an  export with a bad substitution for DASH,
&gt; that does not make sense and will fail
`export FOO=&apos;${}&apos;` is not a substitution because it&apos;s a single-quoted
string. The problem I described happens when a single-quoted string
resembling a substitution is translated into a double-quoted string
(in run.do_terminal.##) and the shell tries to expand it.

&gt; if you can use bash does it work correctly?
Unfortunately no. Bash fails to parse the malformed substitution as
well. Additionally, run.do_terminal.## tries to set BASHOPTS, which
is read-only in bash.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49478</commentid>
    <comment_count>3</comment_count>
    <who name="Stephen K Jolley">sjolley.yp.pm</who>
    <bug_when>2015-03-16 19:32:32 +0000</bug_when>
    <thetext>It appears the question has been answered.  If this still needs info, please put the bug back into the needinfo status.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>50390</commentid>
    <comment_count>4</comment_count>
    <who name="Alejandro Hernandez">alejandro.hernandez</who>
    <bug_when>2015-04-17 16:24:14 +0000</bug_when>
    <thetext>This is fixed in master here:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=0a791e91e55d30b328ddbd90fdb0d5911c388b96

Although as Martin Jansa stated on the list, it can&apos;t be integrated on the current Dizzy branch because it breaks something else, if you need it, hopefully you can still use that patch to fix your problem.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>