nvi2 icon indicating copy to clipboard operation
nvi2 copied to clipboard

How to disable temporary and recovery files?

Open liweitianux opened this issue 6 years ago • 3 comments

Hi.

Sometimes, one may be forced to work with a read-only root filesystem, like the rescue mode mentioned in issue #63. However, I cannot find an easy way to tell nvi2 to not create temporary and recovery files. I've tried the followings:

  • nvi -F <file>
  • nvi -c 'set dir=""' <file>

but with no luck... A workaround is to use something like TMPDIR=<writable-directory> nvi <file>. Is there a simpler/cleaner way to deal with this issue? Maybe options to disable temporary file or recovery file or both?

Regards, Aaron

liweitianux avatar Jun 25 '19 15:06 liweitianux

You will need to set both "directory" and "recdir" (for recovery files).

lichray avatar Jun 25 '19 15:06 lichray

Thank you for the prompt reply.

However, I still have the same issue. I've tried the following usages:

  • nvi -c 'set directory="" recdir=""' <file>
  • nvi -c 'unset directory recdir' <file>

The error messages are:

Error: /var/tmp/vi.recover/: Read-only file system
Modifications not recoverable if the session fails
Error: <file>: Read-only file system
Error: Unable to create temporary file: Read-only file system

Were my usages wrong? Could you please suggest a clearer usage? Thanks.

(I'll try it more tomorrow night.)

Regards, Aaron

liweitianux avatar Jun 25 '19 16:06 liweitianux

Rereading you issue, your workaround seems to be correct; I did not mean for disabling TMPDIR. The recdir can be disabled, but there has to be some TMPDIR, because nvi2 (and all nvi variants) need a file system fd to put Berkeley DB file. Does env TMPDIR=. work? If you feel that's still not automatic enough, then we can add some fallback when / is readonly.

zhihaoy avatar Jun 25 '19 17:06 zhihaoy