[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Erroneus error message or what?
From: |
Werner LEMBERG |
Subject: |
Re: Erroneus error message or what? |
Date: |
Wed, 05 Nov 2014 08:46:26 +0100 (CET) |
> Lately, building lilypond, I have occationally encountered a strange
> error-massage:
>
> ERROR: Please install required programs: /usr/local/bin/fontforge >=
> 20110222 (installed: 3ec845c4fe718af4908ce2dc25b66d0594930)
>
> BUT: There IS installed a version of fontforge (with the quoted hash,
> at the specified location, and it is definitely newer than 2011):
Exactly this is the problem: LilyPond's configure script doesn't
properly parse the current fontforge version string.
> In the long run this is an insecure situation. Can it be remedied?
Well, I guess that fontforge will provide a `normalized' version
string as soon as there is a new, official release – right now, the
current FontForge test releases are *really* far from stable. Until
then, you might try the attached patch.[*]
Werner
[*] This patch was rejected because of philosophical reasons (to which
I agree basically). However, I don't have time to improve it.
>From 995a2a66f0919d13ecae255f854ceedfe83c4172 Mon Sep 17 00:00:00 2001
From: Werner Lemberg <address@hidden>
Date: Fri, 26 Jul 2013 23:29:29 +0200
Subject: [PATCH] [stepmake] Rewrite STEPMAKE_GET_VERSION.
The old version wasn't able to handle current git versions of fontforge
correctly: fontforge now emits different version data to both stderr and
stdout which confused the macro (it erroneously caught the git commit ID
instead of the date).
---
aclocal.m4 | 75 +++++++++++++++++++++++++++++++++++++-------------------------
1 file changed, 45 insertions(+), 30 deletions(-)
diff --git a/aclocal.m4 b/aclocal.m4
index 87d8474..1e7ebf9 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -14,42 +14,57 @@ AC_DEFUN(STEPMAKE_GET_EXECUTABLE, [
type -p $1 2>/dev/null | tail -n 1 | awk '{print $NF}'
])
+dnl We use autoconf's diversion support to define a shell function for
+dnl getting a program's version. This avoids issues with nested `...`
+dnl since $(...), which would allow nesting naturally, is not
+dnl supported in all shells.
-# Get version string from executable ($1)
-AC_DEFUN(STEPMAKE_GET_VERSION, [
- ## "$1" --version 2>&1 | grep -v '^$' | head -n 1 | awk '{print $NF}'
- ##
- ## ARG.
- ## Workaround for broken Debian gcc version string:
- ## gcc (GCC) 3.1.1 20020606 (Debian prerelease)
- ##
- ## -V: Workaround for python
+m4_divert_push([INIT_PREPARE])
- changequote(<<, >>)#dnl
+changequote(<<, >>)
- ## Assume and hunt for dotted version multiplet.
- ## use eval trickery, because we cannot use multi-level $() instead of ``
- ## for compatibility reasons.
+# in: $_test_prog
+# out: $_ver
- ## grab the first version number in --version output.
- eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 |
- grep -E '(^| )[0-9][0-9]*\.[0-9]' |
- head -n 1 |
- tr ' ' '\n' |
- sed 's/\([0-9][0-9]*\.[0-9][0-9.]*\).*/\1/g' |
- grep -E '(^| )[0-9][0-9]*\.[0-9]' |
- head -n 1\`\"
-
- if test -z "$_ver"; then
- ## If empty, try date [fontforge]
- eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\{6,8\}' \
- | head -n 1 \
- | sed -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\"
- fi
- echo "$_ver"
- changequote([, ])#dnl
+stepmake_get_version ()
+{
+ ## Grab the first version number in --version or -V output.
+ ## First scan stdin, then stderr.
+ __ver=`("$_test_prog" --version 2> /dev/null \
+ || "$_test_prog" -V 2> /dev/null; \
+ "$_test_prog" --version 1> /dev/null \
+ || "$_test_prog" -V 1> /dev/null) 2>&1`
+
+ ## Get dotted version multiplet.
+ _ver=`echo "$__ver" \
+ | tr ' ' '\n' \
+ | grep -E '^[0-9][0-9]*\.[0-9]' \
+ | head -n 1 \
+ | sed 's/\([0-9][0-9]*\.[0-9][0-9.]*\).*/\1/'`
+
+ ## Otherwise, try date consisting of 6-8 digits.
+ if test -z "$_ver"; then
+ _ver=`echo "$__ver" \
+ | tr ' ' '\n' \
+ | grep '^[0-9]\{6,8\}' \
+ | head -n 1 \
+ | sed 's/\([0-9][0-9]*\).*/\1/'`
+ fi
+}
+
+changequote([, ])
+
+m4_divert_pop([INIT_PREPARE])
+
+
+# Get version string from executable ($1)
+AC_DEFUN(STEPMAKE_GET_VERSION, [
+ _test_prog="$1"
+ stepmake_get_version
+ echo "$_ver"
])
+
# Calculate simplistic numeric version from version string ($1)
# As yet, we have no need for something more elaborate.
AC_DEFUN(STEPMAKE_NUMERIC_VERSION, [
--
1.8.1.4