GNU Diffutils jest pakietem kilku programów służących do znajdowania różnic między plikami. Solaris ma oczywiście diffa w systemie, ale jak zwykle jest nieco uboższy od wersji GNU.
Poniżej zapis sesji konfiguracji i kompilacji, a w załącznikach skrypt i patch. Do kompilacji należy używać GNU Make (gmake).
soft@wega:~/diffutils% ./drf_diffutils-3.0_conf
cc: Sun C 5.10 SunOS_sparc 2009/06/03
usage: cc [ options] files. Use 'cc -flags' for details
MANPATH=/usr/local/share/man:/usr/local/man:/usr/share/man
PATH=/usr/local/bin:/usr/bin:/opt/SUNWspro/bin:/usr/ccs/bin
CFLAGS=-fast
CPPFLAGS=-I/usr/local/include
CXXFLAGS=-fast
LDFLAGS=-L/usr/local/lib -R/usr/local/lib
=============================================
gmake clean [y|n] ?
n
=============================================
configure [y|n] ?
y
...
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
=============================================
Kompilacja:
gmake [y|n] ?
y
Making all in lib
gmake[1]: Entering directory `/home/soft/diffutils/diffutils-3.0/lib'
GEN arg-nonnull.h
GEN c++defs.h
GEN configmake.h
...
gmake[1]: Nothing to be done for `all-am'.
gmake[1]: Leaving directory `/home/soft/diffutils/diffutils-3.0'
Compilation successful
=============================================
Testowanie:
gmake check [y|n] ?
y
Making check in lib
gmake[1]: Entering directory `/home/soft/diffutils/diffutils-3.0/lib'
gmake check-recursive
gmake[2]: Entering directory `/home/soft/diffutils/diffutils-3.0/lib'
...
PASS: basic
PASS: binary
PASS: help-version
FAIL: function-line-vs-leading-space
PASS: label-vs-func
PASS: no-newline-at-eof
PASS: stdin
=============================================
GNU diffutils 3.0: tests/test-suite.log
=============================================
1 of 7 tests failed.
.. contents:: :depth: 2
FAIL: function-line-vs-leading-space (exit: 1)
==============================================
++ initial_cwd_=/home/soft/diffutils/diffutils-3.0/tests
+++ expr ././function-line-vs-leading-space : '.*/\(.*\)$'
++ ME_=function-line-vs-leading-space
+++ testdir_prefix_
+++ printf gt
++ pfx_=gt
+++ mktempd_ /home/soft/diffutils/diffutils-3.0/tests gt-function-line-vs-leading-space.XXXX
+++ case $# in
+++ destdir_=/home/soft/diffutils/diffutils-3.0/tests
+++ template_=gt-function-line-vs-leading-space.XXXX
+++ MAX_TRIES_=4
+++ case $destdir_ in
+++ case $template_ in
+++ fail=0
++++ unset TMPDIR
++++ mktemp -d -t -p /home/soft/diffutils/diffutils-3.0/tests gt-function-line-vs-leading-space.XXXX
+++ d=/home/soft/diffutils/diffutils-3.0/tests/gt-function-line-vs-leading-space.aivZ
+++ case $d in
+++ test -d /home/soft/diffutils/diffutils-3.0/tests/gt-function-line-vs-leading-space.aivZ
++++ ls -dgo /home/soft/diffutils/diffutils-3.0/tests/gt-function-line-vs-leading-space.aivZ
++++ tr S -
+++ perms='drwx------ 2 2 May 19 10:40 /home/soft/diffutils/diffutils-3.0/tests/gt-function-line-vs-leading-space.aivZ'
+++ case $perms in
+++ test 0 = 0
+++ echo /home/soft/diffutils/diffutils-3.0/tests/gt-function-line-vs-leading-space.aivZ
+++ return
++ test_dir_=/home/soft/diffutils/diffutils-3.0/tests/gt-function-line-vs-leading-space.aivZ
++ cd /home/soft/diffutils/diffutils-3.0/tests/gt-function-line-vs-leading-space.aivZ
++ trap remove_tmp_ 0
++ for sig_ in 1 2 3 13 15
+++ expr 1 + 128
++ eval 'trap '\''Exit 129'\'' 1'
+++ trap 'Exit 129' 1
++ for sig_ in 1 2 3 13 15
+++ expr 2 + 128
++ eval 'trap '\''Exit 130'\'' 2'
+++ trap 'Exit 130' 2
++ for sig_ in 1 2 3 13 15
+++ expr 3 + 128
++ eval 'trap '\''Exit 131'\'' 3'
+++ trap 'Exit 131' 3
++ for sig_ in 1 2 3 13 15
+++ expr 13 + 128
++ eval 'trap '\''Exit 141'\'' 13'
+++ trap 'Exit 141' 13
++ for sig_ in 1 2 3 13 15
+++ expr 15 + 128
++ eval 'trap '\''Exit 143'\'' 15'
+++ trap 'Exit 143' 15
+ path_prepend_ ../src
+ test 1 '!=' 0
+ path_dir_=../src
+ case $path_dir_ in
++ cd /home/soft/diffutils/diffutils-3.0/tests/../src
++ echo /home/soft/diffutils/diffutils-3.0/src
+ abs_path_dir_=/home/soft/diffutils/diffutils-3.0/src
+ case $abs_path_dir_ in
+ PATH=/home/soft/diffutils/diffutils-3.0/src:/home/soft/diffutils/diffutils-3.0/src:/usr/local/bin:/usr/bin:/opt/SUNWspro/bin:/usr/ccs/bin
+ create_exe_shims_ /home/soft/diffutils/diffutils-3.0/src
+ case $EXEEXT in
+ return 0
+ shift
+ test 0 '!=' 0
+ export PATH
+ cat
+ sed s/foo/null/
+ cat
+ fail=0
+ diff -u -F '^[[:space:]]*\(function\|procedure\)' in in2
+ test 1 = 1
+ tail -n+3 out
usage: tail [+/-[n][lbc][f]] [file]
tail [+/-[n][l][r|f]] [file]
+ fail=1
+ compare out exp
+ diff -u out exp
--- out 2011-05-19 10:40:55.450518900 +0200
+++ exp 2011-05-19 10:40:55.430644400 +0200
@@ -1,5 +1,3 @@
---- in 2011-05-19 10:40:55.406636900 +0200
-+++ in2 2011-05-19 10:40:55.418986100 +0200
@@ -8,7 +8,7 @@ procedure Local_Level_5 is
null;
null;
+ fail=1
+ compare err /dev/null
+ diff -u err /dev/null
+ Exit 1
+ set +e
+ exit 1
+ exit 1
+ remove_tmp_
+ __st=1
+ cleanup_
+ :
+ cd /home/soft/diffutils/diffutils-3.0/tests
+ chmod -R u+rwx /home/soft/diffutils/diffutils-3.0/tests/gt-function-line-vs-leading-space.aivZ
+ rm -rf /home/soft/diffutils/diffutils-3.0/tests/gt-function-line-vs-leading-space.aivZ
+ exit 1
======================================
1 of 7 tests failed
See tests/test-suite.log
Please report to bug-diffutils@gnu.org
======================================
gmake[3]: *** [test-suite.log] Error 1
gmake[3]: Leaving directory `/home/soft/diffutils/diffutils-3.0/tests'
gmake[2]: *** [check-TESTS] Error 2
gmake[2]: Leaving directory `/home/soft/diffutils/diffutils-3.0/tests'
gmake[1]: *** [check-am] Error 2
gmake[1]: Leaving directory `/home/soft/diffutils/diffutils-3.0/tests'
gmake: *** [check-recursive] Error 1
Powyższy błąd wynika z tego, że starsze wersje tail nie akceptują składni zastosowanej w pliku tests/function-line-vs-leading-space. Można to poprawić stosując sed zamiast tail, tak jak jest to opisane na liście bug-diffutils. Patcha umieszczam w załączniku.
soft@wega:~/diffutils% cd diffutils-3.0
soft@wega:~/diffutils/diffutils-3.0% cp tests/function-line-vs-leading-space tests/function-line-vs-leading-space.orig
soft@wega:~/diffutils/diffutils-3.0% vi tests/function-line-vs-leading-space
soft@wega:~/diffutils/diffutils-3.0% diff -u tests/function-line-vs-leading-space.orig tests/function-line-vs-leading-space > ../diffutils-3.0-function-line.patch
soft@wega:~/diffutils/diffutils-3.0% cat ../diffutils-3.0-function-line.patch
--- tests/function-line-vs-leading-space.orig Thu May 19 10:45:15 2011
+++ tests/function-line-vs-leading-space Thu May 19 10:49:31 2011
@@ -56,7 +56,7 @@
diff -u -F '^[[:space:]]*\(function\|procedure\)' in in2 > out 2> err
test $? = 1 || fail=1
-tail -n+3 out > k && mv k out || fail=1
+sed -n '3,$p' out > k && mv k out || fail=1
compare out exp || fail=1
Powtarzamy test:
soft@wega:~/diffutils/diffutils-3.0% gmake check
Making check in lib
gmake[1]: Entering directory `/home/soft/diffutils/diffutils-3.0/lib'
gmake check-recursive
gmake[2]: Entering directory `/home/soft/diffutils/diffutils-3.0/lib'
gmake[3]: Entering directory `/home/soft/diffutils/diffutils-3.0/lib'
gmake[3]: Leaving directory `/home/soft/diffutils/diffutils-3.0/lib'
gmake[2]: Leaving directory `/home/soft/diffutils/diffutils-3.0/lib'
gmake[1]: Leaving directory `/home/soft/diffutils/diffutils-3.0/lib'
Making check in src
gmake[1]: Entering directory `/home/soft/diffutils/diffutils-3.0/src'
gmake check-am
gmake[2]: Entering directory `/home/soft/diffutils/diffutils-3.0/src'
gmake[2]: Nothing to be done for `check-am'.
gmake[2]: Leaving directory `/home/soft/diffutils/diffutils-3.0/src'
gmake[1]: Leaving directory `/home/soft/diffutils/diffutils-3.0/src'
Making check in tests
gmake[1]: Entering directory `/home/soft/diffutils/diffutils-3.0/tests'
gmake check-TESTS
gmake[2]: Entering directory `/home/soft/diffutils/diffutils-3.0/tests'
gmake[3]: Entering directory `/home/soft/diffutils/diffutils-3.0/tests'
PASS: basic
PASS: binary
PASS: help-version
PASS: function-line-vs-leading-space
PASS: label-vs-func
PASS: no-newline-at-eof
PASS: stdin
==================
All 7 tests passed
==================
...
=======================
All 73 tests passed
(16 tests were not run)
=======================
...
Jak widać, teraz przeszedł bez błędów. Instalacja po przełączeniu na roota:
# cd diffutils-3.0
# gmake install
# diff --version
diff (GNU diffutils) 3.0
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later .
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.