Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Jul 2023 01:18:02 +0100
From:      Jessica Clarke <jrtc27@freebsd.org>
To:        Martin Matuska <mm@FreeBSD.org>
Cc:        "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Subject:   Re: git: e64780fbc394 - main - xinstall: do not use copy_file_range(2) when BOOTSTRAPPING
Message-ID:  <471FD215-B307-4116-9E92-4D84D6FB2B66@freebsd.org>
In-Reply-To: <202307082348.368Nm3TN074666@gitrepo.freebsd.org>
References:  <202307082348.368Nm3TN074666@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 9 Jul 2023, at 00:48, Martin Matuska <mm@FreeBSD.org> wrote:
>=20
> The branch main has been updated by mm:
>=20
> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3De64780fbc394b10581e50a850cc06c1c=
12a8e4f9
>=20
> commit e64780fbc394b10581e50a850cc06c1c12a8e4f9
> Author:     Martin Matuska <mm@FreeBSD.org>
> AuthorDate: 2023-07-08 23:24:38 +0000
> Commit:     Martin Matuska <mm@FreeBSD.org>
> CommitDate: 2023-07-08 23:25:23 +0000
>=20
>    xinstall: do not use copy_file_range(2) when BOOTSTRAPPING
>=20
>    Reported by:    arichardson
> ---
> usr.bin/xinstall/Makefile   | 5 +++++
> usr.bin/xinstall/xinstall.c | 4 ++++
> 2 files changed, 9 insertions(+)
>=20
> diff --git a/usr.bin/xinstall/Makefile b/usr.bin/xinstall/Makefile
> index 9969ef104e98..3b49cb39d27a 100644
> --- a/usr.bin/xinstall/Makefile
> +++ b/usr.bin/xinstall/Makefile
> @@ -17,6 +17,11 @@ CFLAGS+=3D -I${SRCTOP}/lib/libnetbsd
> LIBADD=3D md
> CFLAGS+=3D -DWITH_MD5 -DWITH_RIPEMD160
>=20
> +.ifdef BOOTSTRAPPING
> +# For the bootstrap we disable copy_file_range()
> +CFLAGS+=3D -DBOOTSTRAP_XINSTALL

If the bootstrap xinstall is allowed to use copy_file_range on FreeBSD
(i.e. it=E2=80=99s guaranteed to exist) this is overly restrictive and =
should
be:

.if defined(BOOTSTRAPPING) && ${.MAKE.OS} !=3D "FreeBSD"

> +.endif
> +
> HAS_TESTS=3D
> SUBDIR.${MK_TESTS}+=3D tests
>=20
> diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c
> index 8dace862ef1e..6c269bbb5d91 100644
> --- a/usr.bin/xinstall/xinstall.c
> +++ b/usr.bin/xinstall/xinstall.c
> @@ -1300,7 +1300,9 @@ copy(int from_fd, const char *from_name, int =
to_fd, const char *to_name,
> static size_t bufsize;
> int nr, nw;
> int serrno;
> +#ifndef BOOTSTRAP_XINSTALL
> ssize_t ret;
> +#endif
> char *p;
> int done_copy;
> DIGEST_CTX ctx;
> @@ -1311,6 +1313,7 @@ copy(int from_fd, const char *from_name, int =
to_fd, const char *to_name,
> if (lseek(to_fd, (off_t)0, SEEK_SET) =3D=3D (off_t)-1)
> err(EX_OSERR, "lseek: %s", to_name);
>=20
> +#ifndef BOOTSTRAP_XINSTALL
> /* Try copy_file_range() if no digest is requested */
> if (digesttype =3D=3D DIGEST_NONE) {
> ret =3D 1;
> @@ -1331,6 +1334,7 @@ copy(int from_fd, const char *from_name, int =
to_fd, const char *to_name,
> /* Fall back */
> }
>=20
> +#endif

This looks to be in the wrong place wrt whitespace?

Jess

> digest_init(&ctx);
>=20
> done_copy =3D 0;




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?471FD215-B307-4116-9E92-4D84D6FB2B66>