On 07/09/2018 05:23 PM, Jim Meyering wrote: > On Mon, Jul 9, 2018 at 5:57 AM, Bernhard Voelker > <[email protected]> wrote: >> On 07/08/2018 06:19 AM, Jim Meyering wrote: >>> On Sat, Jul 7, 2018 at 4:13 PM, Bernhard Voelker >>> <[email protected]> wrote: >>>> - static char buf[10]; >>>> + static char buf[14]; >>> >>> Or maybe this, since you already use the intprops module, just add >>> this somewhere prior: #include "intprops.h" >>> >>> static char buf[1 + INT_BUFSIZE_BOUND (info) + 1]; >> >> Even better, thanks! >> I wrapped that into the attached patch in your name ... pushing soon. > > Thanks. Actually, we must not rely on it being already available due > to a transitive dependency. > Instead, I suggest to make the dependency on this gnulib module > explicit by adding its name to bootstrap.conf:
Good point. This adds up to the attached. Is there an automated check to avoid such transitive deps? Thanks & have a nice day, Berny
>From 0b88a80e9d619f42b4e1494a2e14882b1c81640b Mon Sep 17 00:00:00 2001 From: Jim Meyering <[email protected]> Date: Mon, 9 Jul 2018 17:47:53 +0200 Subject: [PATCH] maint: use gnulib's intprops module to avoid magic numbers * bootstrap.conf (gnulib_modules): Add intprops. * find/ftsfind.c (get_fts_info_name): Use the INT_BUFSIZE_BOUND macro to calculate the size of BUF. --- bootstrap.conf | 1 + find/ftsfind.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bootstrap.conf b/bootstrap.conf index cfa839a1..099b9311 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -114,6 +114,7 @@ gnulib_modules=" human idcache inline + intprops inttypes isblank locale diff --git a/find/ftsfind.c b/find/ftsfind.c index 57804950..39fdfbff 100644 --- a/find/ftsfind.c +++ b/find/ftsfind.c @@ -42,6 +42,7 @@ #include "closeout.h" #include "error.h" #include "fts_.h" +#include "intprops.h" #include "progname.h" #include "quotearg.h" #include "save-cwd.h" @@ -143,7 +144,7 @@ static void init_mounted_dev_list (void); static const char * get_fts_info_name (int info) { - static char buf[14]; + static char buf[1 + INT_BUFSIZE_BOUND (info) + 1]; switch (info) { HANDLECASE(FTS_D); -- 2.18.0
