Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jun 2024 16:46:14 -0700
From:      Enji Cooper <yaneurabeya@gmail.com>
To:        Shawn Webb <shawn.webb@hardenedbsd.org>
Cc:        =?utf-8?Q?Stefan_E=C3=9Fer?= <se@freebsd.org>, src-committers <src-committers@freebsd.org>, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: 41ee91c64f47 - main - newfs_msdos: fix build on non-FreeBSD systems
Message-ID:  <85B47B24-68AA-4555-9D70-E89FC296ACA0@gmail.com>
In-Reply-To: <yby7q4ygywjeglrngvzdrcwfcdodc2lqw5a4m2lenq4ck7mcet@bror4anr4vny>
References:  <202406040628.4546SJ98088668@gitrepo.freebsd.org> <yby7q4ygywjeglrngvzdrcwfcdodc2lqw5a4m2lenq4ck7mcet@bror4anr4vny>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_C3569A37-6330-4F13-A50F-F6C776FF059D
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_73F0525B-C383-4D28-B2A7-952288DCDFFC"


--Apple-Mail=_73F0525B-C383-4D28-B2A7-952288DCDFFC
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8


> On Jun 4, 2024, at 8:21=E2=80=AFAM, Shawn Webb =
<shawn.webb@hardenedbsd.org> wrote:
>=20
> On Tue, Jun 04, 2024 at 06:28:19AM +0000, Stefan E=C3=9Fer wrote:
>> The branch main has been updated by se:
>>=20
>> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47faaa8131df3cd8a63bdb=
60fa486a
>>=20
>> commit 41ee91c64f47faaa8131df3cd8a63bdb60fa486a
>> Author:     Stefan E=C3=9Fer <se@FreeBSD.org>
>> AuthorDate: 2024-06-04 06:26:09 +0000
>> Commit:     Stefan E=C3=9Fer <se@FreeBSD.org>
>> CommitDate: 2024-06-04 06:26:09 +0000
>>=20
>>    newfs_msdos: fix build on non-FreeBSD systems
>>=20
>>    Disable data area alignment if the build environment does not =
define
>>    PAGE_SIZE (e.g., when building on Linux or macOS).
>>=20
>>    Reported by:    jrtc27
>>    MFC after:      1 week
>> ---
>> sbin/newfs_msdos/mkfs_msdos.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>=20
>> diff --git a/sbin/newfs_msdos/mkfs_msdos.c =
b/sbin/newfs_msdos/mkfs_msdos.c
>> index 423fbbcadcc5..1bca560a59e1 100644
>> --- a/sbin/newfs_msdos/mkfs_msdos.c
>> +++ b/sbin/newfs_msdos/mkfs_msdos.c
>> @@ -571,7 +571,11 @@ mkfs_msdos(const char *fname, const char *dtype, =
const struct msdos_options *op)
>> 	    if (o.align)
>> 		alignto =3D bpb.bpbSecPerClust;
>> 	    else
>> +#ifdef	PAGE_SIZE
>> 		alignto =3D PAGE_SIZE / bpb.bpbBytesPerSec;
>> +#else
>> +	        alignto =3D 1;
>> +#endif
>=20
> Imagine the following:
>=20
> 1. someone builds FreeBSD on Linux or macOS
> 2. that build is deployed
> 3. FreeBSD is rebuilt on that deployment
>=20
> Could the value of alignto be different on step 1 versus step 3?

Hi Shawn,
	Assuming the tool is built for the host, yes it would run into =
the issues you=E2=80=99re describing. If it=E2=80=99s targeting FreeBSD =
though or an OS that allows direct access to PAGE_SIZE, e.g., NetBSD, it =
will use whatever the OS defines for PAGE_SIZE in the appropriate =
headers.
Cheers,
-Enji=

--Apple-Mail=_73F0525B-C383-4D28-B2A7-952288DCDFFC
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: =
after-white-space;"><br><div><blockquote type=3D"cite"><div>On Jun 4, =
2024, at 8:21=E2=80=AFAM, Shawn Webb &lt;shawn.webb@hardenedbsd.org&gt; =
wrote:</div><br class=3D"Apple-interchange-newline"><div><meta =
charset=3D"UTF-8"><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;">On Tue, Jun 04, 2024 at =
06:28:19AM +0000, Stefan E=C3=9Fer wrote:</span><br style=3D"caret-color: =
rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
normal; font-variant-caps: normal; font-weight: 400; letter-spacing: =
normal; text-align: start; text-indent: 0px; text-transform: none; =
white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;"><blockquote type=3D"cite" style=3D"font-family: =
Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: auto; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;">The branch main has been updated by =
se:<br><br>URL: =
https://cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47faaa8131df3cd8a63bdb=
60fa486a<br><br>commit =
41ee91c64f47faaa8131df3cd8a63bdb60fa486a<br>Author: =
&nbsp;&nbsp;&nbsp;&nbsp;Stefan E=C3=9Fer =
&lt;se@FreeBSD.org&gt;<br>AuthorDate: 2024-06-04 06:26:09 =
+0000<br>Commit: &nbsp;&nbsp;&nbsp;&nbsp;Stefan E=C3=9Fer =
&lt;se@FreeBSD.org&gt;<br>CommitDate: 2024-06-04 06:26:09 =
+0000<br><br>&nbsp;&nbsp;&nbsp;newfs_msdos: fix build on non-FreeBSD =
systems<br><br>&nbsp;&nbsp;&nbsp;Disable data area alignment if the =
build environment does not define<br>&nbsp;&nbsp;&nbsp;PAGE_SIZE (e.g., =
when building on Linux or macOS).<br><br>&nbsp;&nbsp;&nbsp;Reported by: =
&nbsp;&nbsp;&nbsp;jrtc27<br>&nbsp;&nbsp;&nbsp;MFC after: =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 =
week<br>---<br>sbin/newfs_msdos/mkfs_msdos.c | 4 ++++<br>1 file changed, =
4 insertions(+)<br><br>diff --git a/sbin/newfs_msdos/mkfs_msdos.c =
b/sbin/newfs_msdos/mkfs_msdos.c<br>index 423fbbcadcc5..1bca560a59e1 =
100644<br>--- a/sbin/newfs_msdos/mkfs_msdos.c<br>+++ =
b/sbin/newfs_msdos/mkfs_msdos.c<br>@@ -571,7 +571,11 @@ mkfs_msdos(const =
char *fname, const char *dtype, const struct msdos_options *op)<br><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>&nbsp;&nbsp;&nbsp;if =
(o.align)<br><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span>alignto =3D bpb.bpbSecPerClust;<br><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>&nbsp;&nbsp;&nbsp;else<br>+#i=
fdef<span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span>PAGE_SIZE<br><span class=3D"Apple-tab-span" style=3D"white-space: =
pre;">	</span><span class=3D"Apple-tab-span" style=3D"white-space: =
pre;">	</span>alignto =3D PAGE_SIZE / =
bpb.bpbBytesPerSec;<br>+#else<br>+<span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;alignto =3D 1;<br>+#endif<br></blockquote><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
12px; font-style: normal; font-variant-caps: normal; font-weight: 400; =
letter-spacing: normal; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: none;"><span =
style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
12px; font-style: normal; font-variant-caps: normal; font-weight: 400; =
letter-spacing: normal; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
display: inline !important;">Imagine the following:</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
12px; font-style: normal; font-variant-caps: normal; font-weight: 400; =
letter-spacing: normal; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: none;"><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
12px; font-style: normal; font-variant-caps: normal; font-weight: 400; =
letter-spacing: normal; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: none;"><span =
style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
12px; font-style: normal; font-variant-caps: normal; font-weight: 400; =
letter-spacing: normal; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
display: inline !important;">1. someone builds FreeBSD on Linux or =
macOS</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;"><span style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;">2. that build is =
deployed</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;"><span style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;">3. FreeBSD is rebuilt on =
that deployment</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Helvetica; font-size: 12px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;"><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Helvetica; font-size: 12px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;"><span style=3D"caret-color: rgb(0, 0, 0); =
font-family: Helvetica; font-size: 12px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;">Could =
the value of alignto be different on step 1 versus step 3?</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
12px; font-style: normal; font-variant-caps: normal; font-weight: 400; =
letter-spacing: normal; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: =
none;"></div></blockquote></div><br><div>Hi Shawn,</div><div><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>Assuming =
the tool is built for the host, yes it would run into the issues =
you=E2=80=99re describing. If it=E2=80=99s targeting FreeBSD though or =
an OS that allows direct access to PAGE_SIZE, e.g., NetBSD, it will use =
whatever the OS defines for PAGE_SIZE in the appropriate =
headers.</div><div>Cheers,</div><div>-Enji</div></body></html>=

--Apple-Mail=_73F0525B-C383-4D28-B2A7-952288DCDFFC--

--Apple-Mail=_C3569A37-6330-4F13-A50F-F6C776FF059D
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEkHfexGRJ3gYRdA2gGpE5DjPsNJgFAmZg+MYACgkQGpE5DjPs
NJgVZw//f4jLnazWQNSST4wnOzyrxH0FtwtekOFOrpqyYYCXjdC4nxNUBWAPe75J
x+SMcbeG3k3Tq889FYbOc9YYFyOkYxPLf2xPAYSU6Vfu2gy6Q2yIAtsYiugsx1SV
RKLwhBJO1n0E8bABj9VMlrZrfcmxcl+aIa7sS+1m1xMi40kchgRVwjDUId1AcUf+
6XAn9TiRnB6J454CH7c5oErQPgzL6/23354Q50FryC3K/bW+BGg7Ia5AU6Yi7Dhz
P+3RAZ0nz14Is/8tndk71vsqWMbcsUg3L0U8aoHATvPyppjRcX2F8AxOk2JjQq7/
jLO7wBjZLK1RCSDvBLt/DYdCJngkOU3p/mWNQosS5Jpk4hR/QSqFY0VSaJh75Vqb
AU0asmHFWGEvoALFIZwli1NBOSDvTZ7UztnIxRiPbkQCP+SfiwVEC855ULEBXsPD
MvtyMob60+ycsdgm5UXUHsX4IJ16AEPHCLE8KDc1NGNe+iygtHp1yhxi/Gmf9DHf
YbB3hJBYO3Yxr+Nj01CLqreV4SeSxhhcg2mUVCQlu4SaK06aH3ZexnLK7qgGUowh
Xt0lYxxuPV4Q7J11oSueFkUG83hTUnsj8Bp6dORqq0ds/agO0q9kKATdIR92BLE4
6KQXdSJjydHE2GVHq4Jkkrn9XFv9ifOAe0fs3bXp7xDGlB3G5h8=
=lp/s
-----END PGP SIGNATURE-----

--Apple-Mail=_C3569A37-6330-4F13-A50F-F6C776FF059D--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?85B47B24-68AA-4555-9D70-E89FC296ACA0>