Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: "Marty E. Plummer" Newsgroups: gnu.bash.bug Subject: Bash patches format Date: Sat, 19 May 2018 08:46:02 -0500 Lines: 76 Approved: bug-bash@gnu.org Message-ID: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: usenet.stanford.edu 1526737644 19999 208.118.235.17 (19 May 2018 13:47:24 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bash-announce@gnu.org To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=startmail.com; s=2017-11; t=1526737591; bh=KNxFxIr3fiEISohhvoCjC3u9LhoPcILmNNxkgddiG8A=; h=Date:From:To:Cc:Subject:From; b=VSSAcsaHQEdGsk6VfjcyiZEQmNUaSgdR1t6XueH/DfQeWDgKnrPKChb2tWHqpikT5 2AXo+90DLZJr8ACT4tsFDczFy7Bbi4wbBf9/NRG9IAi6K0A4Rie2SJpRwkMjaXfq0N Ys0eCFwbSGl0oIT0VVy2YPDvtrAijc7fbOrKr0ALOkIuRWWdcRt8pHFYANPojrQU9s XuDZpMUh4lGIuOlBRc5NawIvSKLR7vIqLOGkVAtStMOlo1DresPFYOA3OAOQhWLhvl 43ywGzJz4Zm5aFeY5X1ZpiIQ1C/cC/YvalcxldKqABA8a75S7emwQfanzHLr4YykCv whFIZas13qN7w== Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 145.131.90.155 X-Mailman-Approved-At: Sat, 19 May 2018 09:47:19 -0400 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14109 Greetings, In doing some research into ways to better improve the gentoo ebuild qa, I ran across the fact that the official bash patches are provided as -p0, context diffs. I was hoping I could convince you to convert to -p1, unified diffs, such as are produced by diff -u or git format-patch, for the following reasons. 1. unified diffs are easier to size up at a glance as compared to an equivalent context diff; the two following snippets cover the same data/changes, but the unified diff is easier to read at a glance: *** a/lib/readline/history.c 2015-12-28 13:50:31.000000000 -0500 --- b/lib/readline/history.c 2016-09-30 14:28:40.000000000 -0400 *************** *** 308,312 **** { if (history_stifled && history_max_entries > 0) ! history_size = history_max_entries + 2; else history_size = DEFAULT_HISTORY_INITIAL_SIZE; --- 310,316 ---- { if (history_stifled && history_max_entries > 0) ! history_size = (history_max_entries > MAX_HISTORY_INITIAL_SIZE) ! ? MAX_HISTORY_INITIAL_SIZE ! : history_max_entries + 2; else history_size = DEFAULT_HISTORY_INITIAL_SIZE; --- a/lib/readline/history.c 2015-12-28 13:50:31.000000000 -0500 +++ b/lib/readline/history.c 2016-09-30 14:28:40.000000000 -0400 @@ -308,5 +310,7 @@ { if (history_stifled && history_max_entries > 0) - history_size = history_max_entries + 2; + history_size = (history_max_entries > MAX_HISTORY_INITIAL_SIZE) + ? MAX_HISTORY_INITIAL_SIZE + : history_max_entries + 2; else history_size = DEFAULT_HISTORY_INITIAL_SIZE; 2. unified diffs are, generally speaking, smaller than an equivalent context diff, as in hunks where lines are added and removed or changed (instead of just adding or removing lines), the hunk is copied twice in a context diff. Depending on the general composition of a patch, an equivalent unified diff is about 1/3 smaller than the same context diff. 3. A lot of downstream consumers are already taking these patches and converting them to -p1 unified diffs in their source repos already, or, barring that, have to make explicit exceptions to the 'norm' for their packaging/buildscripts. For instance, fedora[1] and debian[2] 'mirror' the official patchset, after converting them to -p1 unified, and gentoo has to make an exception[3] to their eapply call in src_prepare() to apply -p0 patches. The above being said, I don't believe in asking for something to be done without making an attempt of it yourself if it is within your ability. As such, I have taken it upon myself to do the conversion for bash44-{001..019}, and am more than willing to do the same for any other existing patches, if you're willing to continue to provide official patches in this format, for the sake of reduction of duplicated work across all distros. You can find them in my bash-patches[4] github repository. Regards, Marty. [1]: https://src.fedoraproject.org/rpms/bash/tree/master [2]: https://sources.debian.org/patches/bash/ [3]: https://github.com/gentoo/gentoo/blob/master/app-shells/bash/bash-4.4_p19.ebuild#L85-L87 Note the second patch, which is -p1, does not require extra args to eapply [4]: https://github.com/hanetzer/bash-patches