File: eval-stack-overflow.py

package info (click to toggle)
fish 4.2.1-3.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 35,976 kB
  • sloc: python: 6,972; javascript: 1,407; sh: 1,009; xml: 411; ansic: 230; objc: 78; makefile: 20
file content (39 lines) | stat: -rw-r--r-- 924 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python3
from pexpect_helper import SpawnedProc
import re
import os
import sys

# Disable under SAN - keeps failing because the timing is too tight
if "FISH_CI_SAN" in os.environ:
    sys.exit(0)

sp = SpawnedProc()
send, sendline, sleep, expect_prompt, expect_re, expect_str = (
    sp.send,
    sp.sendline,
    sp.sleep,
    sp.expect_prompt,
    sp.expect_re,
    sp.expect_str,
)
expect_prompt()

sendline("echo cat dog")
expect_prompt("cat dog")

sendline("eval (string replace dog tiger -- $history[1])")
expect_prompt("cat tiger")

sendline("eval (string replace dog tiger -- $history[1])")
expect_re(
    "fish: The call stack limit has been exceeded.*"
    + "\r\nin command substitution"
    + "\r\nfish: Unable to evaluate string substitution"
    + re.escape("\r\neval (string replace dog tiger -- $history[1])")
    + "\r\n *\\^~+\\^\\w*"
)
expect_prompt()

sendline("\x04")  # <c-d>
sys.exit(0)