summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichal Domonkos <mdomonko@redhat.com>2022-05-23 14:37:54 +0200
committerPanu Matilainen <pmatilai@redhat.com>2022-06-27 08:42:36 +0300
commit9e541c6a7da076bc1c1beb1ee45fd5fdd735358c (patch)
tree87ce224c6934a8c7961ef2adf2c9857ddc52be05 /include
parent321933f060896f721e361a1c8a8d3731bdcee827 (diff)
downloadrpm-9e541c6a7da076bc1c1beb1ee45fd5fdd735358c.tar.gz
Fix rpmGlob() escape support
We currently accept a space-separated list of patterns here so any backslash, whether it belongs to a space char or not, gets consumed by poptParseArgvString() before the string is passed to glob(3), requiring callers to double-escape anything they wish to keep literal. Fix that by only accepting one pattern. Adapt the one caller which relies on this actually being a list, in rpmReadPackageManifest(), and those callers where we preserve spaces by escaping them which is no longer needed. Replace our own heuristic emulating GLOB_NOMAGIC with the actual flag to glob(3) so that literal (double) backslashes are also handled properly. Keep the indentation of the original for loop to make the diff easier to read, next commit will fix that. No immediate effect within RPM since we currently avoid passing escaped patterns to rpmGlob(), this is just a prerequisite for the following commits. External users of rpmGlob(), as unlikely as they are, might, in theory, notice this subtle change but we'll be bumping the soname in 4.19 so that's covered.
Diffstat (limited to 'include')
-rw-r--r--include/rpm/rpmfileutil.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/rpm/rpmfileutil.h b/include/rpm/rpmfileutil.h
index 215db129c..31420e174 100644
--- a/include/rpm/rpmfileutil.h
+++ b/include/rpm/rpmfileutil.h
@@ -117,12 +117,12 @@ int rpmIsGlob(const char * pattern, int quote);
/** \ingroup rpmfileutil
* Return URL path(s) from a (URL prefixed) pattern glob.
- * @param patterns glob pattern
+ * @param pattern glob pattern
* @param[out] *argcPtr no. of paths
* @param[out] *argvPtr ARGV_t array of paths
* @return 0 on success
*/
-int rpmGlob(const char * patterns, int * argcPtr, ARGV_t * argvPtr);
+int rpmGlob(const char * pattern, int * argcPtr, ARGV_t * argvPtr);
/** \ingroup rpmfileutil
* Escape isspace(3) characters in string.