chrisbra / Recover.vim

A Plugin to show a diff, whenever recovering a buffer
http://www.vim.org/scripts/script.php?script_id=3068
248 stars 25 forks source link

/proc file path misses a slash #17

Closed lyokha closed 11 years ago

lyokha commented 11 years ago

Hello.

After last update i am getting following error when a file is already open:

Обнаружена ошибка при обработке function recover#ConfirmSwapDiff:
строка   20:
E484: Невозможно открыть файл /proc19545/status
E684: list index out of range: 0
E116: Параметры для функции matchstr(readfile(proc)[0], '^Name:\s*\zs.*') заданы неверно
E15: Недопустимое выражение: matchstr(readfile(proc)[0], '^Name:\s*\zs.*')

(it says that it cannot open file /proc19545/status). Next simple patch fixes the issue:

--- autoload/recover.vim    2012-11-22 12:22:27.267845303 +0400
+++ autoload/recover.vim.new    2012-11-22 12:22:17.473710144 +0400
@@ -119,7 +119,7 @@
    " try to get processname from pid
    let pid_pat = 'process ID:\s*\zs\d\+'
    let pid = matchstr(msg, pid_pat)+0
-   let proc = '/proc'. pid. '/status'
+   let proc = '/proc/'. pid. '/status'
    if !empty(pid) && isdirectory('/proc')
        let pname = 'not existing'
        if filereadable('/proc/'. pid. '/status')

Cheers, Alexey.

chrisbra commented 11 years ago

On Thu, November 22, 2012 09:27, lyokha wrote:

Hello.

After last update i am getting following error when a file is already open:

Обнаружена ошибка при обработке function
recover#ConfirmSwapDiff:
строка   20:
E484: Невозможно открыть файл /proc19545/status
E684: list index out of range: 0
E116: Параметры для функции matchstr(readfile(proc)[0],
'^Name:\s*\zs.*') заданы неверно
E15: Недопустимое выражение:
matchstr(readfile(proc)[0], '^Name:\s*\zs.*')

(it says that it cannot open file /proc19545/status). Next simple patch fixes the issue:

--- autoload/recover.vim  2012-11-22 12:22:27.267845303 +0400
+++ autoload/recover.vim.new  2012-11-22 12:22:17.473710144 +0400
@@ -119,7 +119,7 @@
  " try to get processname from pid
  let pid_pat = 'process ID:\s*\zs\d\+'
  let pid = matchstr(msg, pid_pat)+0
- let proc = '/proc'. pid. '/status'
+ let proc = '/proc/'. pid. '/status'
  if !empty(pid) && isdirectory('/proc')
      let pname = 'not existing'
      if filereadable('/proc/'. pid. '/status')

Thanks, I'll include it as soon as I have net access again.

regards, Christian