If a .claws-mail/quicksearch_history line contains spaces it gets written to stdout with the spaces removed. The output is buffered so unless --debug is used it only shows up when claws-mail exits. With: fk@r500 ~ $cat .claws-mail/quicksearch_history aaa bbb bbb bbb ccc ddd eeee eee ff I get: fk@r500 ~ $claws-mail bbbbbbbbbeeeeeeefk@r500 ~ $ Setting a break point at fwrite(), I get: (gdb) where #0 0x00000008073e38f4 in fwrite () from /lib/libc.so.7 #1 0x0000000000504fc4 in matcher_parserlex () at matcher_parser_lex.l:131 #2 0x00000000005072cc in matcher_parserparse () at matcher_parser_parse.c:2133 #3 0x0000000000506d99 in matcher_parser_get_cond (str=0x80866af50 "bbb bbb bbb", is_fast=0x0) at matcher_parser_parse.y:228 #4 0x000000000065d2bf in quicksearch_set_search_strings (quicksearch=0x8084c3040) at quicksearch.c:1517 #5 0x00000000004ed894 in main (argc=1, argv=0x7fffffffd8b0) at main.c:1472 The behavior can be stopped with: --- src/matcher_parser_lex.c +++ src/matcher_parser_lex.c @@ -1035,7 +1035,6 @@ YY_RULE_SETUP case 17: YY_RULE_SETUP #line 131 "matcher_parser_lex.l" -ECHO; YY_BREAK #line 1041 "matcher_parser_lex.c" case YY_STATE_EOF(INITIAL): but this isn't a real fix as the file is generated. I haven't been able to track down where the ECHO is coming from or if it's supposed to be reached at all, though.
*** Bug 3417 has been marked as a duplicate of this bug. ***
That "ECHO;" line is not present on my generated matcher_parser_lex.c, so it's some problem with your lex/flex which may be generating the default rule for unmatched text (probably because of the empty user code section). Some ideas to try: a) If you build from git, in src/Makefile.am add "AM_LFLAGS = -s" above AM_YFLAGS line. You have to run toplevel autogen.sh then build. b) Remove last %% from matcher_parser_lex.l and try building. c) Instead removing last %%, add /* */ below it and try building. If nothing of the above works, which lex/flex version are you using?
The FreeBSD/ElectroBSD port currently uses the generated file that is bundled in the upstream source tarball: $ tar xOf /usr/ports/distfiles/claws-mail-3.11.1.tar.xz claws-mail-3.11.1/src/matcher_parser_lex.c | cat -n | grep -3 "ECHO;" 1043 case 17: 1044 YY_RULE_SETUP 1045 #line 131 "matcher_parser_lex.l" 1046 ECHO; 1047 YY_BREAK 1048 #line 1049 "matcher_parser_lex.c" 1049 case YY_STATE_EOF(INITIAL): Thanks for the suggestions, I'll give them a try this weekend.
Sorry, seems I was looking at the wrong place: I also have that "ECHO;" line in my generated .c file. I've also checked that a) works, though you probably have to either start from scratch or remove your current .c file. Anyway, the result is somewhat I don't like much: #line 131 "matcher_parser_lex.l" YY_FATAL_ERROR( "flex scanner jammed" ); A ECHO is harmless, but I suspect a fatal error is not what we want to replace it.
*** Bug 4088 has been marked as a duplicate of this bug. ***
*** Bug 4182 has been marked as a duplicate of this bug. ***
Noticed stdout dumps as well. I noticed that generated lexer has a place to inject own ECHO handler with ECHO definition: /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif Would it be reasonable to set it to no-op by claws-mail itself? Or perhaps extend a lexer to explicitly handle unexpected input?
Created attachment 2174 [details] Patch proposal not to display unmatched characters at lexer level
Anyone to try/comment the proposed patch?
The patch looks good to me and seems to work as advertised. Thanks.
Thanks, Fabian.