<?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>3070</bug_id>
          
          <creation_ts>2012-09-07 05:28:47 +0000</creation_ts>
          <short_desc>patch: do_patch failed in a rare case</short_desc>
          <delta_ts>2012-09-18 06:43:23 +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>devtools / tool chain</component>
          <version>1.3</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>2a0d7aded81330e644ac766249aca06b63c3905c, ada2c27f751c6f9277787a5e774927bd38797706</status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jackie Huang">jackie.huang</reporter>
          <assigned_to name="Constantin Musca">constantinx.musca</assigned_to>
          <cc>alexandru.damian</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>24909</commentid>
    <comment_count>0</comment_count>
    <who name="Jackie Huang">jackie.huang</who>
    <bug_when>2012-09-07 05:28:47 +0000</bug_when>
    <thetext>It&apos;s very rare case and only happens when BB_NUMBER_THREADS is a high number and tow patching processes happen to generate the same temp file name(e.g. /tmp/po5gPxpP in the following failure) and are trying to create or open it at the same time:

+NOTE: Applying patch &apos;module_build_man_extensions.diff&apos; (../layers/oe-core/meta/recipes-devtools/perl/perl-5.14.2/debian/module_build_man_extensions.diff)
+ERROR: Command Error: exit status: 1 Output:
+Applying patch module_build_man_extensions.diff
+patching file cpan/Module-Build/lib/Module/Build/Base.pm
+patch: **** Can&apos;t reopen file /tmp/po5gPxpP : No such file or directory
+Patch module_build_man_extensions.diff does not apply (enforce with -f)
+ERROR: Command Error: exit status: 1 Output:
+Applying patch bash42-009
+patch: **** Can&apos;t create file /tmp/po5gPxpP : File exists
+Patch bash42-009 does not apply (enforce with -f)
+ERROR: Function failed: patch_do_patch
+ERROR: Task 626 (/ala-blade291/nxadm/nx/ala-blade29.1/builds-2012-08-31-113750/qemux86_std_bd/layers/oe-core/meta/recipes-devtools/perl/perl_5.14.2.bb, do_patch) failed with exit code &apos;1&apos;
+ERROR: Logfile of failure stored in: /ala-blade291/nxadm/nx/ala-blade29.1/builds-2012-08-31-113750/qemux86_std_bd/bitbake_build/tmp/work/i686-wrs-linux/bash-4.2-r4/temp/do_patch/log.do_patch.

It is known bug for patch(http://savannah.gnu.org/bugs/?29944) and should be fixed in the version later than the following commit in upstram patch:
-----------------------------------------------
commit fdafb60cc0d920fe3f31965013235fbd7fc9d592
Author: Andreas Gruenbacher &lt;agruen@suse.de&gt;
Date:   Thu Sep 16 13:25:32 2010 +0200

    Stop using mktemp() for TMPOUTNAME

I can&apos;t find out which version it was from that point, but at least the latest 2.6.1 alpha versions in ftp://alpha.gnu.org/gnu/patch/ should fix this.

And since there is no patch-native and we use the patch on the host instead, the issue would happen on most host without the above new patch version, so I think it would be a solution for this to uprev patch to the latest version and adding the patch-native.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25330</commentid>
    <comment_count>1</comment_count>
    <who name="Constantin Musca">constantinx.musca</who>
    <bug_when>2012-09-18 06:43:23 +0000</bug_when>
    <thetext>We must use one TMPDIR per process so that the patching processes don&apos;t generate the same temp file name (the &quot;patch&quot; program uses the TMPDIR environment variable for deciding where to create the temp files).</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>