Subject: Re: I have same issue in Emacs 24.3.1 (error in process filter: cd: No such directory found via CDPATH environment variable)

From: Johan Claesson <[email-masked]>
Date: Sat, 26 Oct 2013 16:14:05 +0200

Hi Oleksandr,

This error is also depending on the current directory.  Or actually just
how long the current $PWD is.  

If you go to /tmp then printf '%4090s' x should trigger the error. 

I think this error is triggered when the commands output is less than
4096 but the sum of the commands output plus the size of current $PWD is
above 4096. (Or N*4096).  Bash appends the $PWD to the commands output
to tell term.el the current directory.  This is made invisible by
term.el.  On the way from the shell to term.el there seem to be
something that splits stuff that is greater than 4096 into fragments.
And term.el do not currently handle when the $PWD is split across two
fragments.

Attached is term-fix.el which contains the term-emulate-terminal
function with the patch applied.  If you evaluate that the error should
go away.

Regards,

/Johan

Oleksandr Gavenko <[email-masked]> writes:

> I get:
>
>   error in process filter: cd: No such directory found via CDPATH environment variable
>   error in process filter: No such directory found via CDPATH environment variable
>
> when in "M-x term" run:
>
>   ldd `which emacs`
>
> *Backtrace* shown:
>
> Debugger entered--Lisp error: (error "No such directory found via CDPATH environment variable")
>   signal(error ("No such directory found via CDPATH environment variable"))
>   error("No such directory found via CDPATH environment variable")
>   cd("/home/user/devel/my-deve") #[(string) "\306\232\203.\307\207\310H\311U\2031.\312\313\314#.\312\313	T#.\314	O.\315	T\nO!.\fB\211.,\207\310H\316U\203@.\317\314\320O!\207\307\207" [string first-colon second-colon filename fileline term-pending-frame "" t 0 26 string-match ":" 1 string-to-number 47 cd nil] 4]("//home/user/devel/my-deve")  term-emulate-terminal(#<process terminal> "6_64-linux-gnu/libpangoft2-1.0.so.0 (0x00007f01a9ba5000).\n --==XXXXXXX==--	libglapi.so.0 => /usr/lib/x86_64-linux-gnu/libglapi.so.0 (0x00007f01a1589000).\n.//home/user/devel/my-deve")
>
> I drop about 4KiB of ldd output at --==XXXXXXX==-- point.
>
> Original example with:
>
>   printf '%4090s' x
>
> and
>
>  printf '%40000s' x
>
> work without problem.
>
> Links:
>
>   http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13350
>                 24.2; term.el is confused when bash prints almost 4096 bytes
>   http://lists.gnu.org/archive/html/bug-gnu-emacs/2006-10/msg00036.html
>                 CDPATH problem reappears when using octave-2.9.9 from Emacs 23