next up previous
Next: 4 RT-Linuxのインストールとサンプル実行 Up: 3 Linuxカーネルの基礎知識 Previous: 3.4 ディストリビューション別のカーネル再構築法

3.5 patch

プログラムのバージョン管理と共同開発を支援するツールである. 作者は Perl言語の作者である Larry Wall である. patchはその後RCSからCVSへと進化した. 古いファイルと新しいファイルの差分をパッチファイルといい, 古いファイルに差分ファイルの内容を追加することで,新しいファイルを 作成することを「パッチを当てる」という.
patchの例
  % cat test1.txt   # text1.txtの中身を見る
  this is test file
  Hello Japan!
  % cat test2.txt   # text2.txtの中身を見る
  this is test file
  Hello World!
  % diff -urN test1.txt test2.txt > test.patch
                                 # パッチファイルを作る
                                 # text1.txtをtext2 に
                                 # するパッチ
  % cat test.patch  # パッチファイルを見る
  --- test1.txt   2002-12-18 16:12:31.000000000 +0900
  +++ test2.txt   2002-12-18 16:12:22.000000000 +0900
  @@ -1,2 +1,2 @@
   this is test file
  -Hello Japan!
  +Hello World!
  % patch < test.patch # パッチを当てる
  patching file `test1.txt'
  % cat test1.txt   # test1.txtの中身を見る
  this is test file
  Hello World!


generated through LaTeX2HTML. M.Inaba 平成18年5月6日