dellis23 / ispy

Monitor the output of terminals and processes.
GNU General Public License v2.0
1.01k stars 44 forks source link

Does not work on zsh #3

Open steelbrain opened 8 years ago

steelbrain commented 8 years ago
/s/Executables ❯❯❯ sudo ./ispy 10790                                                                                                                ⏎
Attach process 10790
fatal: Not a git repository (or any parent up to mount point /storage)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
typeset -A git_info
git_info=( )
a: none
asd: none
asd: none
fatal: Not a git repository (or any parent up to mount point /storage)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
typeset -A git_info
git_info=( )
l: alias
l='ls -1A'
ls: alias
ls='ls --group-directories-first --color=auto'
ls: alias
ls='ls --group-directories-first --color=auto'
Brightness  hhvm-perms  hhvm-perms-reset  ispy  ReadLog
fatal: Not a git repository (or any parent up to mount point /storage)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
typeset -A git_info
git_info=( )
l: alias
l='ls -1A'
ls: alias
ls='ls --group-directories-first --color=auto'
l: alias
l='ls -1A'
c: none
cd: alias
cd='nocorrect cd'
cd: alias
cd='nocorrect cd'
cd: alias
cd='nocorrect cd'
cd: alias
cd='nocorrect cd'
cd: alias
cd='nocorrect cd'
cd: alias
cd='nocorrect cd'
cd: alias
cd='nocorrect cd'
cd: alias
cd='nocorrect cd'
cd: alias
cd='nocorrect cd'
cd: alias
cd='nocorrect cd'
cd: alias
cd='nocorrect cd'
cd: alias
cd='nocorrect cd'
cd: no such file or directory: /var//www
l: alias
l='ls -1A'
ls: alias
fatal: Not a git repository (or any parent up to mount point /storage)
ls='ls --group-directories-first --color=auto'
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
typeset -A git_info
git_info=( )
ls: alias
ls='ls --group-directories-first --color=auto'
Brightness  hhvm-perms  hhvm-perms-reset  ispy  ReadLog
fatal: Not a git repository (or any parent up to mount point /storage)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
typeset -A git_info
git_info=( )
c: none
cd: alias
cd='nocorrect cd'
cd: alias
cd='nocorrect cd'
cd: alias
cd='nocorrect cd'
cd: alias
cd='nocorrect cd'
cd: alias
cd='nocorrect cd'
cd: alias
cd='nocorrect cd'
cd: alias
cd='nocorrect cd'
l: alias
Debugger error: [ProcessSignal] Signal signal<133>
Traceback (most recent call last):
  File "/home/steel/.pex/install/ispy-0.1.1-py2-none-any.whl.9e1cb5382cfd6d113d80bf9a99e320d948714a00/ispy-0.1.1-py2-none-any.whl/ispy/ispy.py", line 185, in _main
    self.runDebugger()
  File "/home/steel/.pex/install/ispy-0.1.1-py2-none-any.whl.9e1cb5382cfd6d113d80bf9a99e320d948714a00/ispy-0.1.1-py2-none-any.whl/ispy/ispy.py", line 175, in runDebugger
    self.syscallTrace(process)
  File "/home/steel/.pex/install/ispy-0.1.1-py2-none-any.whl.9e1cb5382cfd6d113d80bf9a99e320d948714a00/ispy-0.1.1-py2-none-any.whl/ispy/ispy.py", line 126, in syscallTrace
    self.syscall(process)
  File "/home/steel/.pex/install/ispy-0.1.1-py2-none-any.whl.9e1cb5382cfd6d113d80bf9a99e320d948714a00/ispy-0.1.1-py2-none-any.whl/ispy/ispy.py", line 130, in syscall
    syscall = state.event(self.syscall_options)
  File "/home/steel/.pex/install/python_ptrace-0.8.1-py2-none-any.whl.18fa41a1bad5222bc639419593783a12f8c65c79/python_ptrace-0.8.1-py2-none-any.whl/ptrace/debugger/syscall_state.py", line 13, in event
    return self.exit()
  File "/home/steel/.pex/install/python_ptrace-0.8.1-py2-none-any.whl.18fa41a1bad5222bc639419593783a12f8c65c79/python_ptrace-0.8.1-py2-none-any.whl/ptrace/debugger/syscall_state.py", line 38, in exit
    self.process.waitSignals(SIGTRAP)
  File "/home/steel/.pex/install/python_ptrace-0.8.1-py2-none-any.whl.18fa41a1bad5222bc639419593783a12f8c65c79/python_ptrace-0.8.1-py2-none-any.whl/ptrace/debugger/process.py", line 726, in waitSignals
    return self.debugger.waitSignals(*signals, **{'pid': self.pid})
  File "/home/steel/.pex/install/python_ptrace-0.8.1-py2-none-any.whl.18fa41a1bad5222bc639419593783a12f8c65c79/python_ptrace-0.8.1-py2-none-any.whl/ptrace/debugger/debugger.py", line 196, in waitSignals
    raise event
ProcessSignal: Signal signal<133>
Terminate <PtraceProcess #10985>
Terminate <PtraceProcess #10983>
Traceback (most recent call last):
  File "/storage/Executables/ispy/.bootstrap/_pex/pex.py", line 317, in execute
  File "/storage/Executables/ispy/.bootstrap/_pex/pex.py", line 250, in _wrap_coverage
  File "/storage/Executables/ispy/.bootstrap/_pex/pex.py", line 282, in _wrap_profiling
  File "/storage/Executables/ispy/.bootstrap/_pex/pex.py", line 358, in _execute
  File "/storage/Executables/ispy/.bootstrap/_pex/pex.py", line 389, in execute_script
  File "/storage/Executables/ispy/.bootstrap/_pex/pex.py", line 403, in execute_content
  File "<exec_function>", line 4, in exec_function
  File "/home/steel/.pex/install/ispy-0.1.1-py2-none-any.whl.9e1cb5382cfd6d113d80bf9a99e320d948714a00/ispy-0.1.1-py2-none-any.whl/ispy-0.1.1.dist-info/ispy-0.1.1.data/scripts/ispy", line 5, in <module>
  File "/home/steel/.pex/install/ispy-0.1.1-py2-none-any.whl.9e1cb5382cfd6d113d80bf9a99e320d948714a00/ispy-0.1.1-py2-none-any.whl/ispy/ispy.py", line 210, in main
    SyscallTracer().main()
  File "/home/steel/.pex/install/ispy-0.1.1-py2-none-any.whl.9e1cb5382cfd6d113d80bf9a99e320d948714a00/ispy-0.1.1-py2-none-any.whl/ispy/ispy.py", line 178, in main
    self._main()
  File "/home/steel/.pex/install/ispy-0.1.1-py2-none-any.whl.9e1cb5382cfd6d113d80bf9a99e320d948714a00/ispy-0.1.1-py2-none-any.whl/ispy/ispy.py", line 200, in _main
    subprocess.check_output(['kill', '-cont', str(process.pid)])
  File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['kill', '-cont', '10985']' returned non-zero exit status 1

Here's the output of the shell it was listening on

/s/Executables ❯❯❯ echo $$
10790
/s/Executables ❯❯❯ 
/s/Executables ❯❯❯ asd
zsh: correct asd to as [nyae]? %                                                                                                                      /s/Executables ❯❯❯ ls                                                                                                                               ⏎
Brightness  hhvm-perms  hhvm-perms-reset  ispy  ReadLog
/s/Executables ❯❯❯ cd /var//www
cd: no such file or directory: /var//www
/s/Executables ❯❯❯ ls                                                                                                                               ⏎
Brightness  hhvm-perms  hhvm-perms-reset  ispy  ReadLog
/s/Executables ❯❯❯ cd /var
/var ❯❯❯ ls
backups  cache  crash  lib  local  log  mail  metrics  opt  spool  tmp  lock  run
/var ❯❯❯ 
dellis23 commented 8 years ago

Interesting, thanks for the report. I've seen some extra output that was presumably coming from helper processes bash was running, but I'm surprised to see none of the output from the shell here. ispy makes the assumption that output on fds 1 and 2 are output we are interested in. I wonder if zsh does something that would break that assumption.

anands commented 8 years ago

I'm able to see both output of shell command of listening process and "Not a git repository" message.

➜  /tmp  sudo ispy 17056
Attach process 17056
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
aclocal               ed          nano                     setfacl
aclocal-1.11          efibootmgr  nc                       setfont
automake              egrep       nc.openbsd               setupcon
automake-1.11         false       netcat                   sh
bash                  fgconsole   netstat                  sh.distrib
bunzip2               fgrep       nisdomainname            sleep
busybox               findmnt     ntfs-3g                  ss
bzcat                 fuser       ntfs-3g.probe            static-sh
bzcmp                 fusermount  ntfs-3g.secaudit         stty
bzdiff                getfacl     ntfs-3g.usermap          su
bzegrep               grep        ntfscat                  sync
bzexe                 gunzip      ntfsck                   tailf
bzfgrep               gzexe       ntfscluster              tar
bzgrep                gzip        ntfscmp                  tempfile
bzip2                 hostname    ntfsdump_logfile         touch
bzip2recover          ip          ntfsfix                  true
bzless                kbd_mode    ntfsinfo                 udevadm
bzmore                kill        ntfsls                   ulockmgr_server
cat                   kmod        ntfsmftalloc             umount
cgroups-mount         less        ntfsmove                 uname
cgroups-umount        lessecho    ntfstruncate             uncompress
chacl                 lessfile    ntfswipe                 unicode_start
chgrp                 lesskey     open                     vdir
chmod                 lesspipe    openvt                   vmmouse_detect
chown                 ln          pidof                    which
chvt                  loadkeys    ping                     whiptail
cp                    login       ping6                    ypdomainname
cpio                  loginctl    plymouth                 zcat
dash                  lowntfs-3g  plymouth-upstart-bridge  zcmp
date                  ls          ps                       zdiff
dbus-cleanup-sockets  lsblk       pwd                      zegrep
dbus-daemon           lsmod       rbash                    zfgrep
dbus-uuidgen          mkdir       readlink                 zforce
dd                    mknod       red                      zgrep
df                    mktemp      rm                       zless
dir                   more        rmdir                    zmore
dmesg                 mount       rnano                    znew
dnsdomainname         mountpoint  running-in-container     zsh
domainname            mt          run-parts                zsh5
dumpkeys              mt-gnu      rzsh
echo                  mv          sed
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git

Listening shell:

➜  /bin  echo $$
17056
➜  /bin  ls
aclocal               ed          nano                     setfacl
aclocal-1.11          efibootmgr  nc                       setfont
automake              egrep       nc.openbsd               setupcon
automake-1.11         false       netcat                   sh
bash                  fgconsole   netstat                  sh.distrib
bunzip2               fgrep       nisdomainname            sleep
busybox               findmnt     ntfs-3g                  ss
bzcat                 fuser       ntfs-3g.probe            static-sh
bzcmp                 fusermount  ntfs-3g.secaudit         stty
bzdiff                getfacl     ntfs-3g.usermap          su
bzegrep               grep        ntfscat                  sync
bzexe                 gunzip      ntfsck                   tailf
bzfgrep               gzexe       ntfscluster              tar
bzgrep                gzip        ntfscmp                  tempfile
bzip2                 hostname    ntfsdump_logfile         touch
bzip2recover          ip          ntfsfix                  true
bzless                kbd_mode    ntfsinfo                 udevadm
bzmore                kill        ntfsls                   ulockmgr_server
cat                   kmod        ntfsmftalloc             umount
cgroups-mount         less        ntfsmove                 uname
cgroups-umount        lessecho    ntfstruncate             uncompress
chacl                 lessfile    ntfswipe                 unicode_start
chgrp                 lesskey     open                     vdir
chmod                 lesspipe    openvt                   vmmouse_detect
chown                 ln          pidof                    which
chvt                  loadkeys    ping                     whiptail
cp                    login       ping6                    ypdomainname
cpio                  loginctl    plymouth                 zcat
dash                  lowntfs-3g  plymouth-upstart-bridge  zcmp
date                  ls          ps                       zdiff
dbus-cleanup-sockets  lsblk       pwd                      zegrep
dbus-daemon           lsmod       rbash                    zfgrep
dbus-uuidgen          mkdir       readlink                 zforce
dd                    mknod       red                      zgrep
df                    mktemp      rm                       zless
dir                   more        rmdir                    zmore
dmesg                 mount       rnano                    znew
dnsdomainname         mountpoint  running-in-container     zsh
domainname            mt          run-parts                zsh5
dumpkeys              mt-gnu      rzsh
echo                  mv          sed
alex-bender commented 8 years ago

I have another error. This is tmux panes:

/tmp/zozo $ echo $$
11787
/tmp/zozo $ ls
test  test_
 /tmp/zozo $ 

──────────────────────────────────────────────────────────────────────────────────────────
Attach process 11787
test  test_
Debugger error: [KeyError] 514L
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/ispy/ispy.py", line 185, in _main
    self.runDebugger()
  File "/usr/local/lib/python2.7/dist-packages/ispy/ispy.py", line 175, in runDebugger
    self.syscallTrace(process)
  File "/usr/local/lib/python2.7/dist-packages/ispy/ispy.py", line 126, in syscallTrace
    self.syscall(process)
  File "/usr/local/lib/python2.7/dist-packages/ispy/ispy.py", line 130, in syscall
    syscall = state.event(self.syscall_options)
  File "build/bdist.linux-x86_64/egg/ptrace/debugger/syscall_state.py", line 13, in event
    return self.exit()
  File "build/bdist.linux-x86_64/egg/ptrace/debugger/syscall_state.py", line 32, in exit
    self.syscall.exit()
  File "build/bdist.linux-x86_64/egg/ptrace/syscall/ptrace_syscall.py", line 129, in exit
    self.result, errorcode[-self.result], strerror(-self.result))
KeyError: 514L
/tmp $