Eric Blake | 11 May 2010 16:06
Picon
Favicon
Gravatar

[PATCH] Mention how to silence program probes.

* doc/autoconf.texi (File Descriptors): Document how to silence a
program probe.

Signed-off-by: Eric Blake <eblake <at> redhat.com>
---

This recently popped up on the libvirt list; while bash, dash,
ksh, and zsh are all silent, Solaris and FreeBSD 8.0 /bin/sh
are noisy and check for missing programs before redirections.

 ChangeLog         |    6 ++++++
 doc/autoconf.texi |   12 ++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 454f5aa..8b4c0f4 100644
--- a/ChangeLog
+++ b/ChangeLog
 <at>  <at>  -1,3 +1,9  <at>  <at> 
+2010-05-11  Eric Blake  <eblake <at> redhat.com>
+
+	Mention how to silence program probes.
+	* doc/autoconf.texi (File Descriptors): Document how to silence a
+	program probe.
+
 2010-04-26  Ralf Wildenhues  <Ralf.Wildenhues <at> gmx.de>

 	Error and warning message formatting cleanups.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index d6a08bc..2873578 100644
(Continue reading)

Ralf Wildenhues | 11 May 2010 22:08
Picon
Picon

Re: [PATCH] Mention how to silence program probes.

Hi Eric, and thanks for the patch.  A couple of small nits:

* Eric Blake wrote on Tue, May 11, 2010 at 04:06:00PM CEST:
> --- a/doc/autoconf.texi
> +++ b/doc/autoconf.texi
>  <at>  <at>  -14793,6 +14793,18  <at>  <at>  File Descriptors
>   <at> samp{: `cd /zorglub` 2>/dev/null} expect the error message to
>  escape, while  <at> samp{: `cd /zorglub 2>/dev/null`} works properly.
> 
> +On the other hand, some shells, such as Solaris or FreeBSD
> + <at> command{/bin/sh}, warn about missing programs before performing
> +redirections.  Therefore, to silently check whether a program exists, it
> +is necessary to perform redirections on a subshell:
> +
> + <at> example
> +$  <at> kbd{/bin/sh -c 'nosuch 2>/dev/null}

Missing closing '.

> +nosuch: not found
> +$  <at> kbd{/bin/sh -c '(nosuch) 2>/dev/null}

Likewise.

> +$  <at> kbd{bash -c 'nosuch 2>/dev/null'}
> + <at> end example

Cheers,
Ralf

(Continue reading)

Eric Blake | 11 May 2010 22:14
Picon
Favicon
Gravatar

Re: [PATCH] Mention how to silence program probes.

On 05/11/2010 02:08 PM, Ralf Wildenhues wrote:
>> + <at> example
>> +$  <at> kbd{/bin/sh -c 'nosuch 2>/dev/null}
> 
> Missing closing '.

Oops; thanks for spotting it, and it's now fixed.

--

-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Eric Blake | 12 May 2010 16:40
Picon
Favicon
Gravatar

[PATCH] Document the grep workaround.

* doc/autoconf.texi (Limitations of Usual Tools) <grep>: Document
the bug.

Signed-off-by: Eric Blake <eblake <at> redhat.com>
---
 ChangeLog         |    6 ++++++
 doc/autoconf.texi |    4 ++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6a614bc..fd7d068 100644
--- a/ChangeLog
+++ b/ChangeLog
 <at>  <at>  -1,3 +1,9  <at>  <at> 
+2010-05-12  Eric Blake  <eblake <at> redhat.com>
+
+	Document the grep workaround.
+	* doc/autoconf.texi (Limitations of Usual Tools) <grep>: Document
+	the bug.
+
 2010-05-12  Mark Hessling  <mark <at> rexx.org>  (tiny change)

 	Work around QNX4 grep bug.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 39e11a5..ff62eac 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
 <at>  <at>  -17829,6 +17829,10  <at>  <at>  Limitations of Usual Tools
 doesn't exist) of  <at> code{grep} to  <at> file{/dev/null}.  Check the exit
 status of  <at> code{grep} to determine whether it found a match.
(Continue reading)

Paolo Bonzini | 19 May 2010 10:53
Picon
Gravatar

Re: [PATCH] Document the grep workaround.


> +The QNX4 implementation fails to count lines with  <at> code{grep -c '$'},
> +but works with  <at> code{grep -c '^'}.  Another alternative for counting
> +lines is to use  <at> code{wc -l}.

I think the most portable way to count lines is "sed -n '$='".

Paolo

Ralf Wildenhues | 20 May 2010 20:35
Picon
Picon

Re: [PATCH] Document the grep workaround.

Hi Paolo,

* Paolo Bonzini wrote on Wed, May 19, 2010 at 10:53:19AM CEST:
> 
> >+The QNX4 implementation fails to count lines with  <at> code{grep -c '$'},
> >+but works with  <at> code{grep -c '^'}.  Another alternative for counting
> >+lines is to use  <at> code{wc -l}.
> 
> I think the most portable way to count lines is "sed -n '$='".

Is there a decided advantage over 'wc -l' such as allowed maximum or so?

Thanks,
Ralf

Paolo Bonzini | 20 May 2010 22:34
Picon
Gravatar

Re: [PATCH] Document the grep workaround.

On Thu, May 20, 2010 at 20:35, Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de> wrote:
> Hi Paolo,
>
> * Paolo Bonzini wrote on Wed, May 19, 2010 at 10:53:19AM CEST:
>>
>> >+The QNX4 implementation fails to count lines with  <at> code{grep -c '$'},
>> >+but works with  <at> code{grep -c '^'}.  Another alternative for counting
>> >+lines is to use  <at> code{wc -l}.
>>
>> I think the most portable way to count lines is "sed -n '$='".
>
> Is there a decided advantage over 'wc -l' such as allowed maximum or so?

No, but wc is not including in the GNU coding standards' list of
portable utilities for configure/make.

Paolo

Eric Blake | 20 May 2010 23:06
Picon
Favicon
Gravatar

Re: [PATCH] Document the grep workaround.

On 05/20/2010 02:34 PM, Paolo Bonzini wrote:
>>>> +but works with  <at> code{grep -c '^'}.  Another alternative for counting
>>>> +lines is to use  <at> code{wc -l}.
>>>
>>> I think the most portable way to count lines is "sed -n '$='".
>>
>> Is there a decided advantage over 'wc -l' such as allowed maximum or so?
> 
> No, but wc is not including in the GNU coding standards' list of
> portable utilities for configure/make.

Good point.  I'll push this patch shortly:

diff --git i/ChangeLog w/ChangeLog
index f7f50e9..fc0c3cc 100644
--- i/ChangeLog
+++ w/ChangeLog
 <at>  <at>  -1,3 +1,10  <at>  <at> 
+2010-05-20  Eric Blake  <eblake <at> redhat.com>
+
+	Mention another line-counting alternative.
+	* doc/autoconf.texi (Limitations of Usual Tools) <grep>: Mention
+	how to use sed to count lines.
+	Suggested by Paolo Bonzini.
+
 2010-02-25  Eric Blake  <eblake <at> redhat.com>

 	Properly quote AC_PREREQ during autoupdate.
diff --git i/doc/autoconf.texi w/doc/autoconf.texi
index 51fe0f4..1c85191 100644
(Continue reading)

Stefano Lattarini | 25 May 2010 17:15
Picon

[PATCH] Fix minor inconsistency in documentation of AC_{LINK, RUN}_IFELSE.

A nitpicking consistency patch.

* doc/autoconf.texi (Runtime) <AC_RUN_IFELSE>: Suggest to use
`./conftest$ac_exeext' rather than `./conftest$EXEEXT' to run
the compiled program.  This is done for consistency with the
documentation of AC_LINK_IFELSE.

Regards,
    Stefano
Eric Blake | 25 May 2010 17:22
Picon
Favicon
Gravatar

Re: [PATCH] Fix minor inconsistency in documentation of AC_{LINK, RUN}_IFELSE.

On 05/25/2010 09:15 AM, Stefano Lattarini wrote:
> A nitpicking consistency patch.
> 
> * doc/autoconf.texi (Runtime) <AC_RUN_IFELSE>: Suggest to use
> `./conftest$ac_exeext' rather than `./conftest$EXEEXT' to run
> the compiled program.  This is done for consistency with the
> documentation of AC_LINK_IFELSE.

I'd actually rather go the other way - it is better to document external
variables like $EXEEXT than to expose internal details like $ac_exeext;
so it seems like AC_LINK_IFELSE should be the subject of the patch.

--

-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


Gmane