fix comment parsing
Subsystems (2)
PATCH 1/1 fix comment parsing
Recently exportfs started ignoring my /etc/exports file.
It looks like the culprit is 89572e8416..., after which xgettok returns 0 whenever it encounters '#' as the first character of a token. Callers seem to treat that as meaning end of file.
I think the "break" here was intended to be a "continue"; with that change, xgettok will continue reading and return the next token instead.
--- support/nfs/xio.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
support/nfs/xio.c +1 -1
@@ -98,7 +98,7 @@ xgettok(XFILE *xfp, char sepa, char *tokif (!quoted && i ==0 && c =='#' ) { c =xskipcomment (xfp); xfp->x_line++; -break ; +continue ; }if (c =='"' ) { quoted = !quoted;
Signature · 10 lines
1.4.0.g5fdc Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ NFS maillist - [email protected] https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 8 lines · On Thursday June 22, [email protected] wrote:
Recently exportfs started ignoring my
/etc/exportsfile.It looks like the culprit is
89572e8416..., after which xgettok returns 0 whenever it encounters '#' as the first character of a token. Callers seem to treat that as meaning end of file.I think the "break" here was intended to be a "continue"; with that change, xgettok will continue reading and return the next token instead.
Thanks - blush....
However I don't think that patch is quite right.
It will make a comment through to the EOL parse as nothing at all, not even an EOL, so
/foo bar() #comment
/baz *()
will parse like
/for bar() /baz *()
which isn't what we want.
On reflect, I got it completely wrong. Having reviewed how parsing really works, I think this is the right patch.
Thanks,
NeilBrown
Quoted 1 line
From
ff42180930a444cea7f19e55e2cd2bfe6d3f108bMon Sep 17 00:00:00 2001
From: Neil Brown <[email protected]>
Date: Fri, 23 Jun 2006 14:06:00 +1000
Subject: [PATCH] Fix comment parsing (again)
Bruce Fields noticed that I broke comment parsing...
as xskip() is always called before xgettok(), that is the best place to put xskipcomment and still maintain proper semantics of xskip and xgettok.
--- support/nfs/xio.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
support/nfs/xio.c +6 -6
@@ -95,11 +95,6 @@ xgettok(XFILE *xfp, char sepa, char *tokwhile (i < len && (c =xgetc (xfp)) !=EOF && (quoted || (c != sepa && !isspace (c)))) { -if (!quoted && i ==0 && c =='#' ) { - c =xskipcomment (xfp); - xfp->x_line++; -break ; - }if (c =='"' ) { quoted = !quoted;continue ;
@@ -164,7 +159,12 @@ xskip(XFILE *xfp, char *str) {int c; -while ((c =xgetc (xfp)) !=EOF &&strchr (str, c)); +while ((c =xgetc (xfp)) !=EOF ) { +if (c =='#' ) + c =xskipcomment (xfp); +if (strchr (str, c) ==NULL ) +break ; + }xungetc (c, xfp); }
Signature · 10 lines
1.4.0 Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ NFS maillist - [email protected] https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 4 lines · Neil Brown
However I don't think that patch is quite right.
It will make a comment through to the EOL parse as nothing at all, not even an EOL, so
Quoted 8 lines
/foo
bar()#comment
/baz *()will parse like
/for
bar()/baz *()which isn't what we want.
Whoops.
Quoted 2 lines
On reflect, I got it completely wrong. Having reviewed how parsing really works, I think this is the right patch.
Thanks! That works for me.--b.
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs