Hola Jim Meyering!

El 19/11/2011 a las 17:11 escribiste:
> Thanks for the report.

Thanks for replying.

> I agree that the current behavior is undesirable.

> How could we change it? (--link (-l) is not specified by POSIX, so we may)
>     - make -i -l imply --force or --remove-destination when the user
>     responds with "y" (or equivalent) to the interactive prompt

This one seems quite reasonable. So I've prepared a patch for this behaviour.

> However, this behavior has been with us for nearly two decades.
> Is it really worth changing now?

I think this is still a bug, and it deserves to be squashed. :)

> Unless someone steps forward to work on this,
> I suggest we simply close the issue as "not a big deal",
> given that there are plenty of ways to work around the problem.

The patch for the option proposed before is quite simple:

diff -urNad coreutils-8.13~/src/copy.c coreutils-8.13/src/copy.c
--- coreutils-8.13~/src/copy.c  2011-07-28 07:38:27.000000000 -0300
+++ coreutils-8.13/src/copy.c   2011-11-23 22:27:00.988808636 -0300
@@ -2313,7 +2313,7 @@
            && !(LINK_FOLLOWS_SYMLINKS && S_ISLNK (src_mode)
                 && x->dereference == DEREF_NEVER))
     {
-      if (! create_hard_link (src_name, dst_name, false, false))
+      if (! create_hard_link (src_name, dst_name, (x->interactive == 
I_ASK_USER), false))
         goto un_backup;
     }
   else if (S_ISREG (src_mode)

It sets the replace parameter of create_hard_link, using the fact that if the
x->interactive == I_ASK_USER option is set, then the only way to reach this
point is by answering yes.

-- 
"Inside every large problem is a small problem struggling to get out."
-- Hoare's Law of Large Problems
Saludos /\/\ /\ >< `/
diff -urNad coreutils-8.13~/src/copy.c coreutils-8.13/src/copy.c
--- coreutils-8.13~/src/copy.c  2011-07-28 07:38:27.000000000 -0300
+++ coreutils-8.13/src/copy.c   2011-11-23 22:27:00.988808636 -0300
@@ -2313,7 +2313,7 @@
            && !(LINK_FOLLOWS_SYMLINKS && S_ISLNK (src_mode)
                 && x->dereference == DEREF_NEVER))
     {
-      if (! create_hard_link (src_name, dst_name, false, false))
+      if (! create_hard_link (src_name, dst_name, (x->interactive == 
I_ASK_USER), false))
         goto un_backup;
     }
   else if (S_ISREG (src_mode)

Attachment: signature.asc
Description: Digital signature

Reply via email to