bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] gnulib-tool: don't transform binary files with sed


From: Daiki Ueno
Subject: [PATCH] gnulib-tool: don't transform binary files with sed
Date: Thu, 20 Aug 2015 09:09:58 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

* gnulib-tool (func_add_or_update): Don't apply sed_transform_* to
.mo and .class files.
Reported by Denis Denisov.
--
We have a few binary files under lib/ and tests/.  When importing a
module containing any of them, gnulib-tool fails on some systems
(typically Mac OS X):

$ ./gnulib-tool --create-testdir --dir=t dummy
...
$ cd t
$ ../gnulib-tool --import javaversion
...
Copying file lib/javaversion.c
sed: RE error: illegal byte sequence
../gnulib-tool: *** failed
../gnulib-tool: *** Stop.

---
 ChangeLog   |  7 +++++++
 gnulib-tool | 13 ++++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6f98405..7384900 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-08-20  Daiki Ueno  <address@hidden>
+
+       gnulib-tool: don't transform binary files with sed
+       * gnulib-tool (func_add_or_update): Don't apply sed_transform_* to
+       .mo and .class files.
+       Reported by Denis Denisov.
+
 2015-08-10  Daiki Ueno  <address@hidden>
 
        gperf: respect silent rules
diff --git a/gnulib-tool b/gnulib-tool
index ec82f35..cd224ad 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -4701,10 +4701,15 @@ 
s,^\(.................................................[^ ]*\) *,
     case "$f" in
       tests=lib/*) f=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
     esac
+    is_binary_file=
+    case "$f" in
+      *.class | *.mo ) is_binary_file=true ;;
+    esac
     func_dest_tmpfilename "$g"
     func_lookup_file "$f"
     cp "$lookedup_file" "$tmpfile" || func_fatal_error "failed"
-    if test -n "$sed_transform_main_lib_file"; then
+    if test -n "$sed_transform_main_lib_file" \
+       && test -z "$is_binary_file"; then
       case "$of" in
         lib/*)
           sed -e "$sed_transform_main_lib_file" \
@@ -4712,7 +4717,8 @@ s,^\(.................................................[^ 
]*\) *,
           ;;
       esac
     fi
-    if test -n "$sed_transform_build_aux_file"; then
+    if test -n "$sed_transform_build_aux_file" \
+       && test -z "$is_binary_file"; then
       case "$of" in
         build-aux/*)
           sed -e "$sed_transform_build_aux_file" \
@@ -4720,7 +4726,8 @@ s,^\(.................................................[^ 
]*\) *,
           ;;
       esac
     fi
-    if test -n "$sed_transform_testsrelated_lib_file"; then
+    if test -n "$sed_transform_testsrelated_lib_file" \
+       && test -z "$is_binary_file"; then
       case "$of" in
         tests=lib/*)
           sed -e "$sed_transform_testsrelated_lib_file" \
-- 
2.4.3




reply via email to

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