From 183714f3f73923db137d62a9d4fb7b65e404d4e4 Mon Sep 17 00:00:00 2001 From: Xin LI Date: Mon, 8 Jun 2015 19:13:04 +0000 Subject: [PATCH] It has been long time that when doing 'ls -G /path/to/a/symlink', instead of using the color of symbolic link, the color is determined by the link target. This behavior was quite confusing. Looking at the file history, it looks like that r203665 intends to fix this but the issue was never actually fixed. Fix this by not setting FTS_COMFOLLOW when color is requested like what was done in r203665. MFC after: 2 weeks --- bin/ls/ls.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/ls/ls.c b/bin/ls/ls.c index a46f358bd0c6..74276c1448ff 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -413,9 +413,14 @@ main(int argc, char *argv[]) /* * If not -F, -P, -d or -l options, follow any symbolic links listed on - * the command line. + * the command line, unless in color mode in which case we need to + * distinguish file type for a symbolic link itself and its target. */ - if (!f_nofollow && !f_longform && !f_listdir && (!f_type || f_slash)) + if (!f_nofollow && !f_longform && !f_listdir && (!f_type || f_slash) +#ifdef COLORLS + && !f_color +#endif + ) fts_options |= FTS_COMFOLLOW; /*