[CentOS] patching from different directory

Filipe Brandenburger filbranden at gmail.com
Thu Sep 10 19:55:31 UTC 2009


Hi,

On Thu, Sep 10, 2009 at 14:28, Carlos Santana <neubyr at gmail.com> wrote:
> Thanks Filipe.
>
> I can do it by cd-ing into file-to-be-patched dir.

So, this means it's fixed for you?

> I think the -d
> switch in patch command does similar thing (cd). But then it assumes
> diff file also to be present in that new directory.

Yes, it will change directory before looking for the patch file, so I
believe you should use absolute pathnames or redirections.

> I guess the problem is not having full dir path in the diff file
> itself. The diff file mentions only file name. How do I get full path
> in my diff file? Any clues?

I believe the "problem" is that you are not using "patch" as you are
supposed to use it...

Read the first lines of "man patch", it will say: "but usually just:
patch -pnum <patchfile"

That is how it's intended to be used in most cases. You cd to the
directory where the source tree is, then call "patch" using
redirection to get the patch file from stdin.

Does using "patch" in that solve your problem? Otherwise, please state
clearly what you are trying to achieve.

HTH,
Filipe



More information about the CentOS mailing list