From mitya@tear.demos.su  Mon Apr 28 03:44:14 2003
Return-Path: <mitya@tear.demos.su>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 3D63E37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 28 Apr 2003 03:44:14 -0700 (PDT)
Received: from tear.demos.su (tear.demos.su [194.87.2.103])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 2E5F543F3F
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 28 Apr 2003 03:44:13 -0700 (PDT)
	(envelope-from mitya@tear.demos.su)
Received: from tear.demos.su (localhost [127.0.0.1])
	by tear.demos.su (8.12.9/8.12.9) with ESMTP id h3SAi4XG000342
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 28 Apr 2003 14:44:04 +0400 (MSD)
	(envelope-from mitya@tear.demos.su)
Received: (from root@localhost)
	by tear.demos.su (8.12.9/8.12.9/Submit) id h3SAi4j1000341;
	Mon, 28 Apr 2003 14:44:04 +0400 (MSD)
Message-Id: <200304281044.h3SAi4j1000341@tear.demos.su>
Date: Mon, 28 Apr 2003 14:44:04 +0400 (MSD)
From: Dmitry Sivachenko <mitya@cavia.pp.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Compat patch: more(1) allowed filename to start with '+'
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         51488
>Category:       bin
>Synopsis:       Compat patch: more(1) allowed filename to start with '+'
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    delphij
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 28 03:50:14 PDT 2003
>Closed-Date:    Tue Jul 17 07:16:56 GMT 2007
>Last-Modified:  Tue Jul 17 07:16:56 GMT 2007
>Originator:     Dmitry Sivachenko
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
>Environment:
System: FreeBSD tear.demos.su 4.8-STABLE FreeBSD 4.8-STABLE #2: Mon Apr 28 14:27:07 MSD 2003 mitya@tear.demos.su:/usr/src/sys/compile/TEAR i386


	
>Description:
more(1), before it became an alias to less(1), allowed filename to start with
'+'.  Thus, `more +abc` was legal request to view file '+abc'.
less(1) treats leading '+' symbol specially.  The following patch
restores old behaviour (only when invoked as 'more').

>How-To-Repeat:
	
>Fix:

	


--- main.c.orig	Mon Apr 28 14:36:38 2003
+++ main.c	Mon Apr 28 14:38:21 2003
@@ -125,7 +125,8 @@
 	if (s != NULL)
 		scan_option(save(s));
 
-#define	isoptstring(s)	(((s)[0] == '-' || (s)[0] == '+') && (s)[1] != '\0')
+#define	isoptstring(s)	more_mode ? (((s)[0] == '-') && (s)[1] != '\0') : \
+			(((s)[0] == '-' || (s)[0] == '+') && (s)[1] != '\0')
 	while (argc > 0 && (isoptstring(*argv) || isoptpending()))
 	{
 		s = *argv++;
>Release-Note:
>Audit-Trail:

From: Peter Pentchev <roam@ringlet.net>
To: Dmitry Sivachenko <mitya@cavia.pp.ru>
Cc: bug-followup@FreeBSD.org
Subject: Re: bin/51488: Compat patch: more(1) allowed filename to start with '+'
Date: Tue, 29 Apr 2003 11:29:32 +0300

 On Mon, Apr 28, 2003 at 02:44:04PM +0400, Dmitry Sivachenko wrote:
 > 
 > >Number:         51488
 > >Category:       bin
 > >Synopsis:       Compat patch: more(1) allowed filename to start with '+'
 > >Originator:     Dmitry Sivachenko
 > >Release:        FreeBSD 4.8-STABLE i386
 > >Description:
 > more(1), before it became an alias to less(1), allowed filename to start with
 > '+'.  Thus, `more +abc` was legal request to view file '+abc'.
 > less(1) treats leading '+' symbol specially.  The following patch
 > restores old behaviour (only when invoked as 'more').
 > >Fix:
 > --- main.c.orig	Mon Apr 28 14:36:38 2003
 > +++ main.c	Mon Apr 28 14:38:21 2003
 > @@ -125,7 +125,8 @@
 >  	if (s != NULL)
 >  		scan_option(save(s));
 >  
 > -#define	isoptstring(s)	(((s)[0] == '-' || (s)[0] == '+') && (s)[1] != '\0')
 > +#define	isoptstring(s)	more_mode ? (((s)[0] == '-') && (s)[1] != '\0') : \
 > +			(((s)[0] == '-' || (s)[0] == '+') && (s)[1] != '\0')
 >  	while (argc > 0 && (isoptstring(*argv) || isoptpending()))
 >  	{
 >  		s = *argv++;
 
 Just a minor style/correctness comment: IMHO, the ?: conditional should
 be enclosed in another set of parentheses.
 
 Other than that, this looks great!
 
 G'luck,
 Peter
 
 -- 
 Peter Pentchev	roam@ringlet.net    roam@sbnd.net    roam@FreeBSD.org
 PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
 Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
 The rest of this sentence is written in Thailand, on

From: Bruce Evans <bde@zeta.org.au>
To: Peter Pentchev <roam@ringlet.net>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: bin/51488: Compat patch: more(1) allowed filename to start with
 '+'
Date: Wed, 30 Apr 2003 00:54:53 +1000 (EST)

 On Tue, 29 Apr 2003, Peter Pentchev wrote:
 
 >  On Mon, Apr 28, 2003 at 02:44:04PM +0400, Dmitry Sivachenko wrote:
 >  > -#define	isoptstring(s)	(((s)[0] == '-' || (s)[0] == '+') && (s)[1] != '\0')
 >  > +#define	isoptstring(s)	more_mode ? (((s)[0] == '-') && (s)[1] != '\0') : \
 >  > +			(((s)[0] == '-' || (s)[0] == '+') && (s)[1] != '\0')
 
 >  Just a minor style/correctness comment: IMHO, the ?: conditional should
 >  be enclosed in another set of parentheses.
 
 This is necessary for correctness (in macros that expand to an expression,
 the expression should have outer parethenthses, but it is not what KNF
 actually does for "?:" so it would be a style bug in most contexts.
 
 Unnecessary parentheses in macros are larger style bugs than in most places
 IMO, since macros need lots of parentheses for correctness and mixing
 unecessary ones with necessary ones makes the necessary ones hard to
 distinguish for human readers.
 
 In the above, the original version has minimal necessary parentheses
 including the outer ones, but the outer ones have mutated into unnecessary
 ones around each term in the "?:".
 
 KNF is more or less defined by what KNF code like Lite2's kern/*.c
 does, not by what style(9) says.  In Lite2's kern/*.c, there are 51
 lines with "?:".  Approx. 12 of these lines have unnecessary parentheses.
 2 of these parenthesize the expression like in "x = (y ? u : v)".  9 of
 them parenthesize the conditional like in "(x & y) ? u : v".  One
 parenthesizes a double conditional "x ? y : (u ? v : w)".  Unnecessary
 parentheses work worst for longer multiple conditionals like the latter.
 E.g., the idiomatic ladder:
 
 	a ? b : c ? d : e ? f : g ? h : i ? j : k
 
 becomes:
 
 	a ? b : (c ? d : (e ? f : (g ? h : (i ? j : k))))
 
 where it is hard to unpeel the parentheses to see that nothing special is
 being done with them.  This is like obfuscating "else if" ladders using
 "else { if ... }".
 
 Bruce
Responsible-Changed-From-To: freebsd-bugs->delphij 
Responsible-Changed-By: delphij 
Responsible-Changed-When: Thu Jun 21 09:27:36 UTC 2007 
Responsible-Changed-Why:  
Take 

http://www.freebsd.org/cgi/query-pr.cgi?pr=51488 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/51488: commit references a PR
Date: Thu, 21 Jun 2007 10:39:30 +0000 (UTC)

 delphij     2007-06-21 10:39:24 UTC
 
   FreeBSD src repository
 
   Modified files:
     contrib/less         main.c 
   Log:
   Restore a historical behavior that +foo is considered as a
   filename by more(1).  The less(1) behavior is keep intact.
   
   PR:             bin/51488
   Prodded by:     demon
   Approved by:    re (hrs)
   
   Revision  Changes    Path
   1.8       +2 -1      src/contrib/less/main.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: delphij 
State-Changed-When: Thu Jun 21 10:45:24 UTC 2007 
State-Changed-Why:  
A variant patch applied against -CURRENT.  MFC Reminder. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=51488 
State-Changed-From-To: patched->closed 
State-Changed-By: delphij 
State-Changed-When: Tue Jul 17 07:16:38 UTC 2007 
State-Changed-Why:  
less v406 MFC'ed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=51488 
>Unformatted:
