fix(snapshot): assign newline to var before case pattern to avoid tokenize-time split#574
Conversation
…enize-time split $'\n' inside a case pattern expands to a literal newline at tokenize time, splitting the branch so ;; becomes an unexpected token. Assign the newline to a variable first so the lexer never sees $'...' in the pattern position. Both heredoc-trim sites fixed (head and tail).
|
Confirming this one from the field. After a self-update to main, bash 3.2 splits The fix looks correct to me and it covers both call sites ( @kunchenguid can you merge this? Anyone on stock macOS bash has a broken snapshot after updating. |
|
quick heads up: i reproduced this on stock macOS Bash 3.2. the current patch still fails to parse before the snapshot code runs, so it doesn't fix the underlying issue and breaks snapshot, fleet view, and Bearings. i'm working on a separate urgent fix now. it'll replace the problematic nested |
|
quick update: the replacement fix is now up at #578. it removes the Bash 3.2-incompatible nested case pattern and adds stock i'm going to continue with that PR and leave this one unmerged. thanks again for catching the underlying issue and putting together the first patch - it helped make the compatibility gap concrete. |
|
Awesome, glad you were able to figure this out. sorry for the very sparse PR and bug report :) btw i sent you a linkedin connection request last week if you want to keep in touch , hope you dont find this rude to bring up here. |
Put back into draft as i think this fix isnt proper. double checking it on my local
Problem
$'\n'inside acasepattern expands to a literal newline at tokenize time, splitting the case branch across lines so;;becomes an unexpected token:Edit: forgot to mention I'm on macOS