bugQuilt - Bugs: bug #50841, When $EDITOR output has no LF code...

 
 

bug #50841: When $EDITOR output has no LF code on last line, quilt header saves wrong patch file

Submitted by:  Haruki TSURUMOTO <tsuroot>
Submitted on:  Thu 20 Apr 2017 09:07:26 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Jean Delvare <khali>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 02 May 2017 01:07:26 PM UTC, comment #5:

Fix committed:

header: Fix patch corruption when trailing newline is missing

http://git.savannah.nongnu.org/cgit/quilt.git/commit/?id=102ab72dc48297be33d62dbe73536a714bcbf464

Jean Delvare <khali>
Project AdministratorIn charge of this item.
Sat 29 Apr 2017 02:06:46 PM UTC, comment #4:

I tested this patch, and it's good to me.
My patch is not good as compared to this.
Thank you.

Haruki TSURUMOTO <tsuroot>
Tue 25 Apr 2017 02:11:55 PM UTC, comment #3:

Thanks for the patch. In the future, please avoid unnecessary white space changes, they make patches harder to review.

Your patch breaks the test suite (make check). I think your test breaks if the header is completely empty (in which case not having a trailing newline is OK so it should not be added.)

From an implementation perspective, having to call cat, tail and wc to detect this rare case doesn't seem optimal to me. You can easily get rid of "cat" by passing the file name directly to "tail", but I think it is even more efficient to use "tail -c" instead of "tail -n". We'll need to add a test for the availability of this option to the configure script, but it seems to be widely available so it shouldn't be a problem.

I have a working patch based on "tail -c", which passes the test suite. I'll attach it so you can review and test it.

Jean Delvare <khali>
Project AdministratorIn charge of this item.
Mon 24 Apr 2017 12:06:06 PM UTC, comment #2:

Hello.
This is my patch.
Does it make sense?
If so, I'm happy.

Regards,

Haruki

(file #40484)

Haruki TSURUMOTO <tsuroot>
Mon 24 Apr 2017 11:44:10 AM UTC, comment #1:

I did not use an editor which allows this for a long time. I just reinstalled nedit for that purpose and indeed you can corrupt the patch file by editing the header and saving it without a trailing newline.

If you already have a patch fixing this, please attach it and I'll be happy to test and commit it.

Jean Delvare <khali>
Project AdministratorIn charge of this item.
Thu 20 Apr 2017 09:07:26 PM UTC, original submission:

Dear maintainer,

When writing comment by some editors(e.g. Emacs) on running `quilt header -e`,
sometimes user wrote no LF code in comment's last line.
In such case, patch would be bad format.
Is this correct behavior?

By way of trial, I wrote a patch for this behavior.
Would I upload this?

By the way, I found this behavior when patching to debian package.

Haruki TSURUMOTO <tsuroot>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #40503:  fix-append-lf.patch added by khali (936B - text/x-patch - [PATCH] header: Fix patch corruption when trailing newline is missing (v2))
file #40484:  fix-append-lf.patch added by tsuroot (323B - text/x-patch - My patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 02 May 2017 01:07:26 PM UTCkhaliStatusNeed Info=>Fixed
      Open/ClosedOpen=>Closed
      SummaryWhen $EDITOR output has no LF code on last line, quilt header saves wrong patch file.=>When $EDITOR output has no LF code on last line, quilt header saves wrong patch file
    Tue 25 Apr 2017 02:17:18 PM UTCkhaliAttached File-=>Added fix-append-lf.patch, #40503
    Mon 24 Apr 2017 12:06:06 PM UTCtsurootAttached File-=>Added fix-append-lf.patch, #40484
    Mon 24 Apr 2017 11:44:10 AM UTCkhaliStatusNone=>Need Info
      Assigned toNone=>khali

    Back to the top


    Powered by Savane 3.1-cleanup1