bugQuilt - Bugs: bug #53598, quilt pop; "Patch foo.diff...

 
 

bug #53598: quilt pop; "Patch foo.diff does not remove cleanly" is imprecise

Submitter:  Filipus Klutiero <chealer>
Submitted:  Mon 09 Apr 2018 09:52:47 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Invalid
Privacy:  Public Assigned to:  khali
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 11 Apr 2023 01:11:43 PM UTC, comment #4: 

No, this is not how quilt works, sorry. You cannot make changes to a file which belongs to a patch and decide that these changes do not belong to that patch. If a file belongs to a patch, then all changes made to that file while the patch is the top-most applied patch are expected to belong to that patch.

If you want to make additional changes that should not be part of said patch, then it is your responsibility to first create a separate patch ("quilt new") and add the file to that patch ("quilt add").

The way quilt decides that a patch can be removed ("quilt pop") cleanly is by applying the patch file to the backup files and comparing the result with your current tree. This is the only safe way to do it. Applying a reverse patch, as you suggest, would be less reliable and would not even solve the problem, as your change around line 100 would still show as a difference.

Jean Delvare <khali>
Group administrator
Tue 01 May 2018 02:11:15 PM UTC, comment #3: 

I have seen this happen once more, and I think I can now explain what is happening. Quilt does not just try applying the patch reversed; it tries to restore each file affected by the patch to the state it was before application, as stored in the .pc/ directory.

Even if the popped patch changes line 5 only, a simple change to line 100 done after application can cause this message to appear. Quilt must apply a reverse patch, compare the result with the file backed up in .pc/, and fail with this message if they are not identical.

Filipus Klutiero <chealer>
Thu 19 Apr 2018 09:08:05 PM UTC, comment #2: 

Thank you Jean.

I hit this error once more. It seems the command does help, but its result was unexpected. It reported a change in a file which the patch does not modify. In fact, the file was in the list of files, although I had not intentionally added it there. Perhaps I had added it by error. But in any case the patch did not change pop.test.

This happened with Quilt 0.61. I will open a new report if I reproduce.

cloph2@SWIKID02:/var/www/html/foncierpedia$ quilt pop
Patch WYSIWYG_fix_display.diff does not remove cleanly (refresh it or enforce with -f)
cloph2@SWIKID02:/var/www/html/foncierpedia$ quilt diff -z
Index: foncierpedia/pop.test
===================================================================
--- foncierpedia.orig/pop.test  2018-04-19 13:12:46.410299715 -0400
+++ /dev/null   1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-initial
cloph2@SWIKID02:/var/www/html/foncierpedia$ cat patches/WYSIWYG_fix_display.diff
Fix output of the WYSIWYG plugin - mostly invisible plugin calls, also failure to link on each hotword occurence
Foncierpedia request #5813, #5995
Based on Tiki issue #6551 patch. CKEditor surprinsingly apparently does not support being given the content in 2 different formats without the tiny hack in tiki-ckeditor.js.
Index: MERN/lib/ckeditor_tiki/tiki-ckeditor.js
===================================================================
--- MERN.orig/lib/ckeditor_tiki/tiki-ckeditor.js
+++ MERN/lib/ckeditor_tiki/tiki-ckeditor.js
@@ -207,6 +207,7 @@ $.fn.wysiwygPlugin = function (execution
                                                        return;
                                                }

+                                               $this.html($this.data("source"));
                                                CKEDITOR.replace($this.attr("id"), ckoption);
                                                CKEDITOR.on("instanceReady", function (event) {
                                                        // close others
Index: MERN/lib/wiki-plugins/wikiplugin_wysiwyg.php
===================================================================
--- MERN.orig/lib/wiki-plugins/wikiplugin_wysiwyg.php
+++ MERN/lib/wiki-plugins/wikiplugin_wysiwyg.php
@@ -82,13 +82,10 @@ function wikiplugin_wysiwyg($data, $para
        } else {
                $is_html = true;
        }
-       $html = TikiLib::lib('edit')->parseToWysiwyg( $data, true, $is_html, array('page' => $sourcepage) ); // Les plugins tels que DIV à l'intérieur du plugin ne sont pas analysés ou s'affichent comme vides (bogue #6551).
-       $html = TikiLib::lib('tiki')->parse_data($data, array('is_html' => $is_html)); // Voir https://sourceforge.net/p/tikiwiki/mailman/message/35872294/

-       // Sert seulement à populer FOOTNOTEAREA
        $subContext = new WikiParser_Context_PluginCall('wysiwyg', 'body');
        $content = new WikiParser_Parsable($data, $subContext, $context);
-       $content->parse(array('is_html' => $is_html));
+       $visibleHTML = $content->parse(array('is_html' => $is_html));

        if (TikiLib::lib('tiki')->user_has_perm_on_object( $user, $sourcepage, 'wiki page', 'tiki_p_edit')) {
                $class = "wp_wysiwyg";
@@ -112,7 +109,10 @@ function wikiplugin_wysiwyg($data, $para
                }
                $namespace = htmlspecialchars($namespace);

-               $html = "<div id='$exec_key' class='{$class}'$style data-initial='$namespace' data-html='{$params['use_html']}'>" . $html . '</div>';
+               // Re-parse source for WYSIWYG edition. Pass it via an HTML data attribute.
+               // This parse could be done via AJAX for better performance.
+               $editableSource = TikiLib::lib('edit')->parseToWysiwyg( $data, true, $is_html, array('page' => $sourcepage) ); // Not suitable for display. Les plugins tels que DIV à l'intérieur du plugin ne sont pas analysés ou s'affichent comme vides (bogue #6551).
+               $visibleHTML = "<div id='$exec_key' class='{$class}'$style data-initial='$namespace' data-html='{$params['use_html']}' data-source='" . smarty_modifier_escape($editableSource, 'attr') . "'>" . $visibleHTML . '</div>';

                $js = '$("#' . $exec_key . '").wysiwygPlugin("' . $execution . '", "' . $sourcepage . '", ' . $ckoption . ');';
                if (empty($wikiplugin_included_page)) { // Contourner bogue #6476 en attendant Tiki 18
@@ -121,7 +121,7 @@ function wikiplugin_wysiwyg($data, $para
                                ->add_jq_onready($js);
                }
        }
-       return $html;
+       return $visibleHTML;

 }

cloph2@SWIKID02:/var/www/html/foncierpedia$ quilt files patches/WYSIWYG_fix_display.diff
lib/ckeditor_tiki/tiki-ckeditor.js
lib/wiki-plugins/wikiplugin_wysiwyg.php
pop.test
cloph2@SWIKID02:/var/www/html/foncierpedia$ quilt remove -P patches/WYSIWYG_fix_display.diff pop.tes
File pop.test removed from patch WYSIWYG_fix_display.diff
cloph2@SWIKID02:/var/www/html/foncierpedia$ quilt pop
Patch WYSIWYG_fix_display.diff needs to be refreshed first.
cloph2@SWIKID02:/var/www/html/foncierpedia$ quilt pop -f
Removing patch WYSIWYG_fix_display.diff
Restoring lib/ckeditor_tiki/tiki-ckeditor.js
Restoring lib/wiki-plugins/wikiplugin_wysiwyg.php

Now at patch FOOTNOTEAREA_Automatic.diff
cloph2@SWIKID02:/var/www/html/foncierpedia$

Filipus Klutiero <chealer>
Tue 10 Apr 2018 06:11:58 AM UTC, comment #1: 

$ quilt diff -z

will tell you.

Jean Delvare <khali>
Group administrator
Mon 09 Apr 2018 09:52:47 PM UTC, original submission:  

When trying to unapply a patch which had some of its files modified after application, quilt can refuse (unless -f is specified) if the patch no longer unapplies cleanly. In such cases, quilt 0.65 reports:
Patch [...] does not remove cleanly (refresh it or enforce with -f)

While this is correct, not having patch's output(s) does not help "locating the dirt". It would help a lot to at least indicate which file is unclean. To reproduce:

cloph2@SWIKID02:/var/www/html/foncierpedia$ quilt new quilt_test.diff
Patch quilt_test.diff is now on top
cloph2@SWIKID02:/var/www/html/foncierpedia$ quilt add nochangehere.txt
File nochangehere.txt added to patch quilt_test.diff
cloph2@SWIKID02:/var/www/html/foncierpedia$ quilt add changehere.txt
File changehere.txt added to patch quilt_test.diff
cloph2@SWIKID02:/var/www/html/foncierpedia$ echo stable > nochangehere.txt
cloph2@SWIKID02:/var/www/html/foncierpedia$ echo initial > changehere.txt
cloph2@SWIKID02:/var/www/html/foncierpedia$ quilt refresh
Refreshed patch quilt_test.diff
cloph2@SWIKID02:/var/www/html/foncierpedia$ echo final > changehere.txt
cloph2@SWIKID02:/var/www/html/foncierpedia$ quilt pop
Patch quilt_test.diff does not remove cleanly (refresh it or enforce with -f)
cloph2@SWIKID02:/var/www/html/foncierpedia$ quilt pop -v
Patch quilt_test.diff does not remove cleanly (refresh it or enforce with -f)
cloph2@SWIKID02:/var/www/html/foncierpedia$

Filipus Klutiero <chealer>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by chealer
  • -email is unavailable- added by khali (Posted a comment)
  • -email is unavailable- added by chealer (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-04-11 khali StatusNone Invalid
        Assigned toNone khali
        Open/ClosedOpen Closed
    2018-05-01 chealer Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code