bug-coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] pr: ensure the page header line is of the required format


From: Eric Blake
Subject: Re: [PATCH] pr: ensure the page header line is of the required format
Date: Wed, 06 Jan 2010 21:22:00 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666

According to Jim Meyering on 1/6/2010 2:53 PM:
> Good idea.
> That is cleaner.
> Do you feel like adjusting that patch, and listing yourself as the author?
> If so, please note in the log that the bug was introduced by my
> Mar 6 2009 commit: a4053c5291d5797734b3e4f042f9e1adf3944fd6

Given that I've rewritten the original patch, it made sense to squash the
two patches into one.  Here's the end result, now pushed.

-- 
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
From 67d3e263504115144380dfaffd41c9cef3cf68a4 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Wed, 6 Jan 2010 20:57:40 -0700
Subject: [PATCH] pr: ensure the page header line is of the required format

Before this change, with too long a file name, the name would
abut the date field on the left and possibly also the "Page N"
field on the right, rather than leaving a one-space separator
in each case.  Fixes a regression introduced on Mar 6 2009,
by commit a4053c5291d5797734b3e4f042f9e1adf3944fd6

* src/pr.c (print_header): Ensure that there is at least one
space before and after the file name part of the header line.
* NEWS: Mention it.
* tests/pr/W20l24f-ll: s/xPage/ x Page/.
* THANKS: Update.
Reported by Denis McKeon, in https://savannah.gnu.org/bugs/?28492.
---
 NEWS                |    3 +++
 THANKS              |    1 +
 src/pr.c            |    8 ++++----
 tests/pr/W20l24f-ll |   18 +++++++++---------
 4 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/NEWS b/NEWS
index a22fa7a..a52f618 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,9 @@ GNU coreutils NEWS                                    -*- 
outline -*-
   symlinks when the 'LINK target' directive was given to dircolors.
   [bug introduced in fileutils-4.0]

+  pr's page header was improperly formatted for long file names.
+  [bug introduced in coreutils-7.2]
+
   rm -r --one-file-system works once again.
   The rewrite to make rm use fts introduced a regression whereby
   a commmand of the above form would fail for all subdirectories.
diff --git a/THANKS b/THANKS
index 5ed26b9..19aee6b 100644
--- a/THANKS
+++ b/THANKS
diff --git a/src/pr.c b/src/pr.c
index a1b44e3..1b08894 100644
--- a/src/pr.c
+++ b/src/pr.c
@@ -2403,10 +2403,10 @@ print_header (void)
   lhs_spaces = available_width >> 1;
   rhs_spaces = available_width - lhs_spaces;

-  printf ("\n\n%*.*s%s%*.*s%s%*.*s%s\n\n\n",
-          chars_per_margin, chars_per_margin, " ",
-          date_text, lhs_spaces, lhs_spaces, " ",
-          file_text, rhs_spaces, rhs_spaces, " ", page_text);
+  printf ("\n\n%*s%s%*s%s%*s%s\n\n\n",
+          chars_per_margin, "",
+          date_text, lhs_spaces, " ",
+          file_text, rhs_spaces, " ", page_text);

   print_a_header = false;
   output_position = 0;
diff --git a/tests/pr/W20l24f-ll b/tests/pr/W20l24f-ll
index 92d08af..ecc9a7a 100644
--- a/tests/pr/W20l24f-ll
+++ b/tests/pr/W20l24f-ll
@@ -1,6 +1,6 @@


--- Date/Time --xPage 1
+-- Date/Time -- x Page 1


 1<<<  -Test: FF's in
@@ -19,13 +19,13 @@
 14<<<  123456789 123
 

--- Date/Time --xPage 2
+-- Date/Time -- x Page 2



 

--- Date/Time --xPage 3
+-- Date/Time -- x Page 3


 15<<<  xyzxyzxyz XYZ
@@ -44,13 +44,13 @@
 28<<<  trunc
 

--- Date/Time --xPage 4
+-- Date/Time -- x Page 4



 

--- Date/Time --xPage 5
+-- Date/Time -- x Page 5


 29<<<xyzxyzxyz XYZXY
@@ -69,19 +69,19 @@
 42<<<  123456789 abc
 

--- Date/Time --xPage 6
+-- Date/Time -- x Page 6



 

--- Date/Time --xPage 7
+-- Date/Time -- x Page 7



 

--- Date/Time --xPage 8
+-- Date/Time -- x Page 8


 43<<<  xyzxyzxyz XYZ
@@ -100,7 +100,7 @@
 56<<<  123456789 abc
 

--- Date/Time --xPage 9
+-- Date/Time -- x Page 9


 57<<<  xyzxyzxyz XYZ
-- 
1.6.4.2

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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