Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Oct 1998 17:45:41 -0500 (EST)
From:      adrian@ubergeeks.com
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/8479: patch to correct line continuations in /etc/exports.
Message-ID:  <199810282245.RAA00700@iodine.cs.virginia.edu>

next in thread | raw e-mail | index | archive | help

>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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810282245.RAA00700>