<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.finkproject.org/index.php?action=history&amp;feed=atom&amp;title=Fink%3AMajor_New_Feature_Plans%3APatchfile_Checksums</id>
	<title>Fink:Major New Feature Plans:Patchfile Checksums - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.finkproject.org/index.php?action=history&amp;feed=atom&amp;title=Fink%3AMajor_New_Feature_Plans%3APatchfile_Checksums"/>
	<link rel="alternate" type="text/html" href="https://wiki.finkproject.org/index.php?title=Fink:Major_New_Feature_Plans:Patchfile_Checksums&amp;action=history"/>
	<updated>2026-04-22T09:20:16Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.13</generator>
	<entry>
		<id>https://wiki.finkproject.org/index.php?title=Fink:Major_New_Feature_Plans:Patchfile_Checksums&amp;diff=83&amp;oldid=prev</id>
		<title>Dmacks: Reverted edit of YfyEbr, changed back to last version by Dmacks</title>
		<link rel="alternate" type="text/html" href="https://wiki.finkproject.org/index.php?title=Fink:Major_New_Feature_Plans:Patchfile_Checksums&amp;diff=83&amp;oldid=prev"/>
		<updated>2007-06-11T18:45:02Z</updated>

		<summary type="html">&lt;p&gt;Reverted edit of YfyEbr, changed back to last version by Dmacks&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Fink_Header}}&lt;br /&gt;
&lt;br /&gt;
==Current implementation==&lt;br /&gt;
===Syntax===&lt;br /&gt;
Automatic application via an implicit &amp;lt;code&amp;gt;patch -p1 &amp;lt; %a/foo.patch&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;Patch: foo.patch&amp;lt;/pre&amp;gt;&lt;br /&gt;
and/or usage in explicit scripts:&lt;br /&gt;
&amp;lt;pre&amp;gt;PatchScript: sed 'some script' &amp;lt; %a/foo.patch | patch -p1&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Problems===&lt;br /&gt;
* No detection of corrupted patchfile.&lt;br /&gt;
* No protection against CVS problems that cause a .info to use the wrong revision of a .patch.&lt;br /&gt;
* If multiple .info use a common .patch, all maintainers of the .info have to coordinate their updates.&lt;br /&gt;
* In the PatchScript/sed usage, package building does not abort if the patchfile is missing or not readable(!).&lt;br /&gt;
* [http://sourceforge.net/tracker/?group_id=17203&amp;amp;atid=367203&amp;amp;func=detail&amp;amp;aid=979713 Feature-requests tracker #979713].&lt;br /&gt;
* [http://sourceforge.net/tracker/?group_id=17203&amp;amp;atid=117203&amp;amp;func=detail&amp;amp;aid=1204001 Bugs tracker #1204001]&lt;br /&gt;
* [http://thread.gmane.org/gmane.os.macosx.fink.devel/11916 Fink-devel discussion].&lt;br /&gt;
* [http://article.gmane.org/gmane.os.apple.fink.devel/9810 Fink-devel discussion a long time ago]&lt;br /&gt;
&lt;br /&gt;
==Solution in CVS HEAD==&lt;br /&gt;
===Goals===&lt;br /&gt;
* Old fink will fail hard if it attempts to use an .info file with the new syntax if that would succeed but give an incorrect build) if a &amp;lt;code&amp;gt;BuildDepends:fink&amp;lt;/code&amp;gt; for the relevant fink version is accidentally omitted. Rather not resort to bumping to a new &amp;lt;code&amp;gt;InfoN&amp;lt;/code&amp;gt; level.&lt;br /&gt;
* Explicitly state the patchfile filename so that fink can check that it exists, is readable, and is the maintainer-expected contents.&lt;br /&gt;
* Don't need strong checksumming (patchfile is stored on same server as infofile that lists the checksum).&lt;br /&gt;
* Quicker implementation and easier adoption than [[Fink:Major New Feature Plans:XMLish Source and Patch|XMLish Source and Patch]].&lt;br /&gt;
&lt;br /&gt;
===Syntax===&lt;br /&gt;
&amp;lt;pre&amp;gt;Patchfile: foo.patch&lt;br /&gt;
PatchFile-MD5: hash-string&amp;lt;/pre&amp;gt;&lt;br /&gt;
* A new &amp;lt;code&amp;gt;%{PatchFile}&amp;lt;/code&amp;gt; would expand to the full path to the patchfile (&amp;lt;code&amp;gt;%a/foo.patch&amp;lt;/code&amp;gt; in the old syntax).&lt;br /&gt;
* The &amp;lt;code&amp;gt;%{default_script}&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;PatchScript&amp;lt;/code&amp;gt; contains the &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; command to apply it. The only change in fink behavior vs old fields is that if there was &amp;lt;code&amp;gt;Patch&amp;lt;/code&amp;gt; &amp;lt;i&amp;gt;and an explicit &amp;lt;code&amp;gt;PatchScript&amp;lt;/code&amp;gt;&amp;lt;/i&amp;gt;, will have to modify &amp;lt;code&amp;gt;PatchScript&amp;lt;/code&amp;gt; to apply the patch instead of simply converting the &amp;lt;code&amp;gt;Patch&amp;lt;/code&amp;gt; field to &amp;lt;code&amp;gt;PatchFile&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Could expand to &amp;lt;code&amp;gt;PatchFile&amp;lt;i&amp;gt;N&amp;lt;/i&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;PatchFile&amp;lt;i&amp;gt;N&amp;lt;/i&amp;gt;-MD5&amp;lt;/code&amp;gt; if we want to continue to support multiple patchfiles.&lt;br /&gt;
===Implementation===&lt;br /&gt;
* At the beginning of &amp;lt;code&amp;gt;PatchScript&amp;lt;/code&amp;gt;, fink checksums the file on disk, and abort immediately if it does not match. By always routing through the new percent-expansion token, we force this step to occur.&lt;br /&gt;
** Using %a, .info could access a file that has not been checked.&lt;br /&gt;
** Still allow %a for now so that .info would still work on older fink versions, but eventually abolish it at the same time the &amp;lt;code&amp;gt;Patch&amp;lt;/code&amp;gt; field is abolished.&lt;br /&gt;
* Also check file readability &amp;lt;i&amp;gt;as the user who will run the PatchScript&amp;lt;/i&amp;gt;.&lt;br /&gt;
* Fink always aborts when it encounters an unknown percent-expansion token, so we're protected against an old version of fink that silently mis-using a .info file with &amp;lt;code&amp;gt;%{PatchFile}&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Validator enforces a BuildDepends:fink that is versioned to require a fink that supports this new field. Not ideal, but if you're building a package whose .info doesn't validate, never any guarantees it'll work anyway.&lt;br /&gt;
===&amp;quot;But Dan, Why Not...?&amp;quot;===&lt;br /&gt;
* Can't do implicit application of the patch because that doesn't protect against mis-use by old-fink. The explicit use is easy and many packages already use explicit patch in &amp;lt;code&amp;gt;PatchScript&amp;lt;/code&amp;gt; so there isn't a big learning curve here.&lt;br /&gt;
** drm and akh feel that having validator check for BDep on a version of fink that supports this new feature is enough, so we &amp;lt;i&amp;gt;will&amp;lt;/i&amp;gt; have implicit patching available.&lt;br /&gt;
* Can't &amp;lt;i&amp;gt;just&amp;lt;/i&amp;gt; add &amp;lt;code&amp;gt;PatchFile-MD5&amp;lt;/code&amp;gt; for use vs the existing &amp;lt;code&amp;gt;Patch&amp;lt;/code&amp;gt; because that allows leakage via %a and doesn't protect against missing patchfile when used by sed/patch. Also &amp;lt;code&amp;gt;Patch&amp;lt;/code&amp;gt; can have more than one filename listed.&lt;br /&gt;
* Can't also have &amp;lt;code&amp;gt;PatchFile-MD5&amp;lt;/code&amp;gt; be used for patchfiles implemented by existing &amp;lt;code&amp;gt;PatchScript&amp;lt;/code&amp;gt; because there's no foolproof way to get the filename out of that field. Also, there could be more than one filename used by the &amp;lt;code&amp;gt;Patch&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;PatchScript&amp;lt;/code&amp;gt; fields.&lt;br /&gt;
&lt;br /&gt;
{{Fink_Header}}&lt;br /&gt;
&lt;br /&gt;
[[Category: Fink|New Feature Plans Patchfile Checksums]]&lt;br /&gt;
[[Category: Fink_Roadmap|New Feature Plans Patchfile Checksums]]&lt;br /&gt;
[[Category: Fink_Infofile_Syntax|New Feature Plans Patchfile Checksums]]&lt;/div&gt;</summary>
		<author><name>Dmacks</name></author>
	</entry>
</feed>