From: Jonathan Gray Subject: Re: games/nblood diff for stdio opaque To: YASUOKA Masahiko Cc: tb@openbsd.org, ports@openbsd.org Date: Tue, 15 Jul 2025 18:06:57 +1000 On Tue, Jul 15, 2025 at 02:18:19PM +0900, YASUOKA Masahiko wrote: > On Tue, 15 Jul 2025 11:50:43 +1000 > Jonathan Gray wrote: > > On Tue, Jul 15, 2025 at 10:23:00AM +0900, YASUOKA Masahiko wrote: > >> Hi, > >> > >> A fix like the diff following is needed after stdio opaque diff. The > >> diff can be applied in advance. > >> > >> ok? > > > > Shouldn't this also change REVISION? > > Yes. The diffs cause a functionally change to the program. > I updated the diff > > > The nblood code is derived from eduke32. games/eduke32 will need the > > same patch. > > Thanks for pointing this out. > The diff is updated. > > >> > >> Index: games/nblood/patches/patch-source_build_src_baselayer_cpp > >> =================================================================== > >> RCS file: games/nblood/patches/patch-source_build_src_baselayer_cpp > >> diff -N games/nblood/patches/patch-source_build_src_baselayer_cpp > >> --- /dev/null 1 Jan 1970 00:00:00 -0000 > >> +++ games/nblood/patches/patch-source_build_src_baselayer_cpp 15 Jul 2025 01:17:29 -0000 > >> @@ -0,0 +1,19 @@ > >> +Can't substitute a FILE object to std{out,err}. > >> + > >> +Index: source/build/src/baselayer.cpp > >> +--- source/build/src/baselayer.cpp.orig > >> ++++ source/build/src/baselayer.cpp > >> +@@ -872,9 +872,11 @@ void maybe_redirect_outputs(void) > >> + if (fp) > >> + { > >> + setvbuf(fp, 0, _IONBF, 0); > >> +- *stdout = *fp; > >> +- *stderr = *fp; > >> + } > >> ++ > >> ++ fp = freopen("stdout.txt", "w", stderr); > > > > It seems strange to not open "stderr.txt" here. > > Yes, it does > > > stdout.txt 2>&1 > > stderr is also written to "stdout.txt" > > > The patch maintains the old behaviour, so likely fine. > > > >> ++ if (fp) > >> ++ setvbuf(fp, 0, _IONBF, 0); > >> + #endif > >> + } > >> + > >> > >> > > ok? Both ports continue to build and run with this patch. To force the stdout.txt path for testing, I had to set EDUKE32_LOGSTDOUT=TRUE ok jsg@ > > Index: games/nblood/Makefile > =================================================================== > RCS file: /cvs/ports/games/nblood/Makefile,v > diff -u -p -r1.15 Makefile > --- games/nblood/Makefile 30 Jan 2025 06:15:05 -0000 1.15 > +++ games/nblood/Makefile 15 Jul 2025 04:58:22 -0000 > @@ -1,7 +1,7 @@ > COMMENT = reverse-engineered ports of Build games > > DISTNAME = nblood-1.01.20231020 > -REVISION = 1 > +REVISION = 2 > > GH_ACCOUNT = nukeykt > GH_PROJECT = NBlood > Index: games/nblood/patches/patch-source_build_src_baselayer_cpp > =================================================================== > RCS file: games/nblood/patches/patch-source_build_src_baselayer_cpp > diff -N games/nblood/patches/patch-source_build_src_baselayer_cpp > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ games/nblood/patches/patch-source_build_src_baselayer_cpp 15 Jul 2025 04:58:22 -0000 > @@ -0,0 +1,19 @@ > +Can't substitute a FILE object to std{out,err} if FILE is an opaque. > + > +Index: source/build/src/baselayer.cpp > +--- source/build/src/baselayer.cpp.orig > ++++ source/build/src/baselayer.cpp > +@@ -872,9 +872,11 @@ void maybe_redirect_outputs(void) > + if (fp) > + { > + setvbuf(fp, 0, _IONBF, 0); > +- *stdout = *fp; > +- *stderr = *fp; > + } > ++ > ++ fp = freopen("stdout.txt", "w", stderr); > ++ if (fp) > ++ setvbuf(fp, 0, _IONBF, 0); > + #endif > + } > + > Index: games/eduke32/Makefile > =================================================================== > RCS file: /cvs/ports/games/eduke32/Makefile,v > diff -u -p -r1.34 Makefile > --- games/eduke32/Makefile 29 Jan 2025 17:35:24 -0000 1.34 > +++ games/eduke32/Makefile 15 Jul 2025 04:58:22 -0000 > @@ -5,7 +5,7 @@ DISTNAME = eduke32_src_${RDATE}-${RTAG} > PKGNAME = eduke32-2.0.0.${RTAG:C/-.*$//} > EXTRACT_SUFX = .tar.xz > CATEGORIES = games x11 > -REVISION = 2 > +REVISION = 3 > > HOMEPAGE = https://www.eduke32.com/ > > Index: games/eduke32/patches/patch-source_build_src_baselayer_cpp > =================================================================== > RCS file: games/eduke32/patches/patch-source_build_src_baselayer_cpp > diff -N games/eduke32/patches/patch-source_build_src_baselayer_cpp > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ games/eduke32/patches/patch-source_build_src_baselayer_cpp 15 Jul 2025 04:58:22 -0000 > @@ -0,0 +1,19 @@ > +Can't substitute a FILE object to std{out,err} if FILE is an opaque. > + > +Index: source/build/src/baselayer.cpp > +--- source/build/src/baselayer.cpp.orig > ++++ source/build/src/baselayer.cpp > +@@ -589,9 +589,11 @@ void maybe_redirect_outputs(void) > + if (fp) > + { > + setvbuf(fp, 0, _IONBF, 0); > +- *stdout = *fp; > +- *stderr = *fp; > + } > ++ > ++ fp = freopen("stdout.txt", "w", stderr); > ++ if (fp) > ++ setvbuf(fp, 0, _IONBF, 0); > + #endif > + } > + > >