nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] Unable to create state directory


From: Benno Schulenberg
Subject: Re: [Nano-devel] Unable to create state directory
Date: Sun, 19 Nov 2017 18:12:08 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0


Op 19-11-17 om 11:37 schreef Brand Huntsman:
On Sun, 19 Nov 2017 10:20:25 +0100 Benno Schulenberg <address@hidden> wrote:
I would choose to just silently skip reading/writing state when the XDG_DATA_* directory does not exist.

Silently as in removing the error message? Histories would be disabled and
the user has no idea why or what to do. That is worse than currently telling
the user to create nano's default config directory.

True.

It could print the error if XDG_DATA_HOME is set and doesn't exist.

That for sure.  Because it is silly to explicitly specify a data directory
that doesn't exist.

If XDG_DATA_HOME isn't set, don't create any directory or print an error but do set the history filenames and return true. Before saving, it should always check if statedir exists and create it if not.

That would work if nano could open just one file.  But when multiple
buffers are open and one is closed, the positions file wants to be
written.  What if creation of the directory fails?  I don't want an
in-nano error message on the status bar.  If it happens again when
the last buffer is closed, the message will appear on the terminal.
But if in the last buffer the cursor was not moved, there would be
no report on not being able to create the directory.

So... it would be better to ignore the spec and try and create the
directory up front (when needed).  Also, if the directory disappeared
while nano was running, I would want to see an error message about
a history that cannot be written when I close nano, instead of nano
silently recreating that directory.

It should probably even do this if XDG_DATA_HOME is set and doesn't exist, a system might set a non-standard path for all users.

A system would set a non-standard DATA path, different for each user,
but the actual path would not exist?  The users (or their programs)
are responsible for creating it when needed?  That sounds silly.

Nano should create the nano subdir, when needed, but the containing
directory should exist -- at the very least when it was explicitly
specified.

(Also, we should take care not to create the sudo problem again.
On a freshly installed system, the first invocation of nano is
likely to be with sudo.  Nano should not create any root-owned
files or directories anywhere in the user's directories.)

Benno



reply via email to

[Prev in Thread] Current Thread [Next in Thread]