Project

General

Profile

Actions

Bug #5344

open

NLSR should not write nlsrSeqNo.txt in the home directory

Added by Davide Pesavento about 1 month ago. Updated 30 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

It's bad etiquette. FHS defines /var/lib as the directory to hold application state information. Furthermore, XDG defines $XDG_STATE_HOME for similar purposes, with a default value of $HOME/.local/state. When running as a systemd service, we should also consider honoring the $STATE_DIRECTORY env variable.

Actions #1

Updated by Davide Pesavento about 1 month ago

I just remembered that nlsr.conf has a mandatory state-dir setting. So I guess the $HOME logic is only used as a fallback? But what's the point of a fallback if the setting is mandatory?

That being said, this bug is still valid because when I run the unit tests, a nlsrSeqNo.txt file appears in my home directory. That should not happen.

Actions #2

Updated by Alexander Lane about 1 month ago

Davide Pesavento wrote in #note-1:

I just remembered that nlsr.conf has a mandatory state-dir setting. So I guess the $HOME logic is only used as a fallback? But what's the point of a fallback if the setting is mandatory?

That being said, this bug is still valid because when I run the unit tests, a nlsrSeqNo.txt file appears in my home directory. That should not happen.

From looking at the tests, my understanding is that ConfParam objects will default the state directory value to a null string, ergo failing over to $HOME and leaving stray files. I think the question then arises of if we should default to the home directory at all, or instead use /tmp like the unit tests for the SequencingManager tests.

Actions #3

Updated by Davide Pesavento 30 days ago

Alexander Lane wrote in #note-2:

I think the question then arises of if we should default to the home directory at all

I don't see the point of having a default value/fallback at all. But if there is one, it definitely shouldn't be the home dir.

or instead use /tmp like the unit tests for the SequencingManager tests.

NFD uses a temporary dir in the build dir (https://github.com/named-data/NFD/blob/2b43d675e3fba37b5362fab0001ba542bb07b43b/tests/wscript#L31), but a unique subdir of /tmp is fine too.

Actions

Also available in: Atom PDF