Subject: bug#13080: closed (Re: bug#13080: [PATHC] improve error reporting)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 05 Dec 2012 01:58:02 +0000

Your bug report

#13080: [PATHC] improve error reporting

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
13080: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13080
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#13080: [PATHC] improve error reporting
From: Pádraig Brady <[email-masked]>
To: Alexandru Cojocaru <[email-masked]>
Cc: [email-masked]
Date: Wed, 05 Dec 2012 01:57:22 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

On 12/04/2012 03:32 PM, Alexandru Cojocaru wrote:
>>>From 8ecd92b3c11abc5cde184f0c511cd469190511af Mon Sep 17 00:00:00 2001
> From: Cojocaru Alexandru <[email-masked]>
> Date: Tue, 4 Dec 2012 16:08:42 +0100
> Subject: [PATCH] cut: improve error reporting
>
> * src/cut.c (main): Report error on `-d '' -b1'
>
> * src/cut.c (set_fields): Change the error message when
> the given list is invalid.
> ---
>   src/cut.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/cut.c b/src/cut.c
> index 4219d24..d55da51 100644
> --- a/src/cut.c
> +++ b/src/cut.c
> @@ -365,7 +365,7 @@ set_fields (const char *fieldstr)
>             in_digits = false;
>             /* Starting a range. */
>             if (dash_found)
> -            FATAL_ERROR (_("invalid byte or field list"));
> +            FATAL_ERROR (_("invalid byte, character or field list"));
>             dash_found = true;
>             fieldstr++;
>
> @@ -491,7 +491,7 @@ set_fields (const char *fieldstr)
>             fieldstr++;
>           }
>         else
> -        FATAL_ERROR (_("invalid byte or field list"));
> +        FATAL_ERROR (_("invalid byte, character or field list"));
>       }
>
>     max_range_endpoint = 0;

The above is fine.

> @@ -781,7 +781,7 @@ main (int argc, char **argv)
>     /* By default, all non-delimited lines are printed.  */
>     suppress_non_delimited = false;
>
> -  delim = '\0';
> +  delim = 0x7F + 1;
>     have_read_stdin = false;
>
>     while ((optc = getopt_long (argc, argv, "b:c:d:f:ns", longopts, NULL)) != -1)
> @@ -846,7 +846,7 @@ main (int argc, char **argv)
>     if (operating_mode == undefined_mode)
>       FATAL_ERROR (_("you must specify a list of bytes, characters, or fields"));
>
> -  if (delim != '\0' && operating_mode != field_mode)
> +  if (delim != 0x7F + 1 && operating_mode != field_mode)
>       FATAL_ERROR (_("an input delimiter may be specified only\
>    when operating on fields"));

Keying on 0x80 doesn't seem right.
I'll apply this hunk instead in your name.
Please confirm.

diff --git a/src/cut.c b/src/cut.c
index 4219d24..f2e63dc 100644
--- a/src/cut.c
+++ b/src/cut.c
@@ -846,7 +846,7 @@ main (int argc, char **argv)
    if (operating_mode == undefined_mode)
      FATAL_ERROR (_("you must specify a list of bytes, characters, or fields"));

-  if (delim != '\0' && operating_mode != field_mode)
+  if (delim_specified && operating_mode != field_mode)
      FATAL_ERROR (_("an input delimiter may be specified only\
   when operating on fields"));

thanks,
Pádraig.

Subject: [PATHC] improve error reporting
From: "Alexandru Cojocaru" <[email-masked]>
To: [email-masked]
Date: Tue, 04 Dec 2012 16:32:27 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

>From 8ecd92b3c11abc5cde184f0c511cd469190511af Mon Sep 17 00:00:00 2001
From: Cojocaru Alexandru <[email-masked]>
Date: Tue, 4 Dec 2012 16:08:42 +0100
Subject: [PATCH] cut: improve error reporting

* src/cut.c (main): Report error on `-d '' -b1'

* src/cut.c (set_fields): Change the error message when
the given list is invalid.
---
 src/cut.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/cut.c b/src/cut.c
index 4219d24..d55da51 100644
--- a/src/cut.c
+++ b/src/cut.c
@@ -365,7 +365,7 @@ set_fields (const char *fieldstr)
           in_digits = false;
           /* Starting a range. */
           if (dash_found)
-            FATAL_ERROR (_("invalid byte or field list"));
+            FATAL_ERROR (_("invalid byte, character or field list"));
           dash_found = true;
           fieldstr++;
 
@@ -491,7 +491,7 @@ set_fields (const char *fieldstr)
           fieldstr++;
         }
       else
-        FATAL_ERROR (_("invalid byte or field list"));
+        FATAL_ERROR (_("invalid byte, character or field list"));
     }
 
   max_range_endpoint = 0;
@@ -781,7 +781,7 @@ main (int argc, char **argv)
   /* By default, all non-delimited lines are printed.  */
   suppress_non_delimited = false;
 
-  delim = '\0';
+  delim = 0x7F + 1;
   have_read_stdin = false;
 
   while ((optc = getopt_long (argc, argv, "b:c:d:f:ns", longopts, NULL)) != -1)
@@ -846,7 +846,7 @@ main (int argc, char **argv)
   if (operating_mode == undefined_mode)
     FATAL_ERROR (_("you must specify a list of bytes, characters, or fields"));
 
-  if (delim != '\0' && operating_mode != field_mode)
+  if (delim != 0x7F + 1 && operating_mode != field_mode)
     FATAL_ERROR (_("an input delimiter may be specified only\
  when operating on fields"));
 
-- 
1.8.0.1