emacs-pager icon indicating copy to clipboard operation
emacs-pager copied to clipboard

emacs-pager: replace insecure Ruby script with sh version

Open tripleee opened this issue 11 years ago • 1 comments

Use mktemp to create a unique and secure temporary file; avoid clobbering an existing file if the same command is run in parallel sessions, and avoid creating a temporary file with insecure permissions and/or a predictable name.

Also, use shell traps to clean up properly even if interrupted.

tripleee avatar Feb 25 '15 10:02 tripleee

I also did something similar tonight at PR https://github.com/mbriggs/emacs-pager/pull/6, but used Python and "with tempfile as f ...". The shell version only traps a subset of all possible signals, but the Python "with .. as f" means that any signal causes the temp file to go out of scope and get deleted:

gkeramidas avatar Mar 19 '15 05:03 gkeramidas