public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Lubos Kardos <lkardos@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/rpm] pmatilai-v6: - Enable braces expansion in rpmGlob()
Date: Mon, 23 Nov 2026 09:29:29 GMT	[thread overview]
Message-ID: <179542616979.1.9083088735092471239.rpms-rpm-ee316a0bf8ef@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/rpm
            Branch : pmatilai-v6
            Commit : ee316a0bf8ef741ce197ef77ba2cf19cc51a37fd
            Author : Lubos Kardos <lkardos@redhat.com>
            Date   : 2015-07-27T13:56:58+02:00
            Stats  : +128/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/rpm/c/ee316a0bf8ef741ce197ef77ba2cf19cc51a37fd?branch=pmatilai-v6

            Log:
            - Enable braces expansion in rpmGlob()
- Resolves: 1246743

---
diff --git a/rpm-4.12.90-braces-expansion.patch b/rpm-4.12.90-braces-expansion.patch
new file mode 100644
index 0000000..03198ba
--- /dev/null
+++ b/rpm-4.12.90-braces-expansion.patch
@@ -0,0 +1,123 @@
+From d14ecfe587efbe80e5534161dbd3a4f7158b4e2b Mon Sep 17 00:00:00 2001
+From: Lubos Kardos <lkardos@redhat.com>
+Date: Mon, 27 Jul 2015 11:22:19 +0200
+Subject: [PATCH] Enable {} expansion in rpmGlob() (rhbz:1246743)
+
+---
+ rpmio/rpmglob.c | 42 ++++++++++++++++++++++++++++++++----------
+ 1 file changed, 32 insertions(+), 10 deletions(-)
+
+diff --git a/rpmio/rpmglob.c b/rpmio/rpmglob.c
+index 4fc106d..597ac5c 100644
+--- a/rpmio/rpmglob.c
++++ b/rpmio/rpmglob.c
+@@ -150,7 +150,7 @@ static inline const char *next_brace_sub(const char *begin)
+     return cp;
+ }
+ 
+-static int __glob_pattern_p(const char *pattern, int quote);
++static int __glob_pattern_p(const char *pattern, int flags);
+ 
+ /* Do glob searching for PATTERN, placing results in PGLOB.
+    The bits defined above may be set in FLAGS.
+@@ -419,7 +419,7 @@ glob(const char *pattern, int flags,
+ 	return GLOB_NOMATCH;
+     }
+ 
+-    if (__glob_pattern_p(dirname, !(flags & GLOB_NOESCAPE))) {
++    if (__glob_pattern_p(dirname, flags)) {
+ 	/* The directory name contains metacharacters, so we
+ 	   have to glob for the directory, and then glob for
+ 	   the pattern in each directory found.  */
+@@ -646,10 +646,11 @@ static int prefix_array(const char *dirname, char **array, size_t n)
+ 
+ /* Return nonzero if PATTERN contains any metacharacters.
+    Metacharacters can be quoted with backslashes if QUOTE is nonzero.  */
+-static int __glob_pattern_p(const char *pattern, int quote)
++static int __glob_pattern_p(const char *pattern, int flags)
+ {
+     register const char *p;
+-    int open = 0;
++    int openBrackets = 0;
++    int openBraces = 0;
+ 
+     for (p = pattern; *p != '\0'; ++p)
+ 	switch (*p) {
+@@ -658,18 +659,29 @@ static int __glob_pattern_p(const char *pattern, int quote)
+ 	    return 1;
+ 
+ 	case '\\':
+-	    if (quote && p[1] != '\0')
++	    if (!(flags & GLOB_NOESCAPE) && p[1] != '\0')
+ 		++p;
+ 	    break;
+ 
+ 	case '[':
+-	    open = 1;
++	    openBrackets = 1;
+ 	    break;
+ 
+ 	case ']':
+-	    if (open)
++	    if (openBrackets)
+ 		return 1;
+ 	    break;
++
++	case '{':
++	    if (flags & GLOB_BRACE)
++		openBraces = 1;
++	    break;
++
++	case '}':
++	    if (openBraces)
++		return 1;
++	    break;
++
+ 	}
+ 
+     return 0;
+@@ -694,7 +706,7 @@ glob_in_dir(const char *pattern, const char *directory, int flags,
+     int meta;
+     int save;
+ 
+-    meta = __glob_pattern_p(pattern, !(flags & GLOB_NOESCAPE));
++    meta = __glob_pattern_p(pattern, flags);
+     if (meta == 0) {
+ 	if (flags & (GLOB_NOCHECK | GLOB_NOMAGIC))
+ 	    /* We need not do any tests.  The PATTERN contains no meta
+@@ -844,6 +856,8 @@ int rpmGlob(const char * patterns, int * argcPtr, ARGV_t * argvPtr)
+     int i, j;
+     int rc;
+ 
++    gflags |= GLOB_BRACE;
++
+     if (home != NULL && strlen(home) > 0) 
+ 	gflags |= GLOB_TILDE;
+ 
+@@ -874,7 +888,9 @@ int rpmGlob(const char * patterns, int * argcPtr, ARGV_t * argvPtr)
+ 	int dir_only = (plen > 0 && path[plen-1] == '/');
+ 	glob_t gl;
+ 
+-	if (!local || (!rpmIsGlob(av[j], 0) && strchr(path, '~') == NULL)) {
++	if (!local || (!rpmIsGlob(av[j], GLOB_NOESCAPE | flags) &&
++	    strchr(path, '~') == NULL)) {
++
+ 	    argvAdd(&argv, av[j]);
+ 	    continue;
+ 	}
+@@ -966,5 +982,11 @@ exit:
+ 
+ int rpmIsGlob(const char * pattern, int quote)
+ {
+-    return __glob_pattern_p(pattern, quote);
++    int flags = 0;
++    if (!quote) {
++	flags |= GLOB_NOESCAPE;
++    }
++    flags |= GLOB_BRACE;
++
++    return __glob_pattern_p(pattern, flags);
+ }
+-- 
+1.9.3
+

diff --git a/rpm.spec b/rpm.spec
index 4bca3ab..d39ea44 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -27,7 +27,7 @@
 Summary: The RPM package management system
 Name: rpm
 Version: %{rpmver}
-Release: %{?snapver:0.%{snapver}.}1%{?dist}
+Release: %{?snapver:0.%{snapver}.}2%{?dist}
 Group: System Environment/Base
 Url: http://www.rpm.org/
 Source0: http://rpm.org/releases/rpm-4.12.x/%{name}-%{srcver}.tar.bz2
@@ -50,6 +50,7 @@ Patch4: rpm-4.8.1-use-gpg2.patch
 Patch5: rpm-4.12.0-rpm2cpio-hack.patch
 
 # Patches already upstream:
+Patch100: rpm-4.12.90-braces-expansion.patch
 
 # These are not yet upstream
 Patch302: rpm-4.7.1-geode-i686.patch
@@ -534,6 +535,9 @@ exit 0
 %doc doc/librpm/html/*
 
 %changelog
+* Mon Jul 27 2015 Lubos Kardos <lkardos@redhat.com> - 4.12.90-2
+- Enable braces expansion in rpmGlob() (#1246743)
+
 * Fri Jul 24 2015 Florian Festi <ffesti@rpm.org> - 4.12.90-1
 - Update to upstream alpha release
 

                 reply	other threads:[~2026-11-23  9:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179542616979.1.9083088735092471239.rpms-rpm-ee316a0bf8ef@fedoraproject.org \
    --to=lkardos@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox