On 10/25/2017 8:19 AM, Corinna Vinschen wrote:
On Oct 25 14:11, Corinna Vinschen wrote:
Hi Ken,
On Oct 25 07:23, Ken Brown wrote:
Up to now the function winsup/utils/dump_setup.cc:base skips past
colons when parsing file names. As a result, a line like
foo foo-1:2.3-4.tar.bz2 1
in /etc/setup/installed.db would cause 'cygcheck -cd foo' to report 4
as the installed version of foo insted of 1:2.3-4. This is not an
issue now, but it will become an issue when version numbers are
allowed to contain epochs.
---
winsup/utils/dump_setup.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/winsup/utils/dump_setup.cc b/winsup/utils/dump_setup.cc
index 320d69fab..3922b18f8 100644
--- a/winsup/utils/dump_setup.cc
+++ b/winsup/utils/dump_setup.cc
@@ -56,7 +56,7 @@ base (const char *s)
const char *rv = s;
while (*s)
{
- if ((*s == '/' || *s == ':' || *s == '\\') && s[1])
+ if ((*s == '/' || *s == '\\') && s[1])
I think this is a simplified way to test for the colon in paths like
C:/foo/bar. Nothing else makes sense in this context.
I'm not sure how much we care, but maybe we shoulkd fix the test to
ignore the colon only if it's the second character in the incoming
string?
Not "ignore", but "use as a delimiter" only as 2nd char in the input.
I'm not sure the distinction matters in this case, since the function is
just trying to get the base name. Anyway, how's the attached?
Ken
From 1354e67e12819519f9a5440f12ef893e4e0bf7a5 Mon Sep 17 00:00:00 2001
From: Ken Brown <kbr...@cornell.edu>
Date: Tue, 24 Oct 2017 18:21:53 -0400
Subject: [PATCH] cygcheck: Fix parsing of file names containing colons
Up to now the function winsup/utils/dump_setup.cc:base skips past
colons when parsing file names. As a result, a line like
foo foo-1:2.3-4.tar.bz2 1
in /etc/setup/installed.db would cause 'cygcheck -cd foo' to report 4
as the installed version of foo insted of 1:2.3-4. This is not an
issue now, but it will become an issue when version numbers are
allowed to contain epochs.
---
winsup/utils/dump_setup.cc | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/winsup/utils/dump_setup.cc b/winsup/utils/dump_setup.cc
index 320d69fab..d05817239 100644
--- a/winsup/utils/dump_setup.cc
+++ b/winsup/utils/dump_setup.cc
@@ -53,10 +53,12 @@ base (const char *s)
{
if (!s)
return 0;
+ if (isalpha (*s) && s[1] == ':')
+ s += 2;
const char *rv = s;
while (*s)
{
- if ((*s == '/' || *s == ':' || *s == '\\') && s[1])
+ if ((*s == '/' || *s == '\\') && s[1])
rv = s + 1;
s++;
}
--
2.14.2