[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: awk and fflush()/-W interactive
- To: herbstluftwm _minus_ devel _at_ lists _dot_ sourceforge _dot_ net
- Subject: Re: awk and fflush()/-W interactive
- From: Mono <mono _at_ posteo _dot_ de>
- Date: Fri, 16 Aug 2013 08:04:56 +0200
how about having an sed command insert -W interactive during installation, only if mawk is detected?
hmm, just an idea.
On Fri, Aug 16, 2013 at 01:39:29AM +0200, Thorsten Wißmann wrote:
> On Tue, Aug 13, 2013 at 12:57:47PM +0200, Florian Bruhin wrote:
> > This confused some users (at least someone in IRC), because on nearly
> > all awk versions, this will echo something like "option `-W
> > interactive' unrecognized, ignored" to stdout (but still work, because
> > -W interactive and fflush() do the same).
>
> Yes, so keeping it is not a clean solution.
>
> > Out of curiosity, I did some tests to verify which awk supports what:
> >
> > Version -W interactive fflush()
> > ==================================================
> > gawk 3.1.8 ignored (warning) supported
> > gawk 4.1.0 ignored (warning) supported
> > mawk 1.3.4 20130219 supported supported
> > oawk (Solaris) error error
> > awk 19990602 (plan9) ignored (warning) supported
> > busybox v1.21.1 awk ignored (warning) supported
> > awk 20070501 (OS X) ignored (warning) supported
>
> > So there are two possible fixes for the annoying warning on stderr:
> >
> > - Redirect stderr to /dev/null
> >
> > But then, as Thorsten noticed with my bash scripts patch, if
> > anyone really uses an awk which doesn't support fflush(), they
> > won't get an error message, which is suboptimal.
>
> Right, so I don't this is a clean solution.
>
> > - Drop the "-W interactive"
> >
> > According to #awk on Freenode, only mawk and gawk support -W (and
> > gawk only supports -W, not -W interactive) -- and they both also
> > support fflush().
> >
> > To me, it seems "-W interactive" is a mawk-specific way if you're
> > too lazy to fflush() yourself and want linebuffered output.
> >
> > Am I missing anything? Are there any awk versions which DON'T support
> > fflush(), but DO support "-W interactive"? #awk doesn't seem to think
> > so. So IMHO, we could avoid the confusing message and just drop the
> > "-W interactive".
>
> Thanks for examining the compatibility table, so -W interactive looks
> redundant. The "-W interactive" was added by commit 2f095177[1] only
> some months ago, because fflush() was not sufficient on mawk. It was
> reported by Raf Cloeseen[2]. Some say it is a mawk bug, some say it
> isn't; see debian's bug-tracker[3]. The mawk-manpage[4] tells that
> fflush() should work as expected by us. But it doesn't work, so I guess
> we need some ugly workaround.
>
> Regards,
> Thorsten
>
> [1] http://git.cs.fau.de/?p=hlwm;a=commitdiff;h=2f095177
> [2] http://herbstluftwm.org/archive/msg00215.html
> [3] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593504 -- and as
> far as I understand it, fflush() in mawk directly calls the
> low-level fflush but at that point the string has not been written
> yet to the buffer that is flushed. But these are mawk internals, the
> user (i.e. we) shouldn't worry about.
> [4] http://linux.die.net/man/1/mawk
> ------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite!
> It's a free troubleshooting tool designed for production.
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk