bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] {print,}env -0


From: Jim Meyering
Subject: Re: [RFC] {print,}env -0
Date: Wed, 28 Oct 2009 12:56:07 +0100

Eric Blake wrote:
> According to Jim Meyering on 10/27/2009 12:07 PM:
>>>> Yes, now I'm in favor of this, too.
>>> This patch implements the option; I'm still working on developing a test
>>> (comparing binary output takes a bit more effort) before I will commit
>>> anything, but thought I'd at least get the review started.
>> ...
>>
>>> diff --git a/tests/misc/printenv b/tests/misc/printenv
>> ...
>>> +prog="$abs_top_builddir/src/printenv"
>>
>> I've been switching to the use of "env -- prog_name",
>> rather than $abs_name_of_prog.
>
> Done.
>
>>>
>>> +   -0
>>> +   --null
>>> +        When no program is specified, output environment information
>>> +        separated by nul bytes rather than newlines.
>>
>> I have mixed feelings about these comments.
>> I certainly wouldn't add them when writing from scratch --
>> that sort of info belongs in documentation, not in comments.
>> If you add the new entry, please mention "terminated", not "separated",
>> and spell it as "NUL", not "nul".
>>
>> I've just checked the documentation, and see it provides no examples.
>> So the five examples in env.c need to move to coreutils.texi.
>> Fixing that is now on my list of 5-10-minute tasks ;-)
>> but anyone else is welcome to do it, too.
>>
>> Thanks!
>
> I went ahead and added one more patch to my queue (shown below), then pushed.
>
> Meanwhile, I just noticed the following unusual behavior:
>
> $ env a=b=c printenv a=b
> c
> $ env a=b=c tcsh -c 'printenv a=b'
> c

And to add to the fun, on Solaris 10 I see this baloney:

    $ /bin/env a=b=c /usr/ucb/printenv a=b
    b=c


BTW, I had to make small changes to doc/Makefile.am and
doc/coreutils.texi to avoid new "make check" failures:

>From 6594193ca7d69916ed3eb7a9d23343b8a6d3f7fd Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 28 Oct 2009 08:30:50 +0100
Subject: [PATCH 1/6] doc: avoid failing "make check"

* doc/coreutils.texi (env invocation): s/builtin/built-in/
---
 doc/coreutils.texi |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 9b9f73b..5ce26e7 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -14467,8 +14467,8 @@ env invocation
 @item
 Run @command{foo} with the environment containing @samp{LOGNAME=rms},
 @samp{EDITOR=emacs}, and @samp{PATH=.:/gnubin:/hacks}, and guarantees
-that @command{foo} was found in the file system rather than a shell
-builtin.
+that @command{foo} was found in the file system rather than as a shell
+built-in.
 @example
 env foo
 @end example
--
1.6.5.2.344.ga473e


>From 731140f81aad2f99191db962462a9eddcaa84e57 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 28 Oct 2009 08:27:48 +0100
Subject: [PATCH 2/6] build: make doc checks more user-friendly

* doc/Makefile.am (check-texinfo): Begin moving each individual test
into its own rules.
(sc-avoid-builtin, sc-avoid-path): New rules.
Extracted from check-texinfo.
(syntax_checks): Add them.
---
 doc/Makefile.am |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/doc/Makefile.am b/doc/Makefile.am
index be610a2..224bcd8 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -48,8 +48,10 @@ _W = (^|[^A-Za-z0-9_])
 W_ = ([^A-Za-z0-9_]|$$)

 syntax_checks =                \
+  sc-avoid-builtin     \
   sc-avoid-io          \
   sc-avoid-non-zero    \
+  sc-avoid-path                \
   sc-avoid-timezone    \
   sc-avoid-zeroes      \
   sc-exponent-grouping \
@@ -70,9 +72,18 @@ check-texinfo: $(syntax_checks)
        $(PERL) -e 1 2> /dev/null && { $(PERL) -ne                      \
          '/\bPOSIX\b/ && !/address@hidden/ && !/^\* / || /{posix}/ and 
print,exit 1' \
          $(srcdir)/*.texi 2> /dev/null || fail=1; };                   \
-       $(EGREP) -i '$(_W)builtins?$(W_)' $(srcdir)/*.texi && fail=1;   \
+       exit $$fail
+
+sc-avoid-builtin:
+       $(AM_V_GEN)$(EGREP) -i '$(_W)builtins?$(W_)' $(srcdir)/*.texi   \
+         && exit 1 || :
+
+sc-avoid-path:
+       $(AM_V_GEN)fail=0;                                              \
        $(EGREP) -i '$(_W)path(name)?s?$(W_)' $(srcdir)/*.texi          \
-         | $(EGREP) -v 'search path|@vindex PATH$$|@env[{]PATH[}]' && fail=1; \
+         | $(EGREP) -v                                                 \
+         'PATH=|path search|search path|@vindex PATH$$|@env[{]PATH[}]' \
+         && fail=1;                                                    \
        exit $$fail

 # Use `time zone', not `timezone'.
--
1.6.5.2.344.ga473e




reply via email to

[Prev in Thread] Current Thread [Next in Thread]