coreutils
[Top][All Lists]
Advanced

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

Re: ln: make symbolic links default


From: Dmitry V. Levin
Subject: Re: ln: make symbolic links default
Date: Sat, 1 Apr 2017 05:18:03 +0300

On Sat, Apr 01, 2017 at 01:29:19AM +0200, blastmaster wrote:
> >From eb0411a1bb62afc0fff0c8671c0d51a368f5c80f Mon Sep 17 00:00:00 2001
> From: blastmaster <address@hidden>
> Date: Sat, 25 Mar 2017 01:02:53 +0100
> Subject: [PATCH 1/2] ln: make symbolic links by default:
> 
> * This commit changes the default behavior of ln.
>   Instead of creating hard links the default will now
>   create symbolic links.
>   If you still want to create hard links the -h option is provided.
> 
> * We think that it is more natural to create symbolic links instead of
>   of hardlinks. Today hardlinks are rarely used. Moreover, its much more
> economical
>   to save the writing effort of the additional parameter.

A ChangeLog-style entry is missing, see file HACKING for commit log 
requirements.

> PS: This commit will eventually break all your systems! ;)

So this has to be documented in NEWS, too! ;)

> ---
>  src/ln.c | 36 ++++++++++++++++++------------------
>  1 file changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/src/ln.c b/src/ln.c
> index 539d238c8..634c92f7c 100644
> --- a/src/ln.c
> +++ b/src/ln.c
> @@ -46,7 +46,7 @@
>  static enum backup_type backup_type;
>  
>  /* If true, make symbolic links; otherwise, make hard links.  */
> -static bool symbolic_link;
> +static bool hard_link;
>  
>  /* If true, make symbolic links relative  */
>  static bool relative;
> @@ -97,7 +97,7 @@ static struct option const long_options[] =
>    {"logical", no_argument, NULL, 'L'},
>    {"physical", no_argument, NULL, 'P'},
>    {"relative", no_argument, NULL, 'r'},
> -  {"symbolic", no_argument, NULL, 's'},
> +  {"hard", no_argument, NULL, 'h'},

You should have kept -s option for backwards compatibility. ;-)

>    {"verbose", no_argument, NULL, 'v'},
>    {GETOPT_HELP_OPTION_DECL},
>    {GETOPT_VERSION_OPTION_DECL},
> @@ -185,7 +185,7 @@ do_link (const char *source, const char *dest)
>    bool dest_lstat_ok = false;
>    bool source_is_dir = false;
>  
> -  if (!symbolic_link)
> +  if (hard_link)
>      {
>         /* Which stat to use depends on whether linkat will follow the
>            symlink.  We can't use the shorter
> @@ -244,15 +244,15 @@ do_link (const char *source, const char *dest)
>            code would give a misleading "file not found" diagnostic.
>            This case is different than the others handled here, since
>            the command in question doesn't use --force.  */
> -       || (!symbolic_link && backup_type != no_backups))
> +       || (hard_link && backup_type != no_backups))
>        && dest_lstat_ok
>        /* Allow 'ln -sf --backup k k' to succeed in creating the
>           self-referential symlink, but don't allow the hard-linking
>           equivalent: 'ln -f k k' (with or without --backup) to get
>           beyond this point, because the error message you'd get is
>           misleading.  */

You change makes this comment misleading, please update it, too! :-)


-- 
ldv



reply via email to

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