<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#943634;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#943634'>The colon separator is included at the end of $NEWPATHS so it should not be possible for any false positives.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#943634'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#943634'>The intention of the patch was to avoid $PATH growing when rerunning oe-init-build-env in the same directory multiple times. I only match at the start of $PATH as I wanted to maintain the current functionality that guarantees that the paths are added to the beginning of $PATH and therefore searched before anything else.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#943634'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#943634'>I did not want to go into analyzing $PATH which would have been needed to remove paths for other build trees. Also, I do not actually see this as possible since the static parts of the added paths (/scripts and /bin/) are to generic to be able to remove those paths without the risk of accidentally removing something unrelated.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#943634'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#943634'>However, one thing that can easily be done is to instead reorder “$SOMEPATHS:$NEWPATHS$SOMEOTHERPATHS” to “$NEWPATHS$SOMEPATHS:$SOMEOTHERPATHS”. That should maintain the property of having the new paths at the beginning, while at the same time not grow $PATH unnecessarily if the paths are already present, but preceded by some other paths.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#943634'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#943634'>I will provide a second version of the patch with the relevant part changed to:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#943634'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:Consolas;color:#943634'># Make sure our paths are at the beginning of $PATH<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:Consolas;color:#943634'>NEWPATHS=&quot;${OEROOT}/scripts:$BITBAKEDIR/bin:&quot;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:Consolas;color:#943634'>PATH=$NEWPATHS$(echo $PATH | sed -e &quot;s|:$NEWPATHS|:|g&quot; -e &quot;s|^$NEWPATHS||&quot;)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:Consolas;color:#943634'>unset BITBAKEDIR NEWPATHS<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#943634'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#943634'>//Peter<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#943634'><o:p>&nbsp;</o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> kergoth@gmail.com [mailto:kergoth@gmail.com] <b>On Behalf Of </b>Chris Larson<br><b>Sent:</b> den 9 april 2013 00:40<br><b>To:</b> Paul Eggleton<br><b>Cc:</b> Trevor Woerner; Peter Kjellerstedt; Patches and discussions about the oe-core layer<br><b>Subject:</b> Re: [OE-core] [PATCH 2/3] oe-buildenv-internal: Only add to $PATH if needed<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><p class=MsoNormal>On Mon, Apr 8, 2013 at 10:48 AM, Paul Eggleton &lt;<a href="mailto:paul.eggleton@linux.intel.com" target="_blank">paul.eggleton@linux.intel.com</a>&gt; wrote:<o:p></o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt'>On Monday 08 April 2013 13:31:50 Trevor Woerner wrote:<br>&gt; On Fri, Apr 5, 2013 at 12:59 PM, Peter Kjellerstedt<br>&gt; &lt;<a href="mailto:peter.kjellerstedt@axis.com">peter.kjellerstedt@axis.com</a>&gt; wrote:<br>&gt; &gt; +[ &quot;${PATH#$NEWPATHS}&quot; != &quot;$PATH&quot; ] || PATH=&quot;$NEWPATHS$PATH&quot;<br>&gt;<br>&gt; This is certainly a welcome addition in functionality, but it relies<br>&gt; on the pattern remaining at the start of the PATH (i.e. the user<br>&gt; hasn't played with PATH in any way). Could we not use the<br>&gt; ${parameter/pattern/string} parameter expansion instead (e.g.<br>&gt; &quot;${PATH/$NEWPATHS/}&quot;) so it doesn't matter whether the user has<br>&gt; further modified the PATH?<o:p></o:p></p></div><p class=MsoNormal>Unfortunately I think this is specific to bash, so it may not be portable.<br>Maybe the equivalent can be achieved with sed however.<o:p></o:p></p></div><p class=MsoNormal><br>Also, neither version matches the : separator, which means we could in theory get false positive matches.<br>-- <br>Christopher Larson<o:p></o:p></p></div></div></div></div></body></html>