The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] OT: Need help from a *BSD guru
@ 2018-01-22  8:10 arnold
  2018-01-22 14:36 ` arnold
  0 siblings, 1 reply; 5+ messages in thread
From: arnold @ 2018-01-22  8:10 UTC (permalink / raw)


Hi.

Can a modern BSD guru please contact me off-list?  I have a set of related
tests in the gawk test suite that consistently fail on just about every
*BSD system.  It has me stumped, and I'd like to see these tests working
if possible.

(They've been not working for quite a while. That I get no complaints
from BSD users tells me that gawk isn't popular in that world, but that's
another story. :-)

Thanks,

Arnold


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [TUHS] OT: Need help from a *BSD guru
  2018-01-22  8:10 [TUHS] OT: Need help from a *BSD guru arnold
@ 2018-01-22 14:36 ` arnold
  2018-01-22 18:03   ` Ian Zimmerman
  2018-01-22 19:36   ` arnold
  0 siblings, 2 replies; 5+ messages in thread
From: arnold @ 2018-01-22 14:36 UTC (permalink / raw)


Hi All.

Looks like I solved my problem on my own; thanks to everyone who
replied privately.  I will send a short note detailing the issue 
a little later.

Thanks!

Arnold

arnold at skeeve.com wrote:

> Hi.
>
> Can a modern BSD guru please contact me off-list?  I have a set of related
> tests in the gawk test suite that consistently fail on just about every
> *BSD system.  It has me stumped, and I'd like to see these tests working
> if possible.
>
> (They've been not working for quite a while. That I get no complaints
> from BSD users tells me that gawk isn't popular in that world, but that's
> another story. :-)
>
> Thanks,
>
> Arnold


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [TUHS] OT: Need help from a *BSD guru
  2018-01-22 14:36 ` arnold
@ 2018-01-22 18:03   ` Ian Zimmerman
  2018-01-22 19:07     ` arnold
  2018-01-22 19:36   ` arnold
  1 sibling, 1 reply; 5+ messages in thread
From: Ian Zimmerman @ 2018-01-22 18:03 UTC (permalink / raw)


On 2018-01-22 07:36, arnold at skeeve.com wrote:

> Looks like I solved my problem on my own; thanks to everyone who
> replied privately.  I will send a short note detailing the issue 
> a little later.

Probably an unnecessary reminder, but could you post about it (the
problem and the solution) to the Usenet newsgroup comp.lang.awk as well?
Thanks.

-- 
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet, fetch the TXT record for the domain.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [TUHS] OT: Need help from a *BSD guru
  2018-01-22 18:03   ` Ian Zimmerman
@ 2018-01-22 19:07     ` arnold
  0 siblings, 0 replies; 5+ messages in thread
From: arnold @ 2018-01-22 19:07 UTC (permalink / raw)


Ian Zimmerman <itz at very.loosely.org> wrote:

> On 2018-01-22 07:36, arnold at skeeve.com wrote:
>
> > Looks like I solved my problem on my own; thanks to everyone who
> > replied privately.  I will send a short note detailing the issue 
> > a little later.
>
> Probably an unnecessary reminder, but could you post about it (the
> problem and the solution) to the Usenet newsgroup comp.lang.awk as well?
> Thanks.

It's totally a C issue; it merely came up in the context of gawk.

And I unsubscribed from comp.lang.awk a year or so ago. My blood
pressure has been considerably lower since doing so. :-)

Thanks,

Arnold


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [TUHS] OT: Need help from a *BSD guru
  2018-01-22 14:36 ` arnold
  2018-01-22 18:03   ` Ian Zimmerman
@ 2018-01-22 19:36   ` arnold
  1 sibling, 0 replies; 5+ messages in thread
From: arnold @ 2018-01-22 19:36 UTC (permalink / raw)


The problem had to do with the "inplace" extension for gawk that enables
in-place editing of files, ala perl or GNU sed -i. On BSD systems,
I was getting failures from the test suite. E.g., on a regular system,
inplace1.ok looks like:

-----------------------
before
gawk: inplace:47: warning: inplace_begin: disabling in-place editing for invalid FILENAME `-'
stdin start
is bar replaced?
stdin end
after
-----------------------

On a BSD system, I get:

-----------------------
before
gawk: inplace:47: warning: inplace_begiafter
abling in-place editing for invalid FILENAME `-'
stdin start
is bar replaced?
stdin end
-----------------------

There's some kind of buffering problem going on. The problem only
occurs when stdout and stderr are redirected to the same file:

	command line here > _out 2>&1

I tried adding all kinds of calls to fflush in all kinds of places,
but no luck. Finally, I had an "aha!" moment (an epiphany, if I'm using
the expensive word correctly :-), and made this change:

diff --git a/main.c b/main.c
index 55983789..f505c71f 100644
--- a/main.c
+++ b/main.c
@@ -246,6 +246,10 @@ main(int argc, char **argv)
 	if ((cp = getenv("GAWK_LOCALE_DIR")) != NULL)
 		locale_dir = cp;
 
+	int flags = fcntl(fileno(stderr), F_GETFL, NULL);
+	flags |= O_APPEND;
+	(void) fcntl(fileno(stderr), F_SETFL, flags);
+
 #if defined(LOCALEDEBUG)
 	initial_locale = locale;
 #endif

Forching stderr to be in append mode did the trick. WHY does that
make it work? Beats me. It's not needed on any other system.

Adventures In C Programming ...

Thanks,

Arnold




arnold at skeeve.com wrote:

> Hi All.
>
> Looks like I solved my problem on my own; thanks to everyone who
> replied privately.  I will send a short note detailing the issue 
> a little later.
>
> Thanks!
>
> Arnold


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-22 19:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-22  8:10 [TUHS] OT: Need help from a *BSD guru arnold
2018-01-22 14:36 ` arnold
2018-01-22 18:03   ` Ian Zimmerman
2018-01-22 19:07     ` arnold
2018-01-22 19:36   ` arnold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).