unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Meyering <jim@meyering.net>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: bug-vc-dwim@gnu.org, 8771@debbugs.gnu.org
Subject: bug#8771: [Bug-vc-dwim] vc-dwim problem parsing ChangeLog entries
Date: Tue, 31 May 2011 23:43:35 +0200	[thread overview]
Message-ID: <87vcwqeebc.fsf@rho.meyering.net> (raw)
In-Reply-To: <4DE50024.5020901@cs.ucla.edu> (Paul Eggert's message of "Tue, 31 May 2011 07:50:12 -0700")

Paul Eggert wrote:
> On 05/31/11 06:03, Stefan Monnier wrote:
>> And rather than
>>
>>    * composite.c (get_composition_id, gstring_lookup_cache):
>>    (composition_gstring_put_cache): Foobar.
>>
>> we usually write:
>>
>>    * composite.c (get_composition_id, gstring_lookup_cache)
>>    (composition_gstring_put_cache): Foobar.
>
> OK, I'll adjust that ChangeLog entry by hand.  I had appended
> the extra colon to the first line because otherwise vc-dwim doesn't
> parse the ChangeLog properly.
>
> This appears to be a bug in vc-dwim so I'll send this email
> to bug-vc-dwim@gnu.org (the original thread is at
> <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8771#8>).  For example,
> with vc-dwim 1.5 and the following ChangeLog:
>
> 2011-05-31  Paul Eggert  <eggert@cs.ucla.edu>
>
>         Remove arbitrary limit of 2**31 entries in hash tables.  (Bug#8771)
> 	* composite.c (get_composition_id, gstring_lookup_cache)
>         (composition_gstring_put_cache):
>         * composite.h (struct composition.hash_index):
>         Use 'EMACS_UINT' and 'EMACS_INT'
>         for hashes and hash indexes, instead of 'unsigned' and 'int'.
>
> vc-dwim generates the following diagnostic:
>
> vc-dwim:ChangeLog: line of unexpected form:
> * composite.c (get_composition_id, gstring_lookup_cache) at
> /home/eggert/opt/Linux-x86_64/merged/bin/vc-dwim line 991.
>
> This diagnostic means vc-dwim isn't understanding the newish ChangeLog
> format in the GNU coding standards
> <http://www.gnu.org/prep/standards/html_node/Style-of-Change-Logs.html>.
> Also, that "line 991" is confusing, since it's not the line number in
> the ChangeLog file.

Hi Paul,

Thanks for the report.
I've added a test for that and fixed it with these:

From 92d2db3ccfa024f84db6780029a2017cf5184618 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Tue, 31 May 2011 23:41:19 +0200
Subject: [PATCH 1/2] vc-dwim: relax file-spec ChangeLog regexp to accommodate
 new GCS-style

* vc-dwim.pl (main): Relax the file-spec matching regexp.  Before,
the regexp was /^\* (\S.*?):/, while now we also allow a line
ending in ")": /^\* (\S.*?)(:|\)$)/
* NEWS (Bug fixes): Mention it.
---
 NEWS       |    3 +++
 vc-dwim.pl |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/NEWS b/NEWS
index 21b39f2..571b4be 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ vc-dwim NEWS                                          -*- outline -*-

 ** Bug fixes

+  vc-dwim no longer fails when it encounters a ChangeLog line like
+  "* file (...)" (i.e., with no colon) when that line ends with a ")".
+
   "vc-dwim a/ChangeLog b/ChangeLog" would mistakenly complain about
   an "--author/ChangeLog mismatch" even though the two name/email
   pairs in the ChangeLog files were identical.
diff --git a/vc-dwim.pl b/vc-dwim.pl
index e474efc..76b3ae0 100755
--- a/vc-dwim.pl
+++ b/vc-dwim.pl
@@ -989,7 +989,7 @@ sub main

           if ($line =~ /^\*/)
             {
-              $line =~ /^\* (\S.*?):/
+              $line =~ /^\* (\S.*?)(:|\)$)/
                 or die "$ME:$log: line of unexpected form:\n$line";
               my $f_spec = $1;
               foreach my $file (change_log_line_extract_file_list ($f_spec))
--
1.7.5.2.660.g9f46c


From d2083c184da222885e6fd96cbe204af95c86bd2b Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Tue, 31 May 2011 22:39:52 +0200
Subject: [PATCH 2/2] tests: add a test to exercise a ChangeLog syntax bug

* tests/cl-syntax: New script. Test for the bug reported by Paul Eggert
in https://lists.gnu.org/archive/html/bug-vc-dwim/2011-05/msg00006.html
* tests/Makefile.am (TESTS): Add cl-syntax.
---
 tests/Makefile.am |    1 +
 tests/cl-syntax   |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)
 create mode 100755 tests/cl-syntax

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 307851d..b588c3f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -14,6 +14,7 @@ TESTS = \
   git-mv \
   two-line-attr \
   cl-other-user \
+  cl-syntax \
   no-vc \
   symlinked-changelog \
   scalar \
diff --git a/tests/cl-syntax b/tests/cl-syntax
new file mode 100755
index 0000000..3a29619
--- /dev/null
+++ b/tests/cl-syntax
@@ -0,0 +1,34 @@
+#!/bin/sh
+# Ensure that we accept relatively new ChangeLog syntax.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ..
+print_ver_ vc-dwim
+
+require_git_
+
+cat <<EOF > ChangeLog || framework_failure_
+2011-05-31  R. Andom  <random@example.com>
+
+	* not-checked.c: Irrelevant.
+
+EOF
+git init > /dev/null || framework_failure_
+touch foo || framework_failure_
+git add . || framework_failure_
+git commit -m m . > /dev/null || framework_failure_
+
+cat <<EOF > ChangeLog
+2011-05-31  R. Andom  <random@example.com>
+
+	* foo (bar)
+        (qux): Comment.
+	* not-checked.c: Irrelevant.
+
+EOF
+
+fail=0
+
+echo a > foo || framework_failure_
+vc-dwim ChangeLog || fail=1
+
+Exit $fail
--
1.7.5.2.660.g9f46c





  reply	other threads:[~2011-05-31 21:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-31  6:09 bug#8771: Remove arbitrary 32-bit limit in Emacs hash tables Paul Eggert
2011-05-31 13:03 ` Stefan Monnier
2011-05-31 14:50   ` bug#8771: vc-dwim problem parsing ChangeLog entries (was: Emacs bug#8771) Paul Eggert
2011-05-31 21:43     ` Jim Meyering [this message]
     [not found] ` <handler.8771.B.130682219719090.ack@debbugs.gnu.org>
2011-06-02  8:05   ` bug#8771: Acknowledgement (Remove arbitrary 32-bit limit in Emacs hash tables) Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vcwqeebc.fsf@rho.meyering.net \
    --to=jim@meyering.net \
    --cc=8771@debbugs.gnu.org \
    --cc=bug-vc-dwim@gnu.org \
    --cc=eggert@cs.ucla.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).