git: 54b26298c822 - main - sysutils/e2fsprogs: port rework

Baptiste Daroussin bapt at FreeBSD.org
Fri Aug 6 20:58:42 UTC 2021


4 août 2021 23:23:27 Matthias Andree <mandree at FreeBSD.org>:

> The branch main has been updated by mandree:
>
> URL: https://cgit.FreeBSD.org/ports/commit/?id=54b26298c82275501e6dcc6c733d21c0a6bf0d9f
>
> commit 54b26298c82275501e6dcc6c733d21c0a6bf0d9f
> Author:     Matthias Andree <mandree at FreeBSD.org>
> AuthorDate: 2021-08-04 20:09:19 +0000
> Commit:     Matthias Andree <mandree at FreeBSD.org>
> CommitDate: 2021-08-04 21:23:08 +0000
>
>     sysutils/e2fsprogs: port rework
>    
>     1 - sysutils/e2fsprogs: fix checksum mismatches
>    
>         e2fsprogs has replaced symlinks by hardlinks in its post-install if
>         /sbin and ${PREFIX}/sbin were on the same file system, and unless
>         script processing was defeated on install or upgrade.
>    
>         Leave symlinks in place to avoid checksum mismatches.
>    
>     PR:             252184 [1]

We already discuss this, the problem here is what this package is doing, installing in base is a violation of the ports tree rules in 99% of the case if not 100%. The purpose of this installation of hardlinksto only support a case which is known not to be functionnal: using e2fs family as a root filesystem for freebsd is a bad reason to do it. Either install everything in base or in localbase but do not do both.

Running pkg check -r is even worse.
1/ i am not sure it works are both pkg install and pkg check will attempt to get an exclusive lock o' the db
2/ by design is defeats the principle why we are having checksums on pkg

Bapt
>    
>     2 - add FLAVORS for /sbin handling
>    
>         - no flavor (default): set symlinks from $PREFIX/sbin to /sbin
>         - roothardlinks: set hardlinks from $PREFIX/sbin to /sbin, when
>           $PREFIX, its children, and /sbin reside on the same file system
>         - nobootfsck: do not install into /sbin, but this makes fsck
>           unavailable for ext2/ext3/ext4 file systems before $PREFIX/ is
>           mounted
>    
>     Require tests on i386 and amd64 only for FreeBSD >= 14 (not >= 12).
>    
>     Do not print removal advice from post-uninstall on upgrades.
> ---
> sysutils/e2fsprogs/Makefile    | 40 +++++++++++++++++++++++++++++++++++++---
> sysutils/e2fsprogs/pkg-install | 21 ++-------------------
> sysutils/e2fsprogs/pkg-plist   |  4 ++--
> 3 files changed, 41 insertions(+), 24 deletions(-)
>
> diff --git a/sysutils/e2fsprogs/Makefile b/sysutils/e2fsprogs/Makefile
> index 2d8c3dbf78be..577ecec3b840 100644
> --- a/sysutils/e2fsprogs/Makefile
> +++ b/sysutils/e2fsprogs/Makefile
> @@ -1,4 +1,16 @@
> # Created by: Maxim Sobolev <sobomax at FreeBSD.org>
> +# heavily modified by: Matthias Andree <mandree at FreeBSD.org>
> +#
> +# supported FLAVORS= default nobootfsck roothardlinks
> +# FLAVORS explained:
> +# default  - install e2fsck fsck_ext2fs into /sbin and symlink from PREFIX
> +#    - requires that / is writable
> +#
> +# roothardlinks - install e2fsck fsck_ext2fs into /sbin and hardlink from PREFIX
> +#    - requires that / is writable and the same file system as PREFIX
> +#
> +# nobootfsck - does not install into /sbin, but will be unable to fsck
> +#      ext2/ext3/ext4 file systems at boot, before PREFIX is mounted
>
> PORTNAME=  e2fsprogs
> PORTVERSION= 1.46.3
> @@ -98,6 +110,13 @@ MAKE_ARGS+= V=1
>
> .include <bsd.port.options.mk>
>
> +.if ${MASTERDIR} == ${.CURDIR}
> +FLAVORS= default nobootfsck roothardlinks
> +FLAVOR?= ${FLAVORS:[1]}
> +nobootfsck_PKGNAMESUFFIX=  -nobootfsck
> +roothardlinks_PKGNAMESUFFIX= -roothardlinks
> +.endif
> +
> . if ! empty(ARCH:Mpowerpc*)
> # Fix powerpc64/powerpc SIGSEGV,
> # see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231570 (ppc64)
> @@ -197,7 +216,13 @@ post-patch::
> .if ${MASTERDIR} == ${.CURDIR}
> # NOTE: The previous .if block goes all the way to the end of the file.
>
> -.if !empty(PORT_OPTIONS:MNOTESTS) && (${OPSYS} == FreeBSD) && (${OSVERSION} >= 1200000 || ((${ARCH} != i386) && (${ARCH} != amd64)))
> +.if ${FLAVOR} == nobootfsck
> +PLIST_SUB+=  ROOTSBIN="@comment "
> +.else
> +PLIST_SUB+=  ROOTSBIN=""
> +.endif
> +
> +.if !empty(PORT_OPTIONS:MNOTESTS) && (${OPSYS} == FreeBSD) && (${OSVERSION} >= 1400000 || ((${ARCH} != i386) && (${ARCH} != amd64)))
> BROKEN=  it was not tested on your system by the maintainer; you must run self-tests
> .endif
>
> @@ -295,13 +320,22 @@ post-install:
>   # in the regular hierarchy, normally $PREFIX/sbin. Hard links may
>   # crash the install if /usr[/local] is a separate file system from /,
>   # and pkg 1.15.4 can't automatically unroll or install relative symlinks.
> +.if ${FLAVOR} != nobootfsck
>   ${MKDIR} ${STAGEDIR}/sbin
>   ${MV} -f ${STAGEDIR}${PREFIX}/sbin/e2fsck ${STAGEDIR}/sbin/ # from INSTALL_TARGET
>   ${INSTALL_PROGRAM} ${WRKSRC}/fsck_ext2fs ${STAGEDIR}/sbin/  # from port
> - # according to TPH 6.1.1 Handling Symbolic Links, these are to be absolute,
> - # yet stage-qa warns about these on 2020-09-16:
> + # according to TPH 6.1.1 Handling Symbolic Links, these are to be absolute
> + # for the default FLAVOR, yet stage-qa warns about these on 2020-09-16.
> +. if ${FLAVOR} == roothardlinks
> + ${LN} -f ${STAGEDIR}/sbin/fsck_ext2fs ${STAGEDIR}${PREFIX}/sbin/
> + ${LN} -f ${STAGEDIR}/sbin/e2fsck      ${STAGEDIR}${PREFIX}/sbin/
> +. else
>   ${LN} -fs /sbin/fsck_ext2fs ${STAGEDIR}${PREFIX}/sbin/
>   ${LN} -fs /sbin/e2fsck      ${STAGEDIR}${PREFIX}/sbin/
> +. endif
> +.else
> + ${INSTALL_PROGRAM} ${WRKSRC}/fsck_ext2fs ${STAGEDIR}${PREFIX}/sbin/
> +.endif
>   # these are made hardlinks to symlinks - -P avoids following them to /sbin:
>   ${LN} -fP ${STAGEDIR}${PREFIX}/sbin/e2fsck ${STAGEDIR}${PREFIX}/sbin/fsck.ext2
>   ${LN} -fP ${STAGEDIR}${PREFIX}/sbin/e2fsck ${STAGEDIR}${PREFIX}/sbin/fsck.ext3
> diff --git a/sysutils/e2fsprogs/pkg-install b/sysutils/e2fsprogs/pkg-install
> index 25259ebfc8a3..34a21e9364f0 100644
> --- a/sysutils/e2fsprogs/pkg-install
> +++ b/sysutils/e2fsprogs/pkg-install
> @@ -6,23 +6,6 @@ MODE="$2" # PRE-INSTALL, POST-INSTALL, DEINSTALL, POST-DEINSTALL
>
> case "$MODE" in
> POST-INSTALL)
> - # try to replace the e2fsck and its wrapper, fsck_ext2fs,
> - # symbolic links by hard links if possible (pkg ships them as symlinks)
> - d1=${PKG_ROOTDIR}/sbin/ ;              dev1=$(stat -Lf %Xd "$d1")
> - d2=${PKG_ROOTDIR}${PKG_PREFIX}/sbin/ ; dev2=$(stat -Lf %Xd "$d2")
> - if [ "$dev1" = "$dev2" ] && [ "$(realpath "$d1")" != "$(realpath "$d2")" ]; then
> -   for i in e2fsck fsck_ext2fs ; do
> -     ln -fhP ${d1}${i} ${d2}${i}
> -   done
> -   for i in ext2 ext3 ext4 ; do
> -     ln -fhP ${d2}e2fsck ${d2}fsck.$i
> -   done
> -   echo >&2 "NOTE: replaced e2fsprogs symlinks by hard links, will recalculate checksums with a root at(1) job."
> -   pid=$$
> -   echo /bin/sh -c "\"set -x ; { while sleep 2 </dev/null ; do kill -0 $pid || break ; done ; \
> -     pkg check -r "${PKG_NAME}" ; } </dev/null 2>&1 | logger -t pkg.e2fsprogs.POST-INSTALL \"" \
> -     | at now
> - fi
>   #
>   # install configuration file and update config files from
>   # old "ext4dev" to current "ext4" name.
> @@ -71,14 +54,14 @@ DEINSTALL)
>     ${PKG_PREFIX}/etc/mke2fs.conf.dist
>   then
>     rm -f ${PKG_PREFIX}/etc/mke2fs.conf
> - else
> + elif [ "_${PKG_UPGRADE-upgrade}" = _upgrade ] ; then
>     echo "If and only if you are deleting e2fsprogs forever,"
>     echo "remember to delete ${PKG_PREFIX}/etc/mke2fs.conf."
>   fi
>   # e2fsck.conf is no longer part of the distribution, but still supported,
>   # => no pkg-list @sample line possible
>   #    and no reference e2fsck.conf.sample or e2fsck.conf.dist is available
> - if test -f ${PKG_PREFIX}/etc/e2fsck.conf
> + if test -f ${PKG_PREFIX}/etc/e2fsck.conf -a "_${PKG_UPGRADE-upgrade}" = _upgrade
>   then
>     echo "If and only if you are deleting e2fsprogs forever,"
>     echo "remember to delete ${PKG_PREFIX}/etc/e2fsck.conf."
> diff --git a/sysutils/e2fsprogs/pkg-plist b/sysutils/e2fsprogs/pkg-plist
> index b479a627310b..83a2baf4e486 100644
> --- a/sysutils/e2fsprogs/pkg-plist
> +++ b/sysutils/e2fsprogs/pkg-plist
> @@ -1,5 +1,5 @@
> -/sbin/e2fsck
> -/sbin/fsck_ext2fs
> +%%ROOTSBIN%%/sbin/e2fsck
> +%%ROOTSBIN%%/sbin/fsck_ext2fs
> bin/chattr
> bin/e2fsprogs-compile_et
> %%FUSEFS%%bin/fuse2fs


More information about the dev-commits-ports-main mailing list