BSD界隈四方山話

第97回GNU diffからBSD diffへ切り替え

2017年4月20日のコミットRevision 317209で、FreeBSD 12-CURRENTのデフォルトのdiff(1)コマンド実装がGNU diffからBSD diffに切り替わりました。/usr/src/UPDATINGにその旨が追加されました。

リスト /usr/src/UPDATING - GNU diffからBSD diffへ切り替えのメッセージ
20170420:
        GNU diff has been replaced by a BSD licensed diff. Some features of GNU
        diff has not been implemented, if those are needed a newer version of
        GNU diff is available via the diffutils package under the gdiff name.

説明によるとBSD diffはGNU diffのいくつかの機能は実装していないとしており、そうした機能が必要な場合にはパッケージからdiffutilsをインストールして使うようにとあります。diffutilsパッケージをインストールするとgdiffというコマンドがインストールされますので、これがGNU diffとなります。

 diffutilsパッケージ
# pkg search -f diffutils
diffutils-3.5
Name           : diffutils
Version        : 3.5
Origin         : textproc/diffutils
Architecture   : FreeBSD:11:amd64
Prefix         : /usr/local
Repository     : FreeBSD [pkg+http://pkg.FreeBSD.org/FreeBSD:11:amd64/quarterly]
Categories     : textproc
Licenses       :
Maintainer     : [email protected]
WWW            : http://www.gnu.org/software/diffutils/diffutils.html
Comment        : The GNU diff utilities
Options        :
	NLS            : on
Shared Libs required:
	libsigsegv.so.2
	libintl.so.8
Annotations    :
Flat size      : 1.41MiB
Pkg size       : 305KiB
Description    :
The Free Software Foundation's "diff" utilities, including "diff",
"diff3", "sdiff", and "cmp".

These utilities exist in the FreeBSD base collection, but the GNU
versions have added functionality that is sometimes useful.

Note that this port will install these utilities with a `g' prefix,
for example gdiff, gdiff3, ggcmp, but the texinfo documentation
will refer to these utilities without the `g' prefix.

WWW: http://www.gnu.org/software/diffutils/diffutils.html
#
 diffutilsパッケージでインストールされるコマンド
# pkg info -l diffutils
diffutils-3.5:
	/usr/local/bin/gcmp
	/usr/local/bin/gdiff
	/usr/local/bin/gdiff3
	/usr/local/bin/gsdiff
	/usr/local/info/diffutils.info
	/usr/local/man/man1/gcmp.1.gz
	/usr/local/man/man1/gdiff.1.gz
	/usr/local/man/man1/gdiff3.1.gz
	/usr/local/man/man1/gsdiff.1.gz
	/usr/local/share/locale/ca/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/cs/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/da/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/de/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/el/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/eo/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/es/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/fi/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/fr/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/ga/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/gl/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/he/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/hr/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/hu/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/id/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/it/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/ja/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/lv/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/ms/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/nb/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/nl/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/pl/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/pt_BR/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/ro/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/ru/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/sr/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/sv/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/tr/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/uk/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/vi/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/zh_CN/LC_MESSAGES/diffutils.mo
	/usr/local/share/locale/zh_TW/LC_MESSAGES/diffutils.mo
#

FreeBSD 11.0のdiff(1)コマンドの実装はGNU diffです。GNU diff 2.8.7です。

 FreeBSD 11.0のdiff
# uname -or
FreeBSD 11.0-RELEASE-p9
# diff --version
diff (GNU diffutils) 2.8.7
Written by Paul Eggert, Mike Haertel, David Hayes,
Richard Stallman, and Len Tower.

Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# diff -h
diff: missing operand after `-h'
diff: Try `diff --help' for more information.
#

BSD diffに切り替わったあとのFreeBSD 12-CURRENTだと実装がGNU diffからBSD diffに替わっていることがわかります。

 FreeBSD 12-CURRENTのdiff
# uname -or
FreeBSD 12.0-CURRENT
# diff -h
usage: diff [-abdilpTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case]
            [--no-ignore-case] [--normal] [--strip-trailing-cr] [--tabsize]
            [-I pattern] [-L label] file1 file2
       diff [-abdilpTtw] [-I pattern] [-L label] [--ignore-case]
            [--no-ignore-case] [--normal] [--strip-trailing-cr] [--tabsize]
            -C number file1 file2
       diff [-abdiltw] [-I pattern] [--ignore-case] [--no-ignore-case]
            [--normal] [--strip-trailing-cr] [--tabsize] -D string file1 file2
       diff [-abdilpTtw] [-I pattern] [-L label] [--ignore-case]
            [--no-ignore-case] [--normal] [--tabsize] [--strip-trailing-cr]
            -U number file1 file2
       diff [-abdilNPprsTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case]
            [--no-ignore-case] [--normal] [--tabsize] [-I pattern] [-L label]
            [-S name] [-X file] [-x pattern] dir1 dir2
#

まだいくつかGPLv2のコマンドなどがユーザランドにマージされていますが、これまでの取り組みでだいぶ減ってきました。今後いくつかのコマンドは別のコマンドに入れ替わる感じになっているので、将来のリリースではさらにGPLv2のコマンドは減ることになると見られます。

勉強会

第63回 5月23日(火)19:00~FreeBSD勉強会

現在検討中です。会場は、ドワンゴセミナールーム(銀座松竹スクエア13F)になります。

登録はこちらから。

第64回 6月15日(木)19:00~ FreeBSD勉強会

現在検討中です。会場は、ヴァル研究所 セミナールームになります。

登録はこちらから。

FreeBSD勉強会 発表者募集

FreeBSD勉強会では発表者を募集しています。FreeBSDに関して発表を行いたい場合、@daichigotoまでメッセージをお願いします。1~2時間ほどの発表資料を作成していただき発表をお願いできればと思います。

おすすめ記事

記事・ニュース一覧