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

Submitter:  Haruki TSURUMOTO <tsuroot>
Submitted:  Thu 20 Apr 2017 09:07:26 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  khali
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group administrator
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>
Group administrator
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>
Group administrator
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 Files:
   
   
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
  • -email is unavailable- added by khali (Posted a comment)
  • -email is unavailable- added by tsuroot (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-05-02 khali StatusNeed 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
    2017-04-25 khali Attached File- Added fix-append-lf.patch, #40503
    2017-04-24 tsuroot Attached File- Added fix-append-lf.patch, #40484
    2017-04-24 khali StatusNone Need Info
        Assigned toNone khali

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code