Public bug reported: Binary package hint: vim
If the TMPDIR environment variable is *not* set, vim will attempt to create temporary files in ./$TMPDIR (a literal directory name containing a dollar sign, not an environment variable expansion). It should instead try /tmp if TMPDIR is not set. Implications: 1. If ./$TMPDIR exists, vim may issue an error message on startup (see below); 2. If vim is started in a directory such as an autofs mountpoint in which any requested directory will exist, vim hangs forever trying to create temporary directories waiting until it finds one that does not exist. This latter case, although quite rare, is the one which alerted me to the problem; I observed the following strace excerpt: stat64("$TMPDIR", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0 getpid() = 15010 time(NULL) = 1200881832 umask(077) = 02 mkdir("$TMPDIR/v896842", 0700) = -1 EEXIST (File exists) umask(02) = 077 umask(077) = 02 mkdir("$TMPDIR/v896842v896843", 0700) = -1 EEXIST (File exists) umask(02) = 077 umask(077) = 02 mkdir("$TMPDIR/v896842v896843v896844", 0700) = -1 EEXIST (File exists) umask(02) = 077 umask(077) = 02 mkdir("$TMPDIR/v896842v896843v896844v896845", 0700 <unfinished ...> ...and so on, indefinitely. I have reproduced the problem in a more conventional directory: [EMAIL PROTECTED]:~$ mkdir \$TMPDIR [EMAIL PROTECTED]:~$ vim Error detected while processing /usr/share/vim/vim71/debian.vim: line 58: E484: Cannot open file /home/mas90/$TMPDIR/v904285/0 Press ENTER or type command to continue >From a brief look through the source, I believe that this is due to a fault in the expand_env_esc function in src/misc1.c: as far as I can tell, when expanding a string containing "$FOO" when environment variable FOO is unset or empty, "$FOO" will remain in the string. (The call to vim_getenv on line 3609 will return NULL if the variable requested is unset/empty, and NULL in *var will cause the conditional starting on line 3739 to fail and hence $FOO will not be replaced in the string.) expand_env_esc is called via expand_env from src/fileio.c:6762, which iterates through the tempdirs array until it finds one which exists; tempdirs is initialised from the macro TEMPDIRNAMES, which is defined (on UNIX) to be "$TMPDIR", "/tmp", ".", "$HOME". I'm running vim 1:7.1-056+2ubuntu2 from gutsy. ** Affects: vim (Ubuntu) Importance: Undecided Status: New -- vim uses ./$TMPDIR (literally, not expanded) as temporary directory https://bugs.launchpad.net/bugs/184719 You received this bug notification because you are a member of Ubuntu Bugs, which is the bug contact for Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs