Hi Iwamoto san, I have fixed the bug. Thank you for the report.
CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/global/libutil/strbuf.c?cvsroot=global&r1=1.43&r2=1.44 Regards, Shigio 2015-11-30 21:38 GMT+09:00 Hideki IWAMOTO <[email protected]>: > Hi. Yamaguchi san. > > I found a bug in strbuf_fgets(). > > When STRBUF_SHARPSKIP flag is set, and the line read by fgets() by > starts with '#', and EOL is not read because of not enough buffer, > the remaining part of the line is not skipped. > > > "c\n" in the next example should be skipped, but it is not skipped. > > > Breakpoint 2, strbuf_fgets (sb=0x5db3a0, ip=0x5db160, flags=7) at > strbuf.c:357 > 357 if (flags & STRBUF_SHARPSKIP && *(sb->curp) == '#') > 1: *sb = {name = 0x0, > sbuf = 0x5db990 "universal-ctags|exuberant-ctags|plugin-example|setting > to use Exuberant Ctags plug-in > parser:\t:tc=common:\t:langmap=Ada\\:.adb.ads.Ada:\t:langmap=Asm\\:.asm.ASM.s.S.A51.29k.29K:\t:langmap=Asp\\:.asp.asa:\t:l"..., > endp = 0x5dc010 "", > curp = 0x5dbfc6 "\t:langmap=VHDL\\:.vhdl.vhd:\\\n", sbufsize = 1664} > (gdb) > Continuing. > > Breakpoint 2, strbuf_fgets (sb=0x5db3a0, ip=0x5db160, flags=7) at > strbuf.c:357 > 357 if (flags & STRBUF_SHARPSKIP && *(sb->curp) == '#') > 1: *sb = {name = 0x0, > sbuf = 0x5db990 "universal-ctags|exuberant-ctags|plugin-example|setting > to use Exuberant Ctags plug-in > parser:\t:tc=common:\t:langmap=Ada\\:.adb.ads.Ada:\t:langmap=Asm\\:.asm.ASM.s.S.A51.29k.29K:\t:langmap=Asp\\:.asp.asa:\t:l"..., > endp = 0x5dc010 "", > curp = 0x5dbfe0 "# Unsupported: vimrc [._]vimrc gvimrc [._]gvimr", > sbufsize = 1664} > (gdb) n > 107 return __fgets_alias (__s, __n, __stream); > 1: *sb = {name = 0x0, > sbuf = 0x5db990 "universal-ctags|exuberant-ctags|plugin-example|setting > to use Exuberant Ctags plug-in > parser:\t:tc=common:\t:langmap=Ada\\:.adb.ads.Ada:\t:langmap=Asm\\:.asm.ASM.s.S.A51.29k.29K:\t:langmap=Asp\\:.asp.asa:\t:l"..., > endp = 0x5dc010 "", > curp = 0x5dbfe0 "# Unsupported: vimrc [._]vimrc gvimrc [._]gvimr", > sbufsize = 1664} > (gdb) > 352 if (!fgets(sb->curp, sb->endp - sb->curp, ip)) { > 1: *sb = {name = 0x0, > sbuf = 0x5db990 "universal-ctags|exuberant-ctags|plugin-example|setting > to use Exuberant Ctags plug-in > parser:\t:tc=common:\t:langmap=Ada\\:.adb.ads.Ada:\t:langmap=Asm\\:.asm.ASM.s.S.A51.29k.29K:\t:langmap=Asp\\:.asp.asa:\t:l"..., > endp = 0x5dc010 "", curp = 0x5dbfe0 "c\n", > sbufsize = 1664} > (gdb) > > Breakpoint 2, strbuf_fgets (sb=0x5db3a0, ip=0x5db160, flags=7) at > strbuf.c:357 > 357 if (flags & STRBUF_SHARPSKIP && *(sb->curp) == '#') > 1: *sb = {name = 0x0, > sbuf = 0x5db990 "universal-ctags|exuberant-ctags|plugin-example|setting > to use Exuberant Ctags plug-in > parser:\t:tc=common:\t:langmap=Ada\\:.adb.ads.Ada:\t:langmap=Asm\\:.asm.ASM.s.S.A51.29k.29K:\t:langmap=Asp\\:.asp.asa:\t:l"..., > endp = 0x5dc010 "", curp = 0x5dbfe0 "c\n", > sbufsize = 1664} > (gdb) > 359 sb->curp += strlen(sb->curp); > 1: *sb = {name = 0x0, > sbuf = 0x5db990 "universal-ctags|exuberant-ctags|plugin-example|setting > to use Exuberant Ctags plug-in > parser:\t:tc=common:\t:langmap=Ada\\:.adb.ads.Ada:\t:langmap=Asm\\:.asm.ASM.s.S.A51.29k.29K:\t:langmap=Asp\\:.asp.asa:\t:l"..., > endp = 0x5dc010 "", curp = 0x5dbfe0 "c\n", > sbufsize = 1664} > (gdb) > > > On Mon, 11 Jul 2011 03:21:31 +0000 > Shigio YAMAGUCHI <[email protected]> wrote: > > > CVSROOT: /sources/global > > Module name: global > > Changes by: Shigio YAMAGUCHI <shigio> 11/07/11 03:21:31 > > > > Modified files: > > libutil : conf.c strbuf.c strbuf.h > > > > Log message: > > o gtags.conf: The lines which start with a '#' on the continuation > lines is considered > > to be a comment line. > > > > [example] > > :langmap=C\:.c:\ > > # :langmap=C#\:.cs:\ > > :langmap=Java\:.java: > > > > [old] > > considered as:| :langmap=C\:.c:# :langmap=C#\:.cs: > :langmap=Java\:.java:| > > [new] > > considered as:| :langmap=C\:.c: > :langmap=Java\:.java:| > > > > CVSWeb URLs: > > > http://cvs.savannah.gnu.org/viewcvs/global/libutil/conf.c?cvsroot=global&r1=1.58&r2=1.59 > > > http://cvs.savannah.gnu.org/viewcvs/global/libutil/strbuf.c?cvsroot=global&r1=1.38&r2=1.39 > > > http://cvs.savannah.gnu.org/viewcvs/global/libutil/strbuf.h?cvsroot=global&r1=1.26&r2=1.27 > > > > _______________________________________________ > > Global-commit mailing list > > [email protected] > > https://lists.gnu.org/mailman/listinfo/global-commit > > > -- Shigio YAMAGUCHI <[email protected]> PGP fingerprint: D1CB 0B89 B346 4AB6 5663 C4B6 3CA5 BBB3 57BE DDA3
_______________________________________________ Bug-global mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-global
