bug-fileutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[fileutils-4.0.43 - ls] 'ls a b' when a doesn't exist and isdir(b)


From: Stephane CHAZELAS
Subject: [fileutils-4.0.43 - ls] 'ls a b' when a doesn't exist and isdir(b)
Date: Wed, 18 Apr 2001 22:18:55 +0200
User-agent: Mutt/1.3.14i

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]