From adrian@iodine.cs.virginia.edu  Wed Oct 28 14:47:22 1998
Received: from iodine.cs.virginia.edu (iodine.cs.Virginia.EDU [128.143.71.29])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA27360
          for <FreeBSD-gnats-submit@freebsd.org>; Wed, 28 Oct 1998 14:47:19 -0800 (PST)
          (envelope-from adrian@iodine.cs.virginia.edu)
Received: (from adrian@localhost)
	by iodine.cs.virginia.edu (8.8.8/8.8.8) id RAA00700;
	Wed, 28 Oct 1998 17:45:41 -0500 (EST)
	(envelope-from adrian)
Message-Id: <199810282245.RAA00700@iodine.cs.virginia.edu>
Date: Wed, 28 Oct 1998 17:45:41 -0500 (EST)
From: adrian@ubergeeks.com
Reply-To: adrian@ubergeeks.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: patch to correct line continuations in /etc/exports.
X-Send-Pr-Version: 3.2

>Number:         8479
>Category:       bin
>Synopsis:       Final \'s in /etc/exports did not work intuitively.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dd
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 28 14:50:01 PST 1998
>Closed-Date:    Tue Nov 15 06:14:38 UTC 2005
>Last-Modified:  Tue Nov 15 06:14:38 UTC 2005
>Originator:     Adrian Filipi-Martin
>Release:        FreeBSD 2.2.7-RELEASE i386
>Organization:
Ubergeeks Consulting
>Environment:

	

>Description:

	When reading /etc/exports, mountd would join continued lines
	to the following lines with no separating whitespace.  This is
	not intuitive.  Furthermore, use of the \ is not mentioned
	in exports(5).

>How-To-Repeat:

	Use the an entry like the following in /etc/exports:

# Misinterpreted exports file.
# Entry is read as "/usr/ports/usr/src -map...".
/usr/ports \
/usr/src   \ 
	-maproot=root:wheel -network 128.143.71 -mask 255.255.255.0 

>Fix:

	Apply the following patch.  Aside from correcting continuation
in the exports file, it also documents the use of \ in the exports
manpage.  I also deleted a couple of bogus checks for newlines in
nextfield().  get_line() will always remove the trailing newline,
if any.

--- mountd.c.orig	Thu Jun 25 17:27:24 1998
+++ mountd.c	Wed Oct 28 17:21:37 1998
@@ -1798,11 +1798,11 @@
 	p = *cp;
 	while (*p == ' ' || *p == '\t')
 		p++;
-	if (*p == '\n' || *p == '\0')
+	if (*p == '\0')
 		*cp = *endcp = p;
 	else {
 		*cp = p++;
-		while (*p != ' ' && *p != '\t' && *p != '\n' && *p != '\0')
+		while (*p != ' ' && *p != '\t' && *p != '\0')
 			p++;
 		*endcp = p;
 	}
@@ -1836,6 +1836,10 @@
 				cont_line = 1;
 			cp--;
 			len--;
+		}
+		if (cont_line) {
+			*++cp = ' ';
+			++len;
 		}
 		*++cp = '\0';
 		if (len > 0) {
--- exports.5.orig	Wed Mar 12 10:07:13 1997
+++ exports.5	Wed Oct 28 17:29:14 1998
@@ -54,10 +54,12 @@
 and
 .%T "NFS: Network File System Version 3 Specification, Appendix I" .
 .Pp
-Each line in the file
-(other than comment lines that begin with a #)
-specifies the mount point(s) and export flags within one local server
-filesystem for one or more hosts.
+Each line in the file specifies the mount point(s) and export flags
+within one local server filesystem for one or more hosts.  Empty
+lines and lines beginning with a # are ignored.  A long line can
+be split over several lines by ending all but the last line with
+a \\.
+.Pp
 A host may be specified only once for each local filesystem on the
 server and there may be only one default entry for each server
 filesystem that applies to all other hosts.

>Release-Note:
>Audit-Trail:

From: adrian@ubergeeks.com
To: FreeBSD-gnats-submit@FreeBSD.ORG
Cc:  Subject: bin/8479: patch to correct line continuations in /etc/exports.
Date: Wed, 28 Oct 1998 17:45:41 -0500 (EST)

 >Number:         8479
 >Category:       bin
 >Synopsis:       Final \'s in /etc/exports did not work intuitively.
 >Confidential:   no
 >Severity:       non-critical
 >Priority:       low
 >Responsible:    freebsd-bugs
 >State:          open
 >Quarter:
 >Keywords:
 >Date-Required:
 >Class:          sw-bug
 >Submitter-Id:   current-users
 >Arrival-Date:   Wed Oct 28 14:50:01 PST 1998
 >Last-Modified:
 >Originator:     Adrian Filipi-Martin
 >Organization:
 Ubergeeks Consulting
 >Release:        FreeBSD 2.2.7-RELEASE i386
 >Environment:
 
 	
 
 >Description:
 
 	When reading /etc/exports, mountd would join continued lines
 	to the following lines with no separating whitespace.  This is
 	not intuitive.  Furthermore, use of the \ is not mentioned
 	in exports(5).
 
 >How-To-Repeat:
 
 	Use the an entry like the following in /etc/exports:
 
 # Misinterpreted exports file.
 # Entry is read as "/usr/ports/usr/src -map...".
 /usr/ports \
 /usr/src   \ 
 	-maproot=root:wheel -network 128.143.71 -mask 255.255.255.0 
 
 >Fix:
 
 	Apply the following patch.  Aside from correcting continuation
 in the exports file, it also documents the use of \ in the exports
 manpage.  I also deleted a couple of bogus checks for newlines in
 nextfield().  get_line() will always remove the trailing newline,
 if any.
 
 --- mountd.c.orig	Thu Jun 25 17:27:24 1998
 +++ mountd.c	Wed Oct 28 17:21:37 1998
 @@ -1798,11 +1798,11 @@
  	p = *cp;
  	while (*p == ' ' || *p == '\t')
  		p++;
 -	if (*p == '\n' || *p == '\0')
 +	if (*p == '\0')
  		*cp = *endcp = p;
  	else {
  		*cp = p++;
 -		while (*p != ' ' && *p != '\t' && *p != '\n' && *p != '\0')
 +		while (*p != ' ' && *p != '\t' && *p != '\0')
  			p++;
  		*endcp = p;
  	}
 @@ -1836,6 +1836,10 @@
  				cont_line = 1;
  			cp--;
  			len--;
 +		}
 +		if (cont_line) {
 +			*++cp = ' ';
 +			++len;
  		}
  		*++cp = '\0';
  		if (len > 0) {
 --- exports.5.orig	Wed Mar 12 10:07:13 1997
 +++ exports.5	Wed Oct 28 17:29:14 1998
 @@ -54,10 +54,12 @@
  and
  .%T "NFS: Network File System Version 3 Specification, Appendix I" .
  .Pp
 -Each line in the file
 -(other than comment lines that begin with a #)
 -specifies the mount point(s) and export flags within one local server
 -filesystem for one or more hosts.
 +Each line in the file specifies the mount point(s) and export flags
 +within one local server filesystem for one or more hosts.  Empty
 +lines and lines beginning with a # are ignored.  A long line can
 +be split over several lines by ending all but the last line with
 +a \\.
 +.Pp
  A host may be specified only once for each local filesystem on the
  server and there may be only one default entry for each server
  filesystem that applies to all other hosts.
 
 >Audit-Trail:
 >Unformatted:
 
 To Unsubscribe: send mail to majordomo@FreeBSD.org
 with "unsubscribe freebsd-bugs" in the body of the message
 
 
Responsible-Changed-From-To: freebsd-bugs->dd 
Responsible-Changed-By: dd 
Responsible-Changed-When: Sat Jun 16 16:21:18 PDT 2001 
Responsible-Changed-Why:  
This sounds reasonable.  I'll look at it. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=8479 
State-Changed-From-To: open->analyzed 
State-Changed-By: dd 
State-Changed-When: Mon Jul 2 16:59:08 PDT 2001 
State-Changed-Why:  
I've committed the cont_line part of your mountd.c patch, and a modified 
version of your exports.5 patch.  I didn't commit your removal of checks 
for 'n' in nextfield() because although get_line() does that work, it 
isn't documented to do so; thus, if the checks in nextfield() were removed 
and the implementation of get_line() changes, breakage may occur.  And 
there's no real profit in removing them.  Thanks! 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=8479 

From: adrian@ubergeeks.com
To: bug-followup@FreeBSD.org, adrian@ubergeeks.com
Cc:  
Subject: Re: bin/8479: Final \'s in /etc/exports did not work intuitively.
Date: Wed, 9 Nov 2005 16:48:51 -0500 (EST)

 Hi,
 
 This PR can be closed AFAICT.
 
 Noticed it when looking at PR's I sent in a long time ago.
 
 thanks,
 
 Adrian
State-Changed-From-To: analyzed->closed 
State-Changed-By: dd 
State-Changed-When: Tue Nov 15 06:14:17 UTC 2005 
State-Changed-Why:  
Originator reports that the PR can be closed. My apologies for 
dropping the ball. 

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