On Sat, 04 Jul 2020 20:59:08 +0200, Richard Ipsum wrote: > Output of ls -R between OpenBSD and GNU coreutils seems to differ, > OpenBSD ls -R will apparently list "hidden" directories like .git, > whereas GNU coreutils will not, is this expected behaviour or a bug?
I think this is actually a bug. Historic behavior is to not descend into directories that begin with a '.'. Our existing ls code looks like it is written to support that behavior but is missing one thing. - todd Index: bin/ls/ls.c =================================================================== RCS file: /cvs/src/bin/ls/ls.c,v retrieving revision 1.51 diff -u -p -u -r1.51 ls.c --- bin/ls/ls.c 13 Sep 2018 15:23:32 -0000 1.51 +++ bin/ls/ls.c 4 Jul 2020 20:13:39 -0000 @@ -369,8 +369,11 @@ traverse(int argc, char *argv[], int opt switch (p->fts_info) { case FTS_D: if (p->fts_name[0] == '.' && - p->fts_level != FTS_ROOTLEVEL && !f_listdot) + p->fts_level != FTS_ROOTLEVEL && !f_listdot) { + if (fts_set(ftsp, p, FTS_SKIP)) + err(1, "%s", p->fts_path); break; + } /* * If already output something, put out a newline as