Subject: Re: bug#6769: df (GNU coreutils) 7.4 Dutch output misalignment

From: Jim Meyering <[email-masked]>
Date: Wed, 23 Mar 2011 11:48:47 +0100

Pádraig Brady wrote:
> On 22/03/11 14:06, Pádraig Brady wrote:
>> On 01/08/10 01:30, Erik Quaeghebeur wrote:
>>> Dear df-maintainer,
>>>
>>> I observed a misalignment of the output of df (GNU coreutils) 7.4 in a
>>> Dutch locale: from the second column onward, the column header in the
>>> first row is too far to the right (by six spaces, in the cases I
>>> investigated).
>>
>> Here's a proposed fix for all these alignment issues.
>> A good command to compare before and after is:
>>
>>   df --all -T -P -B\'1

I like it.

> Here's the lastest version with a few inconsequential tweaks,
> and a NEWS entry
>
> http://www.pixelbeat.org/patches/df-align.diff

Thanks.
I've tried to compile with that, and saw some new warnings (using F14's gcc
4.5.1 20100924).  Fixing them, I also removed some stray spaces in "table [...":

diff --git a/src/df.c b/src/df.c
index 7c67620..df31611 100644
--- a/src/df.c
+++ b/src/df.c
@@ -254,11 +254,11 @@ get_header (void)
     {
       if (field == TYPE_FIELD && !print_type)
         {
-          table [nrows-1][field] = NULL;
+          table[nrows-1][field] = NULL;
           continue;
         }

-      char *header = _(headers[field][header_mode]);
+      char const *header = _(headers[field][header_mode]);
       if (!header)
         header = _(headers[field][DEFAULT_MODE]);

@@ -318,7 +318,7 @@ get_header (void)
       if (!header)
         xalloc_die ();

-      table [nrows-1][field] = header;
+      table[nrows-1][field] = (char *) header;

       widths[field] = MAX (widths[field], mbswidth (header, 0));
     }

Having a test that exhibits the change in behavior would
be nice, but is probably not worth the trouble.