Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 23 |
Nodes: | 6 (0 / 6) |
Uptime: | 52:24:53 |
Calls: | 583 |
Files: | 1,139 |
D/L today: |
179 files (27,921K bytes) |
Messages: | 111,611 |
Patching for logwatch-7.13Ignoring previously applied (or reversed) patch.
Applying FreeBSD patches for logwatch-7.13 from /usr/ports/sysutils/logwatch/files
FAILED Applying FreeBSD patch-scripts_logwatch.pl*** Error code 1
FAILED to apply cleanly FreeBSD patch(es) patch-scripts_logwatch.pl
But: If I do apply that very same patch by 'patch < files/patch-scripts_logwatch.pl' at the appropriate location, all 18 hunks are applied successfully.I forgot to mention, that when removing the very first hunk starting at line 1, all other hunks are applied during 'poudriere testport' successfully. Only a patch starting at line 1 woes.
On 7/18/25 11:48, Michael Grimm wrote:That is how I produced that patch (also to please portlint). Errors see above.
Hi,
I am preparing for the upcoming logwatch-7.13 release, and ran into an issue I can't understand.
I do want to patch the logwatch.pl script by providing a 'files/patch-scripts_logwatch.pl' which starts as follows:
--- scripts/logwatch.pl.orig 2025-07-18 18:21:47 UTC
+++ scripts/logwatch.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/local/bin/perl -w
use strict;
##########################################################################>> ##########################################################################>> [followed by 17 other hunks]
Using "poudriere testport rCa sysutils/logwatch" I get:
=======================<phase: patch >============================ >> ===== env: DEVELOPER_MODE=yes DEVELOPER=1 STRICT_DEPENDS=yes USER=root UID=0 GID=0
Patching for logwatch-7.13Ignoring previously applied (or reversed) patch.
Applying FreeBSD patches for logwatch-7.13 from /usr/ports/sysutils/logwatch/files
18 out of 18 hunks ignored--saving rejects to scripts/logwatch.pl.rej
FAILED Applying FreeBSD patch-scripts_logwatch.pl*** Error code 1
FAILED to apply cleanly FreeBSD patch(es) patch-scripts_logwatch.pl
Stop.
But: If I do apply that very same patch by 'patch < files/patch-scripts_logwatch.pl' at the appropriate location, all 18 hunks are applied successfully.
Can you help me to understand how to fix this?
As a workflow, I copy the file to file.orig, manually patch it, and then run `make makepatch` in the port's folder to create the patches under files/ appropriately. You can also use this to compare the result to your current work.
For this case you should consider replacing a static patch replacement with a more dynamic replacement if possible (modify as needed):After failing with the first hunk, I removed it and placed it into the Makefile:
post-patch:
@${REINPLACE_CMD} -e 's|/usr/bin|${PREFIX}/bin|g' ${WRKSRC}/scripts/logwatch.pl
though in such a particular case there is also the following predesigned fix which may work:That's already been in the Makefile.
USES= shebangfix
SHEBANG_FILES= ./scripts/logwatch.pl
On 18/07/2025 20:48, Michael Grimm wrote:Bingo! Now I do understand what went wrong.
But: If I do apply that very same patch by 'patch < files/patch-scripts_logwatch.pl' at the appropriate location, all 18 hunks are applied successfully.
Can you help me to understand how to fix this?
Thanks in advance and regards,
Michael
Can it be that the file is already modified by shebangfix? it is in the Makefile:
USES= perl5 shebangfix
SHEBANG_FILES= scripts/logwatch.pl
If there is a shebangfix there is no need to patch it.