[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] du: don't count duplicate arguments. Closes 5288
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2019-02-19 16:10:29
Message-ID: CAK1hOcNaVCFmNRXq0ChoHcCSjU3DR_-MvB_siXs1qJRQiw09pQ () mail ! gmail ! com
[Download RAW message or body]

Applied, thanks!

On Sat, Feb 16, 2019 at 11:22 AM Ron Yorston <rmy@pobox.com> wrote:
>
> Since coreutils 8.6 (2010-10-15) du no longer counts duplicate arguments.
>
> Revert the relevant part of commit 618a3027ed (du: fix "du /dir /dir"
> case).
>
> function                                             old     new   delta
> du_main                                              302     297      -5
> reset_ino_dev_hashtable                               78       -     -78
> ------------------------------------------------------------------------------
> (add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-83)             Total: -83 bytes
>
> Signed-off-by: Ron Yorston <rmy@pobox.com>
> ---
>  coreutils/du.c     | 4 ++--
>  libbb/inode_hash.c | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/coreutils/du.c b/coreutils/du.c
> index 6d737fbfb..d14d9e4ea 100644
> --- a/coreutils/du.c
> +++ b/coreutils/du.c
> @@ -290,11 +290,11 @@ int du_main(int argc UNUSED_PARAM, char **argv)
>         total = 0;
>         do {
>                 total += du(*argv);
> -               /* otherwise du /dir /dir won't show /dir twice: */
> -               reset_ino_dev_hashtable();
>                 G.slink_depth = slink_depth_save;
>         } while (*++argv);
>
> +       if (ENABLE_FEATURE_CLEAN_UP)
> +               reset_ino_dev_hashtable();
>         if (opt & OPT_c_total)
>                 print(total, "total");
>
> diff --git a/libbb/inode_hash.c b/libbb/inode_hash.c
> index 4142813e3..a125244ca 100644
> --- a/libbb/inode_hash.c
> +++ b/libbb/inode_hash.c
> @@ -77,7 +77,7 @@ void FAST_FUNC add_to_ino_dev_hashtable(const struct stat *statbuf, const char *
>         ino_dev_hashtable[i] = bucket;
>  }
>
> -#if ENABLE_DU || ENABLE_FEATURE_CLEAN_UP
> +#if ENABLE_FEATURE_CLEAN_UP
>  /* Clear statbuf hash table */
>  void FAST_FUNC reset_ino_dev_hashtable(void)
>  {
> --
> 2.20.1
>
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic