Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: out of memory error after "edit-command-line"



Hi again,

Update:

Tried to isolate what causes the 'out of memory' errors and found that if
I added quotes the error stopped.
  CL=${(0A)"$(< /proc/$P/cmdline)"}  # OK
  CL=${(0A)$(< /proc/$P/cmdline)}  # out of memory error

I had another script and it worked without the quotes. Compared the two
and found the other script had the option 'extendedglob' set. After adding
the option to the script I attached in the original email the 'out of memory'
errors stopped when there are no quotes.

Not sure what globbing has to do with this. Hopefully someone can
enlighten me. But even so, should zsh ever fail with an 'out of memory'
error? Again, it only happens after exiting 'edit-command-line'.

Regards,

Jim

On Mon, Aug 1, 2022 at 10:47 PM Jim <linux.tech.guy@xxxxxxxxx> wrote:
Hi everyone,

ZSH_VERSION: 5.8 (Distribution, Devuan, still hasn't update)
$ZSH_PATCHLEVEL:  debian/5.8-6+deb11u1
default editor nvim version v0.4.4
Also tested with VIM - Vi IMproved 8.2
terminal emulators/multiplexer:  tmux, xfce4-terminal, st, and kitty(checked on all)

.zshrc
  autoload -Uz edit-command-line
  zle -N edit-command-line
  bindkey -M vicmd v edit-command-line

Created an anonymous function(see attachment ps_via_zsh) by entering edit-command-line
which seems to work ok after exiting editor and hitting enter. But then(after adding code) started
getting out of memory errors(see attachment out_of_memory).  When I recall the anonymous
function from history and execute, no error. Started commenting out lines and found that the issues
stops with the line:

CL=${(0A)$(</proc/$P/cmdline)} ; PP=${AA[PPid]} ; Cmd=${AA[Name]}

commented out. Splitting line found issue to be with CL=${(0A)$(</proc/$P/cmdline)}
Again, recalling from history -- no edit-command-line -- no error.
BTW: /proc/<pid>/cmdline uses NULL as the separator.

QUESTION:  Bug, or am I doing something stupid? Or something with nvim and vim?

Thanks for listening,

Jim Murphy


Messages sorted by: Reverse Date, Date, Thread, Author