Date: Thu, 12 Jan 2017 14:31:20 +0100 From: Julien Ramseier <j.ramseier@...il.com> To: musl@...ts.openwall.com Subject: About GLOB_PERIOD behavior The GNU glob(3) GLOB_PERIOD extension seems to be broken in both glibc and musl. glibc documents GLOB_PERIOD as "leading dots can be matched by metachars". However in its current implementation, GLOB_PERIOD is only applied to the last path component. Given the following file tree: usr/.dir/.file usr/bin/.file glob("*/*/*", GLOB_PERIOD) will only match: usr/bin/. usr/bin/.. usr/bin/.file I don't know if this is intended... It's also questionable whether GLOB_PERIOD should allow the special dot dirs '.' and '..' to be matched. In musl, GLOB_PERIOD affects each path component. But when '.' or '..' are matched and the end of the pattern is not yet reached, it will start recursing into these and produce totally wrong results. (Use the attached test script if it's unclear). I think we should either: - patch musl to behave like glibc - remove GLOB_PERIOD altogether OpenBSD, FreeBSD and MacOSX don't implement GLOB_PERIOD. NetBSD does but in the same broken way as musl, and also adds a GLOB_NO_DOTDIRS extension to exclude '.' and '..' Download attachment "t_glob.sh" of type "application/octet-stream" (458 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.