[CentOS] patching from different directory

Carlos Santana neubyr at gmail.com
Thu Sep 10 21:30:42 UTC 2009


On Thu, Sep 10, 2009 at 2:55 PM, Filipe Brandenburger
<filbranden at gmail.com> wrote:
> 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.
>
That's helpful. Thanks for the details Filipe.

I need to CD into the to-be-patched-source dir and then patch works.
This is because the context diff file is not having absolute path to
the to-be-patched file.

If I manually edit first line of context diff starting with *** to
provide absolute path, everything works fine.

Is there any way to get absolute path in the diff o/p?


> Does using "patch" in that solve your problem? Otherwise, please state
> clearly what you are trying to achieve.
>
> HTH,
> Filipe
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>



More information about the CentOS mailing list