unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: commit-msg hook
Date: Sat, 11 Apr 2015 08:40:29 -0700	[thread overview]
Message-ID: <5529406D.4040304@cs.ucla.edu> (raw)
In-Reply-To: <83a8yff0pl.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1602 bytes --]

Eli Zaretskii wrote:
> the problem with hanging is not due
> to Gawk, but instead due to 'printf': it doesn't produce the UTF-8
> encoding of the percent sign

OK, so we're dealing with a broken MS-Windows shell rather than a broken 
MS-Windows gawk.  That 'printf' command is there only so that the script can be 
pure ASCII, and it's simpler to avoid that nicety.  I installed the attached 
patch to try to work around the shell bug.

As regards the idea of using Emacs rather than the shell, I'm with Dmitry: let's 
not assume Emacs is already working when bootstrapping a new Emacs.  Instead, 
let's merely assume that a new developer has a working shell, since that's 
needed anyway for other reasons.

> Is it possible to install the hooks in GNUMakefile, so that running
> autogen.sh manually wouldn't be needed?  I normally almost never run
> autogen.sh, I always just run "make" from the top-level directory.

I'm leery of that.  GNUMakefile is run by everybody, not just by developers. 
And there are good reasons that the Git hooks are not themselves in the Git 
repository (if they were in the repository, and they were sufficiently messed 
up, then one couldn't 'git commit' fixes).  If we routinely updated the Git 
hooks automatically, we'd make it more likely that Git non-experts would put 
their painfully constructed repositories into a "broken" state, and we already 
have too much panic in that neighborhood.

That being said, it might make sense to separate the Git hook (re)initialization 
into an autogen.sh option, since it's cheap whereas autogen.sh by default is 
expensive.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Port-commit-msg-to-broken-MS-Windows-shell.patch --]
[-- Type: text/x-patch; name="0001-Port-commit-msg-to-broken-MS-Windows-shell.patch", Size: 1570 bytes --]

From 2cc9a32d361492f28faeced22e3800eb1a59c252 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 11 Apr 2015 08:19:13 -0700
Subject: [PATCH] Port commit-msg to broken MS-Windows shell

* build-aux/git-hooks/commit-msg (cent_sign):
Just use UTF-8 here rather than ASCII + printf, as the latter fails
on a broken MS-Windows shell.  Reported by Eli Zaretskii in:
http://lists.gnu.org/archive/html/emacs-devel/2015-04/msg00592.html
---
 build-aux/git-hooks/commit-msg | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/build-aux/git-hooks/commit-msg b/build-aux/git-hooks/commit-msg
index ea8d909..3fc6e19 100755
--- a/build-aux/git-hooks/commit-msg
+++ b/build-aux/git-hooks/commit-msg
@@ -29,8 +29,7 @@ fi
 
 # Use a UTF-8 locale if available, so that the UTF-8 check works.
 # Use U+00A2 CENT SIGN to test whether the locale works.
-cent_sign_utf8_format='\302\242\n'
-cent_sign=`printf "$cent_sign_utf8_format"`
+cent_sign='¢'
 print_at_sign='{print substr("'$cent_sign'@", 2)}'
 at_sign=`$awk "$print_at_sign" 2>/dev/null`
 if test "$at_sign" != @; then
@@ -45,7 +44,7 @@ exec $awk -v at_sign="$at_sign" -v cent_sign="$cent_sign" '
   BEGIN {
     # These regular expressions assume traditional Unix unibyte behavior.
     # They are needed for old or broken versions of awk, e.g.,
-    # mawk 1.3.3 (1996), Gawk 3.0.4 (1999).
+    # mawk 1.3.3 (1996), or gawk on MSYS (2015).
     space = "[ \f\n\r\t\v]"
     non_space = "[^ \f\n\r\t\v]"
     non_print = "[\1-\37\177]"
-- 
2.1.0


  parent reply	other threads:[~2015-04-11 15:40 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-10 10:43 commit-msg hook Eli Zaretskii
2015-04-10 18:23 ` Johan Bockgård
2015-04-11  2:42 ` Paul Eggert
2015-04-11  7:24   ` Eli Zaretskii
2015-04-11  9:55     ` Eli Zaretskii
2015-04-11  9:59       ` Eli Zaretskii
2015-04-11 12:42         ` Dmitry Gutov
2015-04-11 14:29           ` Eli Zaretskii
2015-04-11 15:13             ` Dmitry Gutov
2015-04-11 15:17               ` Eli Zaretskii
2015-04-12  3:36                 ` Stefan Monnier
2015-04-12 18:54                   ` chad
2015-04-11 15:40       ` Paul Eggert [this message]
2015-04-11 16:40         ` Eli Zaretskii
2015-04-11 20:09           ` Paul Eggert
2015-04-12 16:10             ` Eli Zaretskii
2015-04-13 15:48             ` Eli Zaretskii
2015-04-13 18:37               ` Paul Eggert
2015-04-13 20:18                 ` Eli Zaretskii
2015-04-13 21:19                   ` Paul Eggert
2015-04-14 15:08                     ` Eli Zaretskii
2015-04-14 17:01                       ` Paul Eggert
2015-04-14 17:09                         ` Eli Zaretskii
2015-04-14 17:42                           ` Paul Eggert
2015-04-14 18:01                             ` Eli Zaretskii
2015-04-14 18:32                               ` Paul Eggert
2015-04-14 18:59                                 ` Eli Zaretskii

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=5529406D.4040304@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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).