<?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>8325</bug_id>
          
          <creation_ts>2015-09-18 10:32:29 +0000</creation_ts>
          <short_desc>devtool modify could handle patch failure more usefully</short_desc>
          <delta_ts>2022-01-21 22:19:35 +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>Scripts and Tools</component>
          <version>1.8</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>OBSOLETE</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard> </status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>4.99</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Paul Eggleton">bluelightning</reporter>
          <assigned_to name="Paul Eggleton">bluelightning</assigned_to>
          <cc>alex.kanavin</cc>
    
    <cc>cpanceac</cc>
    
    <cc>kergoth</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>ross.burton</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>54254</commentid>
    <comment_count>0</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2015-09-18 10:32:29 +0000</bug_when>
    <thetext>Because we&apos;re effectively using PATCHTOOL = &quot;git&quot; when we apply patches within &quot;devtool modify&quot; or &quot;devtool extract&quot;, which is not the default (the default during a normal build for most recipes is &quot;quilt&quot;), sometimes patching fails where it does not during a normal build due to someone leaving a patch that&apos;s already been applied in the recipe - quilt doesn&apos;t error on these by default. Here&apos;s an example (from poky master at 75bad1b64bd485a50af69ed1f8663a0dadbb5f9e):

------------ snip ------------
$ devtool extract unzip /tmp/unzip
Parsing recipes..done.
NOTE: Fetching unzip...
NOTE: Unpacking...
NOTE: Patching...
ERROR: Command Error: exit status: 1  Output:
checking file extract.c
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
2 out of 2 hunks ignored
ERROR: Command Error: exit status: 1  Output:
checking file extract.c
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
2 out of 2 hunks ignored
Traceback (most recent call last):
  File &quot;/home/paul/poky/poky/scripts/devtool&quot;, line 290, in &lt;module&gt;
    ret = main()
  File &quot;/home/paul/poky/poky/scripts/devtool&quot;, line 279, in main
    ret = args.func(args, config, basepath, workspace)
  File &quot;/home/paul/poky/poky/scripts/lib/devtool/standard.py&quot;, line 184, in extract
    initial_rev = _extract_source(srctree, args.keep_temp, args.branch, rd)
  File &quot;/home/paul/poky/poky/scripts/lib/devtool/standard.py&quot;, line 350, in _extract_source
    task_executor.exec_func(&apos;do_patch&apos;, False)
  File &quot;/home/paul/poky/poky/scripts/lib/devtool/standard.py&quot;, line 215, in exec_func
    bb.build.exec_func(func, localdata)
FuncFailed: Function failed: patch_do_patch
------------ snip ------------

A couple of things that aren&apos;t ideal here:

1) There&apos;s a traceback shown, we don&apos;t need one

2) We&apos;re seeing the error message twice (perhaps due to multiple log handlers bitbake&apos;s own and devtool maybe?)

3) Most annoyingly, it doesn&apos;t actually tell you which patch failed to apply (this logic is in patch.bbclass)

Additionally, it may be that we have a mode that devtool can enable to allow these &quot;previously applied&quot; patches to generate a warning instead of a failure given the default behaviour with quilt.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54269</commentid>
    <comment_count>1</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2015-09-18 14:03:45 +0000</bug_when>
    <thetext>Hmm, so it turns out that in the case of unzip the patch failed to apply because of a bug in lib/oe/patch.py rather than the patch being already applied. Having said that the above is still valid - a recent example of a recipe where this happened (which I am about to send a patch for) is qt4-x11-free.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60409</commentid>
    <comment_count>2</comment_count>
    <who name="Christopher Larson">kergoth</who>
    <bug_when>2016-03-24 19:11:16 +0000</bug_when>
    <thetext>I just ran into a patch failure with modify -x today, not because of the different PATCHTOOL, it was failing with a regular build too, but I was thinking it&apos;d be nice if devtool could be used as a nicer patch resolution workflow than either PATCHRESOLVE or manual.

I.e. if devtool used git-am to apply the multiple patches at once, then you could drop into the in-progress tree, fix the conflicts, git add the files, git am --resolved, and continue. of course, devtool woudlnt&apos; be able to do any postprocessing after those fixups unless modify -x had its own --continue, but it&apos;s something to consider, anyway.

The current yocto workflow for resolving patch application failures rather sucks :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62516</commentid>
    <comment_count>3</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2016-05-29 23:10:58 +0000</bug_when>
    <thetext>Thanks to some improvements in the underlying patch code, the name of the failed patch is now being reported. The traceback is also fixed. I&apos;m therefore changing this to an enhancement.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67970</commentid>
    <comment_count>4</comment_count>
    <who name="Alexander Kanavin">alex.kanavin</who>
    <bug_when>2016-11-04 13:54:39 +0000</bug_when>
    <thetext>I&apos;d like &apos;devtool modify&apos; to be able to rebase patches in a way similar to &apos;devtool upgrade&apos;. Currently it simply fails altogether:

k@kanavin-desktop:~/development/poky/build$ devtool modify libksba
Parsing recipes..done.
NOTE: Fetching libksba...
NOTE: Unpacking...
NOTE: Patching...
ERROR: Applying &apos;ksba-add-pkgconfig-support.patch&apos; failed:
checking file Makefile.am
Hunk #1 FAILED at 21.
1 out of 1 hunk FAILED
checking file configure.ac
Hunk #1 succeeded at 414 (offset 14 lines).
checking file ksba.pc.in
checking file src/ksba.m4
ERROR: Function failed: patch_do_patch
ak@kanavin-desktop:~/development/poky/build$

Instead it could use &apos;git am&apos; to assist with conflict resolution - if something fails, indicate what it was and let the user edit the files containing conflict resolution markers. There was a discussion about this on oe-core list:

http://lists.openembedded.org/pipermail/openembedded-core/2016-November/128368.html

This feature would be needed for updating patches so that they contain correct context, across all layers:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=10450</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71729</commentid>
    <comment_count>5</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2017-03-24 19:34:50 +0000</bug_when>
    <thetext>Paul, 
Will this medium Enhancement and the medium+ defect that it blocks ( https://bugzilla.yoctoproject.org/show_bug.cgi?id=10450 ) will move to 2.4?

Is there anything that we can do to help move things along?

I think people are not sure of the implications of patch fuzz variations and they are concerned that YP some misapplied patches that could affect system quality. I suspect but don&apos;t have the proof that this is not the case. If you have any stats on the occurrence of (silent) errors, please add them to one of these defects.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72015</commentid>
    <comment_count>6</comment_count>
    <who name="Cornel Panceac">cpanceac</who>
    <bug_when>2017-04-03 10:26:50 +0000</bug_when>
    <thetext>Anything new here? We would be happy to have the feature requested by Alexander, in order to quicken the &apos;fuzz&apos; issues fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77863</commentid>
    <comment_count>7</comment_count>
    <who name="Alexander Kanavin">alex.kanavin</who>
    <bug_when>2017-10-30 13:56:21 +0000</bug_when>
    <thetext>I have played with &apos;git am&apos; and &apos;git apply&apos;, and I believe there is actually no way to make it work. Three-way resolution works only if git has a tree to which the patch can be applied correctly. In this case, there is no such tree: all we have is the single, current version of the recipe (unlike devtool upgrade). We can also partially apply the patches, but that&apos;s pretty cumbersome, and error-prone.

However, I have suggested a different way to move forward with the issue: please refer to bug 10450 for more details.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78135</commentid>
    <comment_count>8</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2017-11-09 22:14:44 +0000</bug_when>
    <thetext>Reopening - I think we can still do something here, whether it arrives in time to be useful for this exercise is another question, but I&apos;ll try.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79827</commentid>
    <comment_count>9</comment_count>
    <who name="Alexander Kanavin">alex.kanavin</who>
    <bug_when>2018-03-15 07:46:53 +0000</bug_when>
    <thetext>The fuzz issue has now been fixed, please refer to https://bugzilla.yoctoproject.org/show_bug.cgi?id=10450#c20 for details. 

Instead of using devtool modify to rebase the patches, we use devtool finish/update-recipe to refresh them.

Whether something useful could be done with &apos;devtool modify&apos; and failing patches is up to Paul to research and decide.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92385</commentid>
    <comment_count>10</comment_count>
    <who name="Alexander Kanavin">alex.kanavin</who>
    <bug_when>2022-01-21 22:19:35 +0000</bug_when>
    <thetext>The issue is totally obsolete by this point - I haven&apos;t seen it in years.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>