[rpm] - accept files as command line arguments to rpmdeps again (#807767)

Panu Matilainen pmatilai at fedoraproject.org
Thu Mar 29 08:43:21 UTC 2012


commit 99eadda6730216a419e376804803421bc0fe30f4
Author: Panu Matilainen <pmatilai at redhat.com>
Date:   Thu Mar 29 11:41:48 2012 +0300

    - accept files as command line arguments to rpmdeps again (#807767)

 rpm-4.9.90-rpmdeps-args.patch |   44 +++++++++++++++++++++++++++++++++++++++++
 rpm.spec                      |    7 +++++-
 2 files changed, 50 insertions(+), 1 deletions(-)
---
diff --git a/rpm-4.9.90-rpmdeps-args.patch b/rpm-4.9.90-rpmdeps-args.patch
new file mode 100644
index 0000000..5be354b
--- /dev/null
+++ b/rpm-4.9.90-rpmdeps-args.patch
@@ -0,0 +1,44 @@
+commit 9a2547ff49ae2fa9a4c9118e5472bba045379f3d
+Author: Panu Matilainen <pmatilai at redhat.com>
+Date:   Thu Mar 29 11:26:57 2012 +0300
+
+    Accept files as command line arguments again in rpmdeps (RhBug:807767)
+    
+    - Commit a25c3c7bac95ab7eb55f0ecf0b8793d8da341611 removed what was
+      supposedly a non-supported method of passing files as arguments
+      (instead of the normal stdin method) to rpmdeps. Turns out
+      rpmdeps is even documented to take files as cli args, and that's
+      how Fedora's %filter_setup macros are calling it...
+    - Allow files as arguments again, but in a way that doesn't cause
+      argvFoo() vs popt crash-n-burn.
+    (cherry picked from commit fe252f21b370331016a952b085465cd97837aaef)
+
+diff --git a/tools/rpmdeps.c b/tools/rpmdeps.c
+index 6b0b527..c3112eb 100644
+--- a/tools/rpmdeps.c
++++ b/tools/rpmdeps.c
+@@ -60,11 +60,19 @@ main(int argc, char *argv[])
+     if (optCon == NULL)
+ 	goto exit;
+ 
+-    while (fgets(buf, sizeof(buf), stdin) != NULL) {
+-	char *be = buf + strlen(buf) - 1;
+-	while (strchr("\r\n", *be) != NULL)
+-	    *be-- = '\0';
+-	argvAdd(&av, buf);
++    /* normally files get passed through stdin but also accept files as args */
++    if (poptPeekArg(optCon)) {
++	const char *arg;
++	while ((arg = poptGetArg(optCon)) != NULL) {
++	    argvAdd(&av, arg);
++	}
++    } else {
++	while (fgets(buf, sizeof(buf), stdin) != NULL) {
++	    char *be = buf + strlen(buf) - 1;
++	    while (strchr("\r\n", *be) != NULL)
++		*be-- = '\0';
++	    argvAdd(&av, buf);
++	}
+     }
+     /* Make sure file names are sorted. */
+     argvSort(av, NULL);
diff --git a/rpm.spec b/rpm.spec
index 54ff906..794d50a 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -22,7 +22,7 @@
 Summary: The RPM package management system
 Name: rpm
 Version: %{rpmver}
-Release: %{?snapver:0.%{snapver}.}8%{?dist}
+Release: %{?snapver:0.%{snapver}.}9%{?dist}
 Group: System Environment/Base
 Url: http://www.rpm.org/
 Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2
@@ -48,6 +48,7 @@ Patch200: rpm-4.9.90-rpmte-fileinfo.patch
 Patch201: rpm-4.9.90-rpmte-fileinfo-2.patch
 Patch202: rpm-4.9.90-keyid-size.patch
 Patch203: rpm-4.9.90-header-datalength.patch
+Patch204: rpm-4.9.90-rpmdeps-args.patch
 
 # These are not yet upstream
 Patch301: rpm-4.6.0-niagara.patch
@@ -221,6 +222,7 @@ packages on a system.
 %patch201 -p1 -b .rpmte-fileinfo-2
 %patch202 -p1 -b .keyid-size
 %patch203 -p1 -b .header-datalength
+%patch204 -p1 -b .rpmdeps-args
 
 %patch301 -p1 -b .niagara
 %patch302 -p1 -b .geode
@@ -447,6 +449,9 @@ exit 0
 %doc COPYING doc/librpm/html/*
 
 %changelog
+* Thu Mar 29 2012 Panu Matilainen <pmatilai at redhat.com> - 4.9.90-0.git11505.9
+- accept files as command line arguments to rpmdeps again (#807767)
+ 
 * Mon Mar 26 2012 Panu Matilainen <pmatilai at redhat.com> - 4.9.90-0.git11505.8
 - remove fake library provide hacks now that deltarpm got rebuilt
 


More information about the scm-commits mailing list