summaryrefslogtreecommitdiffstats
path: root/apt-pkg/deb/deblistparser.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 02:48:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 02:48:10 +0000
commit7f9ceaec776a597e9ff8451038d57dd75e1e6d18 (patch)
tree284aa831d7c1c097a28b9048e594e071efa8e65c /apt-pkg/deb/deblistparser.cc
parentReleasing progress-linux version 2.9.3-0.0~progress7.99u1. (diff)
downloadapt-7f9ceaec776a597e9ff8451038d57dd75e1e6d18.tar.xz
apt-7f9ceaec776a597e9ff8451038d57dd75e1e6d18.zip
Merging upstream version 2.9.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--apt-pkg/deb/deblistparser.cc85
1 files changed, 41 insertions, 44 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 9177d54..13e8fd0 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -635,63 +635,60 @@ const char *debListParser::ParseDepends(const char *Start, const char *Stop,
// Skip whitespace
for (;I != Stop && isspace_ascii(*I) != 0; I++);
- if (unlikely(ParseArchFlags == true))
+ // Parse architecture restrictions
+ if (ParseArchFlags && I != Stop && *I == '[')
{
+ for (++I; I != Stop && isspace_ascii(*I) != 0 && *I != ']'; ++I);
+ // malformed
+ if (unlikely(I == Stop || *I == ']'))
+ return 0;
+
APT::CacheFilter::PackageArchitectureMatchesSpecification matchesArch(Arch, false);
- // Parse an architecture
- if (I != Stop && *I == '[')
+ bool Found = false;
+ bool NegArch = false;
+ while (I < Stop && *I != ']')
{
- ++I;
- // malformed
- if (unlikely(I == Stop))
- return 0;
-
+ // look for whitespace or ending ']' to end current Arch
const char *End = I;
- bool Found = false;
- bool NegArch = false;
- while (I != Stop)
- {
- // look for whitespace or ending ']'
- for (;End != Stop && !isspace_ascii(*End) && *End != ']'; ++End);
-
- if (unlikely(End == Stop))
- return 0;
-
- if (*I == '!')
- {
- NegArch = true;
- ++I;
- }
-
- std::string const arch(I, End);
- if (arch.empty() == false && matchesArch(arch.c_str()) == true)
- {
- Found = true;
- if (I[-1] != '!')
- NegArch = false;
- // we found a match, so fast-forward to the end of the wildcards
- for (; End != Stop && *End != ']'; ++End);
- }
+ for (;End < Stop && isspace_ascii(*End) == 0 && *End != ']'; ++End);
- if (*End++ == ']') {
- I = End;
- break;
- }
+ if (unlikely(End >= Stop))
+ return 0;
- I = End;
- for (;I != Stop && isspace_ascii(*I) != 0; I++);
+ bool CurNegArch = false;
+ if (*I == '!')
+ {
+ NegArch = true;
+ CurNegArch = true;
+ ++I;
}
- if (NegArch == true)
- Found = !Found;
+ if (I >= End)
+ return 0;
+ std::string const arch(I, End);
+ if (matchesArch(arch.c_str()))
+ {
+ Found = true;
+ if (not CurNegArch)
+ NegArch = false;
+ // we found a match, so fast-forward to the end of the wildcards
+ for (; End < Stop && *End != ']'; ++End);
+ }
+ else
+ for (; End < Stop && isspace_ascii(*End) != 0; ++End);
- if (Found == false)
- Package = ""; /* not for this arch */
+ I = End;
}
+ if (NegArch == true)
+ Found = not Found;
+
+ if (Found == false)
+ Package = ""; /* not for this arch */
+
// Skip whitespace
- for (;I != Stop && isspace_ascii(*I) != 0; I++);
+ for (++I; I < Stop && isspace_ascii(*I) != 0; ++I);
}
if (unlikely(ParseRestrictionsList == true))