<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 23, 2020 at 3:01 PM Li Wang <<a href="mailto:liwang@redhat.com">liwang@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br>Cyril Hrubis <<a href="mailto:chrubis@suse.cz" target="_blank">chrubis@suse.cz</a>> wrote:<br><br>> +const char *next_token(FILE *f, struct data_node *doc)<br>> +{<br>> + size_t i = 0;<br>> + static char buf[4096];<br>> + int c;<br>> + int in_str = 0;<br>> +<br>> + for (;;) {<br>> + c = fgetc(f);<br>> +<br>> + if (c == EOF)<br>> + goto exit;<br>> +<br>> + if (in_str) {<br>> + if (c == '"') {<br>> + if (i == 0 || buf[i-1] != '\\')<br>> + goto exit;<br>> + }<br><br>There is a problem in handle a special string token here,<br>which can not parse the "" correctly in many test cases.<div><br></div><div>e.g.<br><br># ./docparse ../testcases/kernel/syscalls/fsopen/fsopen01.c<br># ./docparse ../testcases/kernel/fs/ftest/ftest02.c</div></div></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">The ftest02.c has not been converted to new API, please ignore.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">To fix this problem I propose to add a simple line as:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">@@ -137,8 +138,10 @@ const char *next_token(FILE *f, struct data_node *doc)<br> <br> if (in_str) {<br> if (c == '"') {<br>- if (i == 0 || buf[i-1] != '\\')<br>+ if (i == 0 || buf[i-1] != '\\') {<br>+ buf[i++] = c;<br> goto exit;<br>+ }<br> }<br></div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div>....<br><br>We got nothing<span class="gmail_default" style="font-size:small"> output</span> from the above two tests parsing because they<br>contains "" in their sentence, it makes next_token() exit too early.</div><div><br><div> TEST(move_mount(fsmfd, "", AT_FDCWD, MNTPOINT, <br> <span class="gmail_default" style="font-size:small"> </span>MOVE_MOUNT_F_EMPTY_PATH));</div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>