parse.y: document quoting rules
it seems that we have lots of config files that currently have no guidelines as to what needs quoting, and what does not. the diff below is for pf.conf.5, and attempts to clarify that. if no one disagrees, i'll do it for all those that use parse.y. that is: /usr/src/sbin/iked/parse.y /usr/src/sbin/ipsecctl/parse.y /usr/src/sbin/pfctl/parse.y /usr/src/usr.sbin/bgpd/parse.y /usr/src/usr.sbin/dvmrpd/parse.y /usr/src/usr.sbin/hostapd/parse.y /usr/src/usr.sbin/ifstated/parse.y /usr/src/usr.sbin/iscsictl/parse.y /usr/src/usr.sbin/ldapd/parse.y /usr/src/usr.sbin/ldpd/parse.y /usr/src/usr.sbin/mrouted/cfparse.y /usr/src/usr.sbin/ntpd/parse.y /usr/src/usr.sbin/ospf6d/parse.y /usr/src/usr.sbin/ospfd/parse.y /usr/src/usr.sbin/relayd/parse.y /usr/src/usr.sbin/ripd/parse.y /usr/src/usr.sbin/smtpd/parse.y /usr/src/usr.sbin/snmpd/parse.y /usr/src/usr.sbin/ypldap/parse.y any dissention, or inaccuracies? jmc Index: pf.conf.5 === RCS file: /cvs/src/share/man/man5/pf.conf.5,v retrieving revision 1.513 diff -u -r1.513 pf.conf.5 --- pf.conf.5 31 Jan 2012 07:46:32 - 1.513 +++ pf.conf.5 21 Apr 2012 17:32:13 - @@ -72,14 +72,17 @@ .Pp Additional configuration files can be included with the .Ic include -keyword, for example: +keyword. +Note that argument names not beginning with a letter, digit, or underscore +must be quoted. +For example: .Bd -literal -offset indent include /etc/pf/sub.filter.conf .Ed .Pp Macros can be defined that will later be expanded in context. -Macro names must start with a letter, and may contain letters, digits -and underscores. +Macro names must start with a letter, digit, or underscore, +and may contain any of those characters. Macro names may not be reserved words (for example .Ar pass , .Ar in ,
The rivolution web
Hello, I'm Bybor, your new social network! Get to know me on, www.bybor.com [demime 1.01d removed an attachment of type image/jpeg which had a name of bybor LOGO.jpg] April 27, 2012
Re: parse.y: document quoting rules
On 04/21/12 19:33, Jason McIntyre wrote: any dissention, or inaccuracies? jmc Index: pf.conf.5 === RCS file: /cvs/src/share/man/man5/pf.conf.5,v retrieving revision 1.513 diff -u -r1.513 pf.conf.5 --- pf.conf.5 31 Jan 2012 07:46:32 - 1.513 +++ pf.conf.5 21 Apr 2012 17:32:13 - @@ -72,14 +72,17 @@ .Pp Additional configuration files can be included with the .Ic include -keyword, for example: +keyword. +Note that argument names not beginning with a letter, digit, or underscore +must be quoted. +For example: .Bd -literal -offset indent include /etc/pf/sub.filter.conf .Ed .Pp Keywords need to be quoted, too. This does not work (syntax error) include tag while this works: include tag What got me thinking about this: Is that sentence supposed to describe quoting rules for the include keyword (I'm reading it that way) or should it apply to the whole pf.conf grammar? I think it should apply to the whole grammar: This does not work (syntax error) pass in tag tag pass in tag /foo while this works: pass in tag tag pass in tag /foo One other thing: Are you aiming for an exhaustive list of things that need to quoted? For example at first I thought that spaces need to be quoted, it turns out that assumption was wrong, this works: pass in tag foo bar I don't know if your sentence + something about keywords would be an exhaustive list. florian
Re: parse.y: document quoting rules
On 04/21/12 20:45, Florian Obser wrote: I think it should apply to the whole grammar: This does not work (syntax error) pass in tag tag pass in tag /foo while this works: pass in tag tag pass in tag /foo Of course these rules combined are nonsense. What I meant to say: I tried both cases on their own. Sorry for the inaccuracy. florian
Re: parse.y: document quoting rules
On Sat, Apr 21, 2012 at 08:45:25PM +0200, Florian Obser wrote: Keywords need to be quoted, too. This does not work (syntax error) include tag while this works: include tag What got me thinking about this: Is that sentence supposed to describe quoting rules for the include keyword (I'm reading it that way) or should it apply to the whole pf.conf grammar? I think it should apply to the whole grammar: This does not work (syntax error) pass in tag tag pass in tag /foo while this works: pass in tag tag pass in tag /foo One other thing: Are you aiming for an exhaustive list of things that need to quoted? For example at first I thought that spaces need to be quoted, it turns out that assumption was wrong, this works: pass in tag foo bar I don't know if your sentence + something about keywords would be an exhaustive list. florian the sentence was supposed to describe pf grammar (not just include). but you've spotted an ambiguity ;( i'd hoped to get away with not making this too verbose, but i guess it's inevitable. it's tricky because the grammar is so large. it's not meant to be exhaustive - just a start. for example, in pf.conf we have to quote { but not . i haven;t found a simple way to describe everything. rewrite below. jmc Index: pf.conf.5 === RCS file: /cvs/src/share/man/man5/pf.conf.5,v retrieving revision 1.513 diff -u -r1.513 pf.conf.5 --- pf.conf.5 31 Jan 2012 07:46:32 - 1.513 +++ pf.conf.5 21 Apr 2012 20:39:17 - @@ -70,6 +70,9 @@ Care should be taken when commenting out multi-line text: the comment is effective until the end of the entire block. .Pp +Argument names not beginning with a letter, digit, or underscore +must be quoted. +.Pp Additional configuration files can be included with the .Ic include keyword, for example: @@ -78,8 +81,8 @@ .Ed .Pp Macros can be defined that will later be expanded in context. -Macro names must start with a letter, and may contain letters, digits -and underscores. +Macro names must start with a letter, digit, or underscore, +and may contain any of those characters. Macro names may not be reserved words (for example .Ar pass , .Ar in ,
sys_pipe: take fd table lock after allocating memory
there's no apparent need to take a file descriptor table lock before we've done allocating pipe structures and buffers. ok? Index: sys/kern/sys_pipe.c === RCS file: /home/cvs/src/sys/kern/sys_pipe.c,v retrieving revision 1.61 diff -u -p -r1.61 sys_pipe.c --- sys/kern/sys_pipe.c 8 Jul 2011 19:00:09 - 1.61 +++ sys/kern/sys_pipe.c 11 Apr 2012 18:44:23 - @@ -108,11 +108,9 @@ sys_pipe(struct proc *p, void *v, regist } */ *uap = v; struct filedesc *fdp = p-p_fd; struct file *rf, *wf; - struct pipe *rpipe, *wpipe; + struct pipe *rpipe = NULL, *wpipe = NULL; int fds[2], error; - fdplock(fdp); - rpipe = pool_get(pipe_pool, PR_WAITOK); error = pipe_create(rpipe); if (error != 0) @@ -120,7 +118,9 @@ sys_pipe(struct proc *p, void *v, regist wpipe = pool_get(pipe_pool, PR_WAITOK); error = pipe_create(wpipe); if (error != 0) - goto free2; + goto free1; + + fdplock(fdp); error = falloc(p, rf, fds[0]); if (error != 0) @@ -157,11 +157,12 @@ free3: closef(rf, p); rpipe = NULL; free2: - (void)pipeclose(wpipe); + fdpunlock(fdp); free1: + if (wpipe != NULL) + (void)pipeclose(wpipe); if (rpipe != NULL) (void)pipeclose(rpipe); - fdpunlock(fdp); return (error); }