When dirent.d_type support is added to /proc/registry (see attachment),
find 4.4.0-3 crashes on keys with duplicate names.
Testcases:
$ find-with-d_type \
/proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/ALG/ISV
$ find-with-d_type \
/proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/ControlSet001/Services/Eventlog/Security
These keys contain a key and a value with the same name and readdir()
returns both (with different d_type).
Possible fix to avoid identical names:
1. Put keys and values in different namespaces, e.g.
/proc/registry/path/name.key
/proc/registry/path/name.val
Drawback: Breaks backward compatibility.
or:
2. In readdir(), record the key names in some set<> or hash-table. If
(and only if) a duplicate name is detected, return a modified name for
the value:
/proc/registry/path/name
/proc/registry/path/name%76 ('v')
Drawback: Slows down readdir, introduces alias name for value.
Christian
diff --git a/winsup/cygwin/fhandler_registry.cc b/winsup/cygwin/fhandler_registry.cc
index ce4335f..1690427 100644
--- a/winsup/cygwin/fhandler_registry.cc
+++ b/winsup/cygwin/fhandler_registry.cc
@@ -432,7 +432,13 @@ retry:
dir->__d_position++;
if (dir->__d_position & REG_ENUM_VALUES_MASK)
- dir->__d_position += 0x10000;
+ {
+ dir->__d_position += 0x10000;
+ de->d_type = DT_REG;
+ }
+ else
+ de->d_type = DT_DIR;
+
res = 0;
out:
syscall_printf ("%d = readdir (%p, %p)", res, dir, de);
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/