bug-idutils
[Top][All Lists]
Advanced

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

Re: [bug-idutils] [Bug report] No matter how the options(-x, -o, -d) are


From: Jim Meyering
Subject: Re: [bug-idutils] [Bug report] No matter how the options(-x, -o, -d) are specified, the result is the same.
Date: Tue, 02 Aug 2011 17:52:37 +0200

Shigio YAMAGUCHI wrote:
> Though I might be misunderstanding about it, I might have found a bug.
>
> 1. Situation of the trouble
> ---------------------------
>
> No matter how the options(-x,-o,-d) are specified, the result is the same.
>
> % lid 0xff
> 0377           libglibc/regex.c
> 0xFF           libglibc/regex.c
> 0xff           htags/defineindex.c libdb/{bt_split,mpool}.c
> 255            libdb/compat.h global/global.c gtags/gtags.c
> % lid -x 0xff
> 0377           libglibc/regex.c
> 0xFF           libglibc/regex.c
> 0xff           htags/defineindex.c libdb/{bt_split,mpool}.c
> 255            libdb/compat.h global/global.c gtags/gtags.c
> % lid -o 0xff
> 0377           libglibc/regex.c
> 0xFF           libglibc/regex.c
> 0xff           htags/defineindex.c libdb/{bt_split,mpool}.c
> 255            libdb/compat.h global/global.c gtags/gtags.c
> % lid -d 0xff
> 0377           libglibc/regex.c
> 0xFF           libglibc/regex.c
> 0xff           htags/defineindex.c libdb/{bt_split,mpool}.c
> 255            libdb/compat.h global/global.c gtags/gtags.c

Thank you for the patch.  That is indeed a bug.

I expect to apply your patch along with two other patches, below.
The first updates to the latest gnulib (it pulls in a new
syntax-check test which would fail, so I've temporarily disabled it).

The second is yours, and it's small enough that you
still do not need to assign copyright.  However in case
you submit another patch, you will probably have to
fill out and exchange copyright paperwork with the FSF.
Can you do that?

The third adds a test to exercise the bug and the fix.

>From 76833d687cb435f98a1fd664f04caf19894b8147 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 2 Aug 2011 14:21:09 +0200
Subject: [PATCH 1/3] build: update gnulib submodule to latest

* cfg.mk (local-checks-to-skip): Add sc_prohibit_path_max_allocation
to the list of skipped syntax-check rules.  This is temporary.
---
 cfg.mk |    3 ++-
 gnulib |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index b4f56a7..6aaeef1 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -21,7 +21,8 @@ manual_title = GNU idutils: ID database utilities
 local-checks-to-skip =                 \
   sc_bindtextdomain                    \
   sc_changelog                         \
-  sc_prohibit_atoi_atof
+  sc_prohibit_atoi_atof                        \
+  sc_prohibit_path_max_allocation

 old_NEWS_hash = 7c42fc431cadd9164dde6f9a7113b920

diff --git a/gnulib b/gnulib
index 9d196fa..c596dce 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 9d196fad055a448c5732a8e950cc044b353d2615
+Subproject commit c596dce2525adef145e3ec2e1d3c89dc044ac8e8
--
1.7.6.351.gb35ac


>From 3849c7c1e47e70ab9dd0d188afb9618982c7883c Mon Sep 17 00:00:00 2001
From: Shigio YAMAGUCHI <address@hidden>
Date: Tue, 2 Aug 2011 14:20:12 +0200
Subject: [PATCH 2/3] lid: fix a bug that made it so -o, -x, -d did not work

* src/lid.c (radix_flag): Initialize to 0, not radix_all.
(main): Map 0 to the default, radix_all.
Tiny change.
---
 src/lid.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/lid.c b/src/lid.c
index 942a6f8..5ab7620 100644
--- a/src/lid.c
+++ b/src/lid.c
@@ -161,7 +161,7 @@ static int show_version;

 /* Which radixes do we want? */

-static int radix_flag = radix_all;
+static int radix_flag = 0;

 /* If nonzero, ignore differences in alphabetic case while matching.  */

@@ -411,6 +411,8 @@ main (int argc, char **argv)
   if (show_help)
     help_me ();

+  if (radix_flag == 0)
+    radix_flag = radix_all;
   if (separator_style == ss_contextual)
     {
       if (isatty (STDOUT_FILENO))
--
1.7.6.351.gb35ac


>From c08a9c69de4833384539c3296927a1e329d7f6e4 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 2 Aug 2011 17:37:41 +0200
Subject: [PATCH 3/3] tests: add a test for the lid radix-handling bug

* testsuite/lid-radix: New file.
* testsuite/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
---
 NEWS                  |    2 +
 testsuite/Makefile.am |    1 +
 testsuite/lid-radix   |   50 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 53 insertions(+), 0 deletions(-)
 create mode 100755 testsuite/lid-radix

diff --git a/NEWS b/NEWS
index e166d4c..b664c35 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ GNU idutils NEWS                                      -*- 
outline -*-

   lid -L no longer mishandles open-ended ranges like "..2" and "2.."

+  lid's -d, -o and -x options now work properly
+

 * Noteworthy changes in release 4.5 (2010-06-17) [stable]

diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index a31ce49..dfa3477 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -5,6 +5,7 @@ TESTS =                 \
   files0-from          \
   help-version         \
   infloop-kawa-el      \
+  lid-radix            \
   lid-range

 EXTRA_DIST =                   \
diff --git a/testsuite/lid-radix b/testsuite/lid-radix
new file mode 100755
index 0000000..63922ba
--- /dev/null
+++ b/testsuite/lid-radix
@@ -0,0 +1,50 @@
+#!/bin/sh
+# Demonstrate how lid's -o, -d and -x options work
+
+# Copyright (C) 2011 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+
+echo 255  > d.txt || framework_failure_
+echo 0255 >d2.txt || framework_failure_
+echo 0377 > o.txt || framework_failure_
+echo 377 > o2.txt || framework_failure_
+echo 0xff > x.txt || framework_failure_
+echo ff  > x2.txt || framework_failure_
+
+echo '*.txt text' > map || framework_failure_
+
+mkid -m map || framework_failure_
+
+cat <<EOF > exp.all
+d.txt
+o.txt
+x.txt
+EOF
+
+for i in d o x; do
+  echo $i.txt > exp.$i || framework_failure_
+done
+
+lid --key=none 0xff > out || fail=1
+compare out exp.all || fail=1
+
+for i in d o x; do
+  lid --key=none -$i 0xff > out || fail=1
+  compare out exp.$i || fail=1
+done
+
+Exit $fail
--
1.7.6.351.gb35ac



reply via email to

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