Subject: Re: bug#21840: 24.5; semantic analysis of python files is broken by strings that end in backslash

From: Glyph <[email-masked]>
Date: Thu, 3 Dec 2020 10:48:50 -0800

I don't know how to force semantic to fully reparse a file, I just observe its behavior in response to idle times.

Here's a test file you can use though, if you know how to do that:

def a(v):
    "test"

def x():
    "test"
    a(b"\\")

def y():
    "test"

def z():
    "test"

Comment and uncomment the 'a(b"\\")' line and let semantic get around to reparsing the buffer, however it decides to do that, and (mapcar 'car (semantic-fetch-tags)) will  return ("a" "x") rather than the expected ("a" "x" "y" "z").  However, it seems like there's tons of cache state somewhere that I can't easily clear out because it randomly seems to fluctuate between doing what I expect, returning "nil", and returning a stale copy of the symbols (including stuff added and then removed entirely from the bottom of the buffer).

Sadly, given that I don't use semantic any more (specifically because of this type of inscrutable unreliability) I don't have any more time for debugging this.  Thanks for following up and good luck!

-g

> On Dec 3, 2020, at 2:46 AM, Lars Ingebrigtsen <[email-masked]> wrote:
> 
> Glyph Lefkowitz <[email-masked]> writes:
> 
>> Python string literals that end in a backslash cause Semantic's parser
>> to halt and not recognize anything further in the buffer.  I personally
>> ran across this because I frequently use helm-semantic-or-imenu, but can
>> be demonstrated equally well by semantic-complete-jump-local or anything
>> else that makes use of the buffer's symbol list.
>> 
>> The trivial way to reproduce this is to put the string literal "\\" at
>> the top of a Python buffer and then invoke semantic in one of the ways
>> just mentioned and notice that nothing is picked up.  You can move the
>> backslash literal down in the file and see every symbol up to the point
>> where it is placed.
> 
> (This bug report unfortunately got no response at the time.)
> 
> Do you have a step-by-step recipe to reproduce this bug, starting from
> "emacs -Q"?
> 
> -- 
> (domestic pets only, the antidote for overdose, milk.)
>   bloggy blog: http://lars.ingebrigtsen.no