[Rpm-maint] [rpm-software-management/rpm] Add "local_generator" (PR #2734)

Panu Matilainen notifications at github.com
Tue Feb 6 11:48:19 UTC 2024


@pmatilai commented on this pull request.



> -	    bn[strlen(bn)-strlen(".attr")] = '\0';
-	    fc->atypes[i] = rpmfcAttrNew(bn);
+	nfiles = argvCount(files);
+    }
+    char * local_attr_names = rpmExpand("%{?__local_file_attrs}", NULL);
+    ARGV_t local_attrs = argvSplitString(local_attr_names, ":", ARGV_SKIPEMPTY);
+    nlocals = argvCount(local_attrs);
+    fc->atypes = xcalloc(nfiles + nlocals + 1, sizeof(*fc->atypes));
+
+    for (int i = 0; i < nfiles; i++) {
+	char *bn = basename(files[i]);
+	bn[strlen(bn)-strlen(".attr")] = '\0';
+	// skip file attrs found in __local_file_attrs for now
+	for (j=0; (j < nlocals) && strcmp(bn, local_attrs[j]); j++);
+	if (j < nlocals) {
+	    free(bn);

This is not right, basename() doesn't allocate, so this would free some random pointer inside the one that is.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2734#pullrequestreview-1864947811
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/2734/review/1864947811 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240206/ebcf62f7/attachment.html>


More information about the Rpm-maint mailing list