From sec@ice.42.org  Mon Oct 22 07:19:35 2001
Return-Path: <sec@ice.42.org>
Received: from ice.42.org (ice.42.org [194.246.250.222])
	by hub.freebsd.org (Postfix) with ESMTP id 1778D37B407
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 22 Oct 2001 07:19:34 -0700 (PDT)
Received: by ice.42.org (Postfix, from userid 1000)
	id 604F9383; Mon, 22 Oct 2001 16:19:28 +0200 (CEST)
Message-Id: <20011022141928.604F9383@ice.42.org>
Date: Mon, 22 Oct 2001 16:19:28 +0200 (CEST)
From: Stefan `Sec` Zehl <sec@ice.42.org>
Reply-To: Stefan `Sec` Zehl <sec@ice.42.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: grep manpage is incorrect regarding _GNU_nonoption_argv_flags_
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         31431
>Category:       docs
>Synopsis:       grep manpage is incorrect regarding _GNU_nonoption_argv_flags_
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-doc
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 22 07:20:01 PDT 2001
>Closed-Date:    Tue Nov 27 00:17:27 PST 2001
>Last-Modified:  Tue Nov 27 00:31:39 PST 2001
>Originator:     Stefan `Sec` Zehl
>Release:        FreeBSD 4.4-STABLE i386
>Organization:
>Environment:
System: FreeBSD ice 4.4-STABLE FreeBSD 4.4-STABLE #9: Sat Sep 29 19:25:00 CEST 2001 root@ice:/usr/export/obj/usr/export/src/sys/ICE i386


	
>Description:

The grep manpage states under ENVIRONMENT VARIABLES:

       _N_GNU_nonoption_argv_flags_
              (Here N is grep's numeric process ID.)  If the  ith
              character  of  this environment variable's value is
              1, do not consider the ith operand of grep to be an
              option,  even if it appears to be one.  A shell can
              put this variable in the environment for each  com
              mand  it  runs,  specifying  which operands are the
              results of file name wildcard expansion and  there
              fore should not be treated as options.  This behav
              ior is available only with the GNU C  library,  and
              only when POSIXLY_CORRECT is not set.

As far as I can see, this is incorrect, since out getopt() does not fetch
this environment variable.

>How-To-Repeat:

(echo "foobar";echo "-G")|\
perl -e '
$ENV{"_".$$."_GNU_nonoption_argv_flags_"}="1";
exec "/usr/bin/grep","-G";
'

which should grep for "-G" but doesn't.

Further evidence is, that neither the source, nor the binary
contains the string "_GNU_nonoption_argv_flags_"

yoda:/usr/src/gnu/usr.bin/grep>grep _GNU_nonoption_argv_flags_ *.[ch]
yoda:/usr/src/gnu/usr.bin/grep>

and

yoda:~>ldd /usr/bin/grep
/usr/bin/grep:
        libgnuregex.so.2 => /usr/lib/libgnuregex.so.2 (0x28070000)
        libz.so.2 => /usr/lib/libz.so.2 (0x28078000)
        libc.so.4 => /usr/lib/libc.so.4 (0x28086000)

yoda:~>strings -a /usr/bin/grep /usr/lib/libgnuregex.so.2 /usr/lib/libz.so.2 /usr/lib/libc.so.4|grep _GNU_nonoption_argv_flags_
yoda:~>


	
>Fix:

remove that section from the manpage?
>Release-Note:
>Audit-Trail:

From: "Peter Avalos" <pavalos@theshell.com>
To: "'Stefan `Sec` Zehl'" <sec@ice.42.org>,
	<FreeBSD-gnats-submit@freebsd.org>
Cc:  
Subject: RE: docs/31431: grep manpage is incorrect regarding _GNU_nonoption_argv_flags_
Date: Mon, 22 Oct 2001 13:24:32 -0500

 > fore should not be treated as options.  This behav-
 > ior is available only with the GNU C  library,  and
 > only when POSIXLY_CORRECT is not set.
 
 It looks like the last sentence states that you need GNU libc, and I'm
 pretty sure that's not what you're using.
 
 --Pete
 

From: "'Stefan `Sec` Zehl'" <sec@42.org>
To: Peter Avalos <pavalos@theshell.com>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: docs/31431: grep manpage is incorrect regarding _GNU_nonoption_argv_flags_
Date: Tue, 23 Oct 2001 01:10:52 +0200

 On Mon, Oct 22, 2001 at 01:24:32PM -0500, Peter Avalos wrote:
 > > fore should not be treated as options.  This behav-
 > > ior is available only with the GNU C  library,  and
 > > only when POSIXLY_CORRECT is not set.
 > It looks like the last sentence states that you need GNU libc, and I'm
 > pretty sure that's not what you're using.
 
 Gah. I read it twice, and this part didn't register.
 
 I still think it is confusing, but at least it's not incorrect.
 
 I think it should be removed anyway, or at least clarified (as BSD
 doesn't have an option to use GNU libc)
 
 CU,
     Sec
 -- 
 One of the main causes of the fall of the Roman Empire
 was that, lacking zero, they had no way to indicate
 successful termination of their C Programs.
State-Changed-From-To: open->closed 
State-Changed-By: ru 
State-Changed-When: Tue Nov 27 00:17:27 PST 2001 
State-Changed-Why:  
glibc specific stuff was removed from the manpage. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=31431 
>Unformatted:
