I think you have this wrong. If someone is operating in the install media, and manually adjusting their disk, and they don't know the commands they need, where are they going to find the instructions?
In 1997, we added the embedded manual pages to fdisk (inside the 'manual' command) and disklabel (the 'M' command) specifically for users who encounter this problem. The '?' command shows you that you can see the manual, and then you can use "M" to get a complete manual. We don't know how much it is used, but it was added *SPECIFICALLY* for the install media usage case. Perhaps in the past we had an architecture that didn't fit, and this NOMAN logic was added?? But it fits today. Why are you assuming it should be deleted by default in the install media? Like wow, the install media scenario is the ONE PLACE embedded manuals are useful! If you aren't on the install media, you don't NEED the embedded manuals, you can type ^Z man disklabel instead! Klemens Nanni <[email protected]> wrote: > Turns out all install media ship full copies of those two manuals due to > what can be described like a makefile TOCTOU. > > In /usr/src/distrib/special, Makefile.inc sets NOMAN=1 but */Makefile > only includes it in the very end through <bsd.prog.mk>. > > fdisk and disklabel have NOMAN logic before that include, so they don't > see it set yet and include the whole thing: > > $ make -C fdisk manual.o > mk -C fdisk manual.o > mandoc -Tascii > /usr/src/distrib/special/fdisk/../../../sbin/fdisk/fdisk.8 > fdisk.cat8 > (echo 'const unsigned char manpage[] = {'; cat fdisk.cat8 | gzip -9c | > hexdump -ve '"0x" 1/1 "%02x,"'; echo '};'; echo 'const int manpage_sz = > sizeof(manpage);') > manual.c > cc -O2 -pipe -DHAS_MBR -fno-pie -Oz -fno-stack-protector > -fno-unwind-tables -fno-asynchronous-unwind-tables -MD -MP -c manual.c > $ size fdisk/obj/manual.o > text data bss dec hex > 3552 0 0 3552 de0 > > Forcing it on the command line yields the desired behaviour: > $ make -C fdisk NOMAN=1 manual.o > (echo 'const unsigned char manpage[] = {'; echo 'no manual' | gzip -9c > | hexdump -ve '"0x" 1/1 "%02x,"'; echo '};'; echo 'const int manpage_sz = > sizeof(manpage);') > manual.c > cc -O2 -pipe -DHAS_MBR -fno-pie -Oz -fno-stack-protector > -fno-unwind-tables -fno-asynchronous-unwind-tables -MD -MP -c manual.c > $ size fdisk/obj/manual.o > text data bss dec hex > 36 0 0 36 24 > > Same for disklabel, size before/after: > text data bss dec hex > 6160 0 0 6160 1810 > 36 0 0 36 24 > > I've confirmed this through an amd64 snapshots bsd.rd where I paged > through disklabel(8) via the 'M' command... > > Here's a minimal diff to highlight this non-obvious issue and avoid > reshuffling, i.e. cut down on differences with /usr/src/sbin/*/Makefile. > > Haven't built ramdisks yet to see the final size decrease, but everyone > should be happy with this. > > OK? > > > Index: disklabel/Makefile > =================================================================== > RCS file: /cvs/src/distrib/special/disklabel/Makefile,v > retrieving revision 1.13 > diff -u -p -r1.13 Makefile > --- disklabel/Makefile 21 Sep 2021 18:36:09 -0000 1.13 > +++ disklabel/Makefile 25 Aug 2022 18:34:31 -0000 > @@ -10,6 +10,8 @@ CLEANFILES += disklabel.cat8 manual.c > > .include <bsd.own.mk> > > +# XXX set in ../Makefile.inc already but only pulled in by <bsd.prog.mk> > +NOMAN = 1 > .ifdef NOMAN > manual.c: > (echo 'const unsigned char manpage[] = {'; \ > Index: fdisk/Makefile > =================================================================== > RCS file: /cvs/src/distrib/special/fdisk/Makefile,v > retrieving revision 1.6 > diff -u -p -r1.6 Makefile > --- fdisk/Makefile 23 May 2022 16:58:11 -0000 1.6 > +++ fdisk/Makefile 25 Aug 2022 18:34:15 -0000 > @@ -23,6 +23,8 @@ CLEANFILES += fdisk.cat8 manual.c > > .include <bsd.own.mk> > > +# XXX set in ../Makefile.inc already but only pulled in by <bsd.prog.mk> > +NOMAN = 1 > .ifdef NOMAN > manual.c: > (echo 'const unsigned char manpage[] = {'; \ >
