bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13350: 24.2; term.el is confused when bash prints almost 4096 bytes


From: Johan Claesson
Subject: bug#13350: 24.2; term.el is confused when bash prints almost 4096 bytes
Date: Thu, 03 Jan 2013 21:31:16 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)


emacs -Q
M-x ansi-term
/bin/bash
cd /tmp
printf '%4090s' x

On my system this gives the error message:

error in process filter: No such directory found via CDPATH environment variable

I think the following is happening:

- Bash will after each command send ?\032 and the current directory
  "/tmp" to inform term.el. 
- Bash output is buffered in 4096 bytes chunks.  The end of the first
  chunk will be "/tm"
- term.el interprets "/tm" as the current directory and tries to cd
  there.  Since /tm does not exist it signals an error.

I don't know if this buffer size of 4096 varies from system to system.
In that case maybe the above recipe will not trigger the error on all
systems. 

The following term.el patch is an attempt to fix this:

--- original/term.el    2013-01-03 20:33:13.862726000 +0100
+++ elisp/term.el       2013-01-03 20:35:02.374726000 +0100
@@ -2895,11 +2895,11 @@
                          (beep t))
                         ((and (eq char ?\032)
                                (not handled-ansi-message))
-                         (let ((end (string-match "\r?$" str i)))
+                         (let ((end (string-match "\r?\n" str i)))
                            (if end
                                (funcall term-command-hook
                                         (prog1 (substring str (1+ i) end)
-                                          (setq i (match-end 0))))
+                                          (setq i (1- (match-end 0)))))
                              (setq term-terminal-parameter (substring str i))
                              (setq term-terminal-state 4)
                              (setq i str-length))))


I guess that all 032 escape sequences ends with a newline and that this
is what the regex wants to detect.  But the current regex "\r?$" will
match all strings.  And therefore the mechanism for saving the first
part of the command until the second part arrives will never run.

Regards,

/Johan






--- original/term.el    2013-01-03 20:33:13.862726000 +0100
+++ elisp/term.el       2013-01-03 20:35:02.374726000 +0100
@@ -2895,11 +2895,11 @@
                          (beep t))
                         ((and (eq char ?\032)
                                (not handled-ansi-message))
-                         (let ((end (string-match "\r?$" str i)))
+                         (let ((end (string-match "\r?\n" str i)))
                            (if end
                                (funcall term-command-hook
                                         (prog1 (substring str (1+ i) end)
-                                          (setq i (match-end 0))))
+                                          (setq i (1- (match-end 0)))))
                              (setq term-terminal-parameter (substring str i))
                              (setq term-terminal-state 4)
                              (setq i str-length))))


In GNU Emacs 24.2.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10)
 of 2012-09-03 on goblin
Windowing system distributor `The X.Org Foundation', version 11.0.11203000
Configured using:
 `configure '--prefix=/home/jcl/usr' '--without-toolkit-scroll-bars'
 '-C' '--disable-maintainer-mode' '--without-compress-info''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Buffer Menu

Minor modes in effect:
  global-cwarn-mode: t
  which-function-mode: t
  display-time-mode: t
  icomplete-mode: t
  minibuffer-depth-indicate-mode: t
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  ido-everywhere: t
  electric-layout-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<up> <up> <up> <up> <down> <return> <C-tab> C-q C-q 
SPC C-r <return> C-n C-n C-n C-n C-n C-n C-n <tab> 
C-a C-k C-k C-k C-k C-k C-k C-k C-k C-x C-s <C-tab> 
<up> <return> <C-tab> <C-tab> <return> <return> <return> 
<C-tab> M-x m a n <return> d i f f <return> C-s n a 
u r <end> M-x m a n <return> p a t c h <return> C-s 
C-s <C-tab> d i f f SPC - N a u r SPC o r i <tab> <tab> 
e l i <tab> t e r <tab> C-) SPC t e r m . p a t c h 
<return> C-x C-f C-f t e r <return> <C-tab> M-x r e 
p o r t - e m <tab> b <tab> - q <tab> <return> <return> 
C-g M-x <up> <return> q <C-tab> <C-tab> c d <backspace> 
<S-backspace> C D P A T H SPC t e r m <return> <tab> 
<return> <up> <down> <right> <right> <return> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <left> C-x o C-x C-b <down-mouse-2> 
<mouse-movement> <mouse-2> <C-tab> M-x f i n d - f 
u n <tab> <return> r e p l <backspace> o r t - e m 
<tab> b u <tab> - <tab> q <tab> <return> <down> <down> 
<down> <down> <down> <down> <down> <down> M-f C-s C-d 
C-r C-r <C-down> <down> <down> <down> <down> C-s C-d 
C-s C-s <C-down> <C-down> <C-M-down> <C-M-down> <C-M-down> 
<C-M-down> <C-M-down> <C-M-down> <C-M-down> <C-M-down> 
<C-M-down> <C-M-down> <C-M-down> <C-M-down> <C-M-down> 
<C-M-down> <C-M-down> <C-M-down> <C-M-down> <C-M-down> 
<C-M-down> <C-M-down> <C-M-down> <C-M-down> <C-M-down> 
<C-M-down> <C-M-down> <C-M-down> <C-M-down> <C-M-down> 
<C-M-down> <C-M-down> <C-M-down> <prior> <prior> <prior> 
<prior> <prior> <prior> <prior> <prior> <prior> <prior> 
<prior> <next> <next> <next> <C-tab> M-x <up> <down> 
r e p o r t - e m <tab> b <tab> <return>

Recent messages:
Quit
call-interactively: Buffer is read-only: #<buffer *Existing Emacs Bugs*>
Contacting host: debbugs.gnu.org:80
Reporting new bug! [2 times]
Commands: d, s, x, u; f, o, 1, 2, m, v; ~, %; q to quit; ? for help.
Reporting new bug!
Making completion list...
Mark saved where search started [2 times]
scroll-down: Beginning of buffer [2 times]
Reverting buffer `procmail_inbox'.

Load-path shadows:
/home/jcl/elisp/term hides /home/jcl/usr/share/emacs/24.2/lisp/term
/home/jcl/elisp/elpa/emms-20121219.1939/tq hides 
/home/jcl/usr/share/emacs/24.2/lisp/emacs-lisp/tq

Features:
(shadow emacsbug smerge-mode gnus-fun vc-bzr man tabify w3m-form
w3m-lnum w3m-bookmark w3m-tabmenu w3m-session cl-specs edebug
jcl-wesnoth-init wesnoth-mode wesnoth-wml-data wesnoth-update
emms-bookmarks emms-lastfm-client emms-cue emms-mode-line-icon
emms-browser emms-playlist-sort emms-last-played emms-player-xine
emms-player-mpd emms-lyrics emms-url emms-streams emms-tag-editor
emms-info-metaflac emms-mark emms-playlist-limit emms-volume
emms-volume-amixer emms-i18n emms-history emms-score emms-stream-info
emms-metaplaylist-mode elp nnrss xml mm-url tramp-cache mailalias
hippie-exp dabbrev gnus-dired url-cache url-http url-gw url-auth
haskell-mode jcl-w3m w3m-search jcl-work-buffer jcl-games
jcl-text-translator-init text-translator text-translator-window
text-translator-vars text-translator-sites jcl-muse htmlize-hack htmlize
muse-latex muse-html muse-xml-common muse-colors cus-edit cus-start
cus-load muse-publish muse-project muse-protocols muse-regexps muse
muse-nested-tags muse-mode jcl-dictem-init dictem jcl-yaoddmuse
yaoddmuse-extension w3m doc-view jka-compr image-mode timezone w3m-hist
w3m-fb bookmark-w3m w3m-ems w3m-ccl ccl w3m-favicon w3m-image w3m-proc
w3m-util yaoddmuse url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-util url-parse url-vars sgml-mode find-lisp
flow-fill sort smiley gnus-cite mail-extr gnus-bcklg flymake gnus-async
skeleton misearch multi-isearch add-log vc-git scheme org-indent
image-file org-wl org-w3m org-vm org-rmail org-mhe org-mew org-irc
org-jsinfo org-infojs org-html org-info org-gnus org-docview org-bibtex
bibtex org-bbdb jcl-renegade-goblin jcl-home-boot eldoc jcl-status
autorevert network-stream tls jcl-stumpwm jcl-slime slime-fancy
slime-fontifying-fu slime-package-fu slime-references slime-scratch
slime-presentations slime-fuzzy slime-fancy-inspector slime-c-p-c
slime-editing-commands slime-autodoc slime-parse slime-repl slime
derived hyperspec browse-url mule-util flyspell qp parse-time gnus-ml
nndraft nnmh nnfolder nnml gnus-agent gnus-srvr gnus-score score-mode
nnvirtual gnus-msg gnus-art mm-uu mml2015 epg-config mm-view mml-smime
smime dig nntp gnus-cache jcl-gnus-init jcl-gnus gnus-sum nnoo
gnus-group gnus-undo nnmail mail-source gnus-start gnus-spec gnus-int
gnus-range gnus-win mailcap starttls smtpmail sendmail message rfc822
mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus gnus-ems
nnheader mail-utils wid-edit jcl-goblin fuzzy-match jcl-load-beta
jcl-torrent text-translator-load jcl-calendar-init appt jcl-calendar
holidays hol-loaddefs diary-lib diary-loaddefs jcl-emms-init
emms-playing-time emms-mode-line emms-cache emms-info-ogginfo
emms-info-mp3info emms-info later-do emms-playlist-mode emms-player-vlc
emms-player-mplayer emms-player-simple emms-source-playlist
emms-source-file locate emms-setup emms emms-compat jcl-org-init
org-latex org-export-latex org-beamer org-exp ob-exp org-exp-blocks
org-agenda footnote org ob-emacs-lisp ob-tangle ob-ref ob-lob ob-table
org-footnote org-src ob-comint ob-keys ob ob-eval org-pcomplete org-list
org-faces org-compat org-entities org-macs cal-menu calendar
cal-loaddefs jcl-erc-init jcl-file-cache-init jcl-grep-sbg sbg
jcl-ido-init jcl-dired dired-x dired-details wdired dired-aux
jcl-register-init jcl-command-subset-init jcl-generic generic-x
jcl-erlang-init jcl-ssit jcl-sbg jcl-erlang-log bookmark pp jcl-eel
bindat jcl-sbg-ssit erlang-eunit jcl-erlang distel-ie edb patmatch
erl-service derl erlext epmd net-fsm erl distel erlang etags tempo
jcl-safe jcl-abbrev-init jcl-swedish-postfix quail help-mode jcl-ediff
ediff-merg ediff-diff ediff-wind ediff-help ediff-util ediff-mult
ediff-init ediff jcl-term time-stamp ange-ftp jcl-face hl-line
jcl-modes-init jcl-rfc rfcview view goto-addr proced table picture
noutline outline inf-ruby edmacro ruby-mode sh-script hideshow cwarn
jcl-imenu jcl-global-init which-func imenu time winner thingatpt paren
mic-paren printing ps-print ps-def lpr icomplete ispell uniquify
mb-depth midnight whitespace ffap saveplace dired-details-autoloads
eimp-autoloads emms-autoloads erlang-autoloads fuzzy-match-autoloads
haskell-mode-autoloads htmlize-autoloads inf-ruby-autoloads
lua-mode-autoloads mediawiki-autoloads mic-paren-autoloads
muse-autoloads nrepl-autoloads clojure-mode-autoloads slime-autoloads
tabbar-autoloads w3m-autoloads yaoddmuse-autoloads package
tabulated-list jcl-keys-init diff-mode easy-mmode term disp-table ehelp
kmacro tramp tramp-compat auth-source eieio assoc gnus-util mm-util
mail-prsvr password-cache shell pcomplete format-spec tramp-loaddefs
windmove jcl-keys jcl-load-functions jcl-file-cache ert find-func ewoc
debug filecache jcl-elisp byte-opt warnings bytecomp byte-compile cconv
macroexp hi-lock jcl-register jcl-grep grep compile jcl-command-subset
ido jcl-emacsclient jcl-duff jcl-template-init jcl-template jcl-motion
jcl-windows jcl-misc newcomment jcl-compile jcl-recommended
jcl-site-start fpl electric cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs jpt-mode erlang-start
clearcase tq reporter executable dired comint regexp-opt ansi-color ring
info easymenu jcl-times-init advice help-fns advice-preload jcl-times
jcl-util server jcl-load-path cl time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe
lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer loaddefs button faces cus-face files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty emacs)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]