如何应用这个补丁

如何应用这个补丁

有一个针对 perl 模块 net::ssh2 的补丁修复程序,它修复了某些机器上发生的段错误。

它位于这里: https://rt.cpan.org/Public/Bug/Display.html?id=36614

我下载了补丁,但我不知道如何应用它。我删除了之前安装的模块,转到构建文件夹并执行了

补丁 ssh2.xs < p1

它问我补丁是否反向。我不确定,所以我点击了“是”。 IT 说补丁成功然后告诉我正常。安装模块。我认为补丁不起作用或者我正在正确地移动我的补丁版本。我有这种感觉,因为我仍然遇到段错误,每个人都说这可以修复它。

答案1

正确的补丁调用将如下所示:

patch -p1 < net-ssh2-0.18-perl5.10.patch

您已在文件 SSH2.xs 所在的目录中执行此操作。

答案2

直接摘录自 gnu 补丁手册页:

   -p<num>  or  --strip=num
      Strip the smallest prefix containing num leading slashes from each file name found in the patch file.  A sequence of  one  or  more  adjacent
      slashes  is  counted  as  a single slash.  This controls how file names found in the patch file are treated, in case you keep your files in a
      different directory than the person who sent out the patch.  For example, supposing the file name in the patch file was

         /u/howard/src/blurfl/blurfl.c

      setting -p0 gives the entire file name unmodified, -p1 gives

         u/howard/src/blurfl/blurfl.c

      without the leading slash, -p4 gives

         blurfl/blurfl.c

      and not specifying -p at all just gives you blurfl.c.  Whatever you end up with is looked for either in the current directory, or the  direc-
      tory specified by the -d option.

相关内容