lichray / nvi2

A multibyte fork of the nvi editor for BSD
Other
144 stars 34 forks source link

How to disable temporary and recovery files? #64

Open liweitianux opened 5 years ago

liweitianux commented 5 years ago

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:

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

lichray commented 5 years ago

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

liweitianux commented 5 years ago

Thank you for the prompt reply.

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

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

zhihaoy commented 5 years ago

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.