Patch

포괄적인 컴퓨팅 용어에 대해서는 패치 (컴퓨팅) 문서를, 다른 뜻에 대해서는 패치 문서를 참고하십시오.
patch
원저자래리 월
개발자Paul Eggert, Wayne Davison, David MacKenzie, Andreas Grünbacher
발표일1985년 5월 24일(41년 전)(1985-05-24)
운영 체제유닉스, 유닉스 계열, MSX-DOS, 마이크로소프트 윈도우
종류명령어

patch 컴퓨터 도구는 패치 파일로 불리는 별도의 파일에 포함된 지시에 따라 텍스트 파일을 업데이트하는 유닉스 프로그램이다. 이 패치 파일은 줄여서 간단히 패치라고도 하며, 일련의 차이를 구성하고 있는 텍스트 파일인데 이 파일은 원래의 파일과 업데이트된 파일을 변수로 받아 관련 diff 프로그램을 실행하여 만들어진다. patch로 파일을 업데이트하는 일을 "패치를 적용한다"고 표현한다.

역사

최초의 patch 프로그램은 프로그래밍 언어를 창시한 래리 월이 작성하여 mod.sources[1](나중의 comp.source.unix)에 1985년 5월에 게시한 것이다. 프로그램 변종들 중 하나[2][3][4]GNU 프로젝트의 일부로서 FSF에 의해 유지보수되고 있다.

사용 예

셸에 다음의 명령을 입력하면 패치를 만들 수 있다:

  $ diff -u oldFile newFile > mods.diff  # -u는 통일(unified) 포맷으로 출력함을 의미

패치를 적용하려면 다음의 명령을 셸에 입력한다:

  $ patch < mods.diff

위의 명령은 patch가 mods.diff에 기술된 지정 파일로 변경 사항을 적용하게 한다. 하위 디렉터리에 위치한 파일들에 대한 패치들은 추가적인 -p숫자 옵션을 요구하며, 여기에서 숫자는 소스 트리의 기본 디렉터리가 diff에 위치해 있으면 1이고, 그렇지 않으면 0으로 지정한다.

'-R' 옵션을 사용하면 적용된 패치를 되돌릴 수 있다:

  $ patch -R < mods.diff

파일이 diff 생성 시의 버전과 유사하지 않으면 패치는 깨끗하게 적용되지 않을 수 있다. 이를테면 텍스트의 줄들이 처음에 삽입된 경우 해당 패치에서 가리키는 줄 번호를 정확하지 않을 수 있다. patch는 주변의 줄들을 찾아서 패치가 적용될 텍스트를 재할당하는 방법으로 이러한 상황을 모면할 수 있다. 이 경우 fuzz로 기술된다.

같이 보기

각주

  1. Larry Wall (1985년 5월 24일). “patch version 1.3”. Google.com at mod.sources. 2020년 1월 24일에 원본 문서에서 보존된 문서. 2015년 11월 28일에 확인함. 
  2. http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/patch/ 보관됨 2017-06-07 - 웨이백 머신 OpenBSD patch source
  3. https://sourceforge.net/projects/schilytools/files/ A version of patch exists in the Schily tools collection
  4. A version of patch is maintained by IBM, Oracle and the Open Software Foundation

외부 링크

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.