-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Structured patches #39392
Comments
To sum up this quick brain dump, I do not think it makes much sense for anything other than CVEs tracking. The structure would be useful for automatically checking if patches have info maintainers will need but policy will need to be prepared first. Regarding the syntax, the following is quite nice: {
patches = [
(fetchurl {
meta = {
description = "darwin linker arguments";
bug = https://bugzilla.gnome.org/show_bug.cgi?id=794326;
};
url = https://bugzilla.gnome.org/attachment.cgi?id=369680;
sha256 = "11v8fhpsbapa04ifb2268cga398vfk1nq8i628441632zjz1diwg";
})
]; The Example policy:
Issues:
|
Also please document does we use patch URLs:
I see this can be relevant for overrides, and also for Nix-related patches. P.S.I know that no one ever tracks changes/updates to patches. And old patches probably cause some percentage of problems in packages. |
I check the validity of patches for each package I update.
Ideally, most of the patches would be sent upstream, so on update, we would just remove the patches. I do not see an excuse for generally usable patches to remain downstream. The only place where patch updating might make sense are terrible downstreams like Handbrake. |
The OpenEmbedded project has a fairly nice policy on documenting the reasons of patches in the commit message of the patch: https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines#Patch_Header_Recommendations:_Upstream-Status. I suppose we could follow that. I believe Vulnix already does CVE tracking of patches by scanning for CVE-20xx-12345 strings in the patch filename. I don't think that is documented though. |
|
@dezgeg It's documented in the vulnix-whitelist manpage: https://github.com/flyingcircusio/vulnix/blob/master/doc/vulnix-whitelist.5.md#automated-patch-whitelisting |
But it's not documented in Nixpkgs I mean, or is it? |
No, as it is specific to vulnix right now and not official policy. I'd be glad if it became such one, though. |
There has been a similar discussion in #15660 (but without getting to a conclusion; issue still open) |
I think that we should migrate patches, and standardize on special function that automates the logic. The main idea:Is to direct people to use special function that requires by itself to provide:
Optional:
Patches for stalled projectsFrom my experience of cleaning-up patches for HandBrake, it had a bundle of patches for dependencies that are old stalled projects. And some of that patches where very legitimate, so it is sane to apply them to those old projects forever. So, for
So, result is something like this: # For patches that should hit upstream/be resolved in the future
tmpPatch {
description = "Fixes this";
until = "Until this happens";
from-thread = "https://patchnet.com/lets-fix-this";
url = "https://patchnet.com/this_is_solved.patch";
sha256 = "sha256";
}
# For patches that cover CVEs
cvePatch {
cve = "CVE-555";
until = "Until this happens"; <- optional
url = "https://patchnet.com/cve-555.patch";
sha256 = "sha256";
}
# If we patch old project that still used today (like `ffmpeg 0.10` used by `spotify`, `a52dec` used by `handbrake`...).
permanentPatch {
description = "Fixes this";
file = "./patch-good-old-project.patch";
from-thread = "https://fidonet.ozzmosis.com/echomail.php/c_plusplus/25ff8d7f8ff9ff50.html";
} Since specific patches have according specific functions, that automagically requires to provide according form and information. The review process and maintenance of patches become easy, and we can do drive-by maintenance of patches. To migrate we can use placeholder values and set all patches as |
It would perhaps be a good idea to convert this one into a "real" RFC in https://github.com/NixOS/rfcs |
For me that some people are not describing what patches are about - is very ignorant behavior.
|
I really like this idea and wholeheartedly support it. It would be great if someone could find the time and enthusiasm to create an RFC suggesting this change to the |
This comment was marked as outdated.
This comment was marked as outdated.
Quote: The ability of NixOS/Nix/Nixpkgs to be the best security distribution around depends on the existence of the structured patches. Since CVEs are always fixed first in the form of a patch application, before upstream fixes it & makes a release with the fix. If there is no automation to apply a patch, no way to in the standard way to supply all required information to demark it what it is for, no way to scan for what patches are to be applied & what CVE patches are no longer needed, since package got a release. That is possible only with a structured patches approach. IDK of recent processes in Nixpkgs, but if structured patches got implemented & are enforced - that would transform the situation, Nixpkgs would become one of the most secure distribution software stores by design. |
I had this idea for improvement to "patches" attribute. Basically, I think it could be useful to store some meta information on patches. For instance,
Does this seem useful? It would make life easier for maintainers I think.
The text was updated successfully, but these errors were encountered: