Hello, the commands below reveal an incorrect behavior of GNU ls:
$ mkdir -p b/c
$ ls a b
ls: a: No such file or directory
c

Other flavors of the ls utility would have answered:
ls: a: No such file or directory
b:
c

as one would expect.

Here is a simple patch that should fix it:
--- ls.c~       Wed Apr 18 21:27:52 2001
+++ ls.c        Wed Apr 18 21:27:46 2001
@@ -867,7 +867,6 @@
 
   exit_status = 0;
   dir_defaulted = 1;
-  print_dir_name = 1;
   pending_dirs = 0;
 
   i = decode_switches (argc, argv);
@@ -902,7 +901,14 @@
   clear_files ();
 
   if (i < argc)
-    dir_defaulted = 0;
+    {
+      dir_defaulted = 0;
+      if (argc - i > 1)
+       print_dir_name = 1;
+      else
+       print_dir_name=0;
+    }
+
   for (; i < argc; i++)
     {
       gobble_file (argv[i], unknown, 1, "");
@@ -929,8 +935,6 @@
       if (pending_dirs)
        DIRED_PUTCHAR ('\n');
     }
-  else if (pending_dirs && pending_dirs->next == 0)
-    print_dir_name = 0;
 
   while (pending_dirs)
     {


Cheers,
Stéphane

_______________________________________________
Bug-fileutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-fileutils

Reply via email to