Bug 276643 - sysutils/e2fsprogs: Fails to build after sysutils/e2fsprogs-core PORTREVISION bump
Summary: sysutils/e2fsprogs: Fails to build after sysutils/e2fsprogs-core PORTREVISION...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Matthias Andree
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-26 15:00 UTC by Tomoaki AOKI
Modified: 2024-02-02 15:32 UTC (History)
6 users (show)

See Also:
mandree: maintainer-feedback+


Attachments
Failed build log on poudriere (16.71 KB, text/plain)
2024-01-26 15:09 UTC, Tomoaki AOKI
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tomoaki AOKI 2024-01-26 15:00:33 UTC
sysutils/e2fsprogs mis-uses version comparison on BUILD_DEPENDS line, causing build failure after recent PORTREVISION bump of sysutils/e2fsprogs-core at git ports 430da911bcbbabafaaf2602ab4e30ba7b22d624d.

Not sure why it worked before, but make(1) manpage states as below,

> All comparisons may use the operators ‘==’ and ‘!=’.  Numeric comparisons
> may also use the operators ‘<’, ‘<=’, ‘>’ and ‘>=’.

but '=' is used.

Not sure why, but fixing '=' to '==' didn't work, but reverting git ports aeed96e0b18fdb062a343271c03663f31acfc37e helped.
Maybe some processing in Mk/bsd.ports.mk or something is prohibiting '==' comparison.
Comment 1 Tomoaki AOKI 2024-01-26 15:09:00 UTC
Created attachment 247986 [details]
Failed build log on poudriere

Failed build log on poudriere.
Comment 2 Matthias Andree freebsd_committer freebsd_triage 2024-01-26 16:01:15 UTC
General remark, because of the way we inherit stuff from another port, I want = not >= because that would be skewing the intention.  We don't want fsck versions to differ among installations in different versions if we lead people to the idea that we're using the same code.

bofh@, if you bump e2fsprogs-core, please also bump e2fsprogs to PORTREVISION=1. Over to you for fixing the fall-out.  Other than that, thanks for the MANPREFIX cleanup.
Comment 3 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2024-01-26 16:58:16 UTC
Sorry but bumping portrevision does not fix this.

As you know your ports better than me I think it will be easier for you to fix this up.
Comment 4 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2024-01-26 17:01:45 UTC
I can revert the bump keeping the rest changes and also fix the distfile checker so that it does not throw tantrums at us.
Comment 5 Tomoaki AOKI 2024-01-27 03:39:27 UTC
If keeping versions in sync with multiple ports, what x11/nvidia-driver does with its Makefile.version could help. This is used from x11/linux-nvidia-libs, too.

But problem here would be not only with the version synchronization, but also comparison of versions within 2 ports in the BUILD_DEPEDS line is not working as expected.

Tried `make` on bare-metal environment with unmodified Makefile attempts to build sysutils/e2fsprogs-core, and on installation phase and after, errors out with messages below. Note that sysutils/e2fsprogs-core in the bare-metal environment is already up-to-date.

====> Compressing man pages (compress-man)
===>   Installing ldconfig configuration file
===>  Installing for e2fsprogs-core-1.47.0_1
===>  Checking if e2fsprogs-core is already installed
===>   e2fsprogs-core-1.47.0_1 is already installed
      You may wish to ``make deinstall'' and install this port again
      by ``make reinstall'' to upgrade it properly.
      If you really wish to overwrite the old port of e2fsprogs-core
      without deleting it first, set the variable "FORCE_PKG_REGISTER"
      in your environment or the "make install" command line.
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/sysutils/e2fsprogs-core
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/sysutils/e2fsprogs-core
*** Error code 1

Stop.
make: stopped in /usr/ports/sysutils/e2fsprogs
Comment 6 Tomoaki AOKI 2024-01-27 03:54:39 UTC
Modifying PORTREVISION in stock Makefile caused the same error on bare-metal `make`.
Additionally modifying BUIDL_DEPENDS line as below seemed to work on bare-metal `make`.
Also worked for poudriere build. But this should require PORTREVISION always set, even if PORTVERSION is bumped. And maybe when PORTEPOCH is added, this should need to support it.

To fool-proof (POKAYOKE) such a situation, guards with conditional should be needed. But not sure it is worth doing or not.


BUILD_DEPENDS=	e2fsprogs-core=${PORTVERSION}_${PORTREVISION}:sysutils/e2fsprogs-core
Comment 7 Matthias Andree freebsd_committer freebsd_triage 2024-01-31 22:24:57 UTC
Hello Tamoaki, thank you very much for the report.

I have committed a fix that kib@ has provided by e-mail,

commit 20b92b0aac3631958b097a14d946d0cd2ad201bb
Author: Konstantin Belousov <kib@FreeBSD.org>
Date:   Wed Jan 31 22:53:17 2024 +0100

    sysutils/e2fsprogs: fix build with nonzero PORTREVISION on e2fsprogs-core

diff --git a/sysutils/e2fsprogs/Makefile b/sysutils/e2fsprogs/Makefile
index baed31f64f34..3a6f004f37ed 100644
--- a/sysutils/e2fsprogs/Makefile
+++ b/sysutils/e2fsprogs/Makefile
@@ -1,8 +1,8 @@
 PORTNAME=      e2fsprogs
 CATEGORIES=    sysutils
 PORTVERSION=   1.47.0
-PORTREVISION=  0
-BUILD_DEPENDS= e2fsprogs-core=${PORTVERSION}:sysutils/e2fsprogs-core
+PORTREVISION=  1
+BUILD_DEPENDS= e2fsprogs-core=${PORTVERSION}_${PORTREVISION}:sysutils/e2fsprogs-core
 RUN_DEPENDS=   ${BUILD_DEPENDS}
 DISTFILES=     # empty
 NO_BUILD=      yes

and also a change to warn of isolated PORTREVISION changes in e2fsprogs-core in  commit 197cfd0316bc.
Comment 8 Tomoaki AOKI 2024-02-01 11:08:51 UTC
(In reply to Matthias Andree from comment #7)

Thanks!
As I described I've sent before noticing your comment here [1],
Additional note for PORTREVISION on sysutils/e2fcprogs-core/Makefile would be needed like the one for PORTVERSION not to be deleted.

The change introduced matches what I've tested for comment #6, so has exactly the same risk with it.

[1] https://lists.freebsd.org/archives/dev-commits-ports-main/2024-January/091406.html
Comment 9 Matthias Andree freebsd_committer freebsd_triage 2024-02-01 23:00:10 UTC
Reopening.

Thanks Tomoaki-san for the attention to detail, I missed that part.

I find that ports/Mk/bsd.port.mk defaults 
PORTREVISION?=0, and we do not use 
PORTREVISION= #empty in Makefiles.

So we can safely compare PORTREVISION > 0 as in the upcoming patch, which was tested on FreeBSD 13.2 and 14.0. It might break on 12.x or older, which is no longer supported.
Comment 10 commit-hook freebsd_committer freebsd_triage 2024-02-01 23:01:01 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=855dce6bdda8eef359d09383e65530514932ac54

commit 855dce6bdda8eef359d09383e65530514932ac54
Author:     Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2024-02-01 22:57:33 +0000
Commit:     Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2024-02-01 22:57:33 +0000

    sysutils/e2fsprogs: handle PORTREVISION==0 in *_DEPENDS

    Else we would depend on, say, e2fsprogs-core-1.48.0_  (trailing
    underscore) character when PORTREVISION was zeroed or omitted.
    (Note that bsd.port.mk will default it to 0 value).

    Use make(1)'s varname:?trueval:falseval: expansion to guard
    the expansion. (_SUF1 is private in bsd.port.mk, let's avoid that).

    Reported by:    Tomoaki AOKI
    PR:             276643

 sysutils/e2fsprogs/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 11 Tomoaki AOKI 2024-02-02 09:19:41 UTC
Thanks!
I didn't know the syntax you used and planned to create fix using .if - .else - .endif style when I could take some time for try-and-error.
And this risk was why I've not uploaded my locally tested patch here.

Tested based on committed fix with
  *Change PORTREVISION to 0
  *Change PORTREVISION to blank (comment only)
  *Comment out the whole PORTREVISION line
for both sysutils/e2fsprogs-core and sysutils/e2fsprogs-core, forcibly deinstalling sysutils/e2fsprogs-core on each trial, by running `make` at sysutils/e2fsprogs-core on bare-metal environment, stable/14 amd64 at commit c0565e7d34ac248bf3c20c66f341a64a6e33d6d9.
Ports tree is at commit ff84fb4f95104fd449a7e8548069e37c0b99bb29 on main branch.

All went fine.

Thanks again!
Comment 12 Matthias Andree freebsd_committer freebsd_triage 2024-02-02 15:32:47 UTC
Thank YOU for the report and the extensive testing you did!