[Bradford] How to apply git patch

Michael Dorrington michael.dorrington at member.fsf.org
Sun Jan 12 15:26:43 UTC 2020


On 11/01/2020 20:09, Devo Too via Bradford wrote:
> Hi Michael (and list),
> 
> I'm top-posting because it seems that's the way everybody is going these
> days. If there are enough complaints, good, kudos to each of you, and
> I'll happily revert.

A: Because we read top to bottom.
Q: Why is top posting bad?

> Wonderful response Michael, thank you. Truly appreciated. Just what I
> needed. Nuts and bolts. Verifies and adds to what John Hudson and I have
> discussed off list.

Thanks, appreciated.

> Not quite there yet, though. As will become extremely obvious from what
> follows, my depth of knowledge is, well, shallow may be exaggeration.
> Dry may be more to the point. Getting into kernels and source code
> directories is beyond me.

I was thinking this might be the case while writing my previous email.
The next step of building and installing is more complicated than
patching but is doable and a good skill to have as you are more in
control of your computing.

> I need to find the source directory of dhcpcd. I would have expected to
> find something like that in /usr/src/. It is an empty directory. There
> are dhcpcd directories here: /usr/bin/dhcpcd /usr/lib/dhcpcd
> /etc/dhcpcd.conf /usr/share/dhcpcd, none of which contain a /src/
> subdirectory, as in the patch contents.

What you need to do depends on your distro.  Most distros, by default,
download and install pre-built packages rather than downloading the
source and building it on the user's machine.  This means you likely
won't have the source nor the development tools to build the source on
your machine.  Distros generally do provide a way to get the source and
install the build tools required, making it relatively easy to build
unchanged source.  However, in this case, if you want to build a
modified version then you'll have to jump through a few more hoops and
is even more advanced.

To get an idea of what's involved for Debian:
https://wiki.debian.org/BuildingTutorial

Summary:

1. Download the build dependencies of the source code package using a
distro tool.
2. Download the source code package using a distro tool.
3. Use distro tools to include the patch and increase the version "number".
4. Build package using a distro tool.
5. Install package using a distro tool.

> There are source directories in dot directories, ignoring man pages
> these are /usr/bin/. /usr/lib/. /etc/. /etc/.updated /usr/local/bin/.
> /usr/local/sbin/. /usr/local/etc/. /usr/local/lib/. /usr/local/games/.
> /usr/include/. /usr/local/. /usr/share/. /usr/bin/site_perl/.
> /usr/bin/vendor_perl/. /usr/bin/core_perl/. from which I assume we can
> ignore the perl ones and treat games as irrelevant on a server. Or can we?

The '.' is the same as the directory it is in so '/usr/bin/.' is the
same as '/usr/bin'.

> The one other point, which I think I understand but would like
> verification, is that the supplier of the patch has dome the work so I
> should simply run the patch commands rather than compiling and building
> the source code?

No.  They have provided a patch to the source code not a binary patch to
the program that is run.  So you will have to compile/build the source
code (and install) to make use of it.

> Michael, next time you're in the Leeds/Bradford area or I'm in Greater
> Manchester I shall certainly cough up for a pint or two! I'm none too
> sure the landlord of your local would accept my credit note :-(

I look forward to it,
M.

-- 
FSF member #9429
http://www.fsf.org/register_form?referrer=9429
http://www.fsf.org/about
"The Free Software Foundation (FSF) is a nonprofit with a worldwide
mission to promote computer user freedom and to defend the rights of all
free software users."

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.lug.org.uk/pipermail/bradford/attachments/20200112/90a5db74/attachment.sig>


More information about the Bradford mailing list