Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix consistent log directory and config dir migration for linux #7665

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kaikli
Copy link
Contributor

@kaikli kaikli commented Dec 16, 2024

This should fix #7654.

I have moved to syncrun log files to the log directory and excluded log files when moving the config dir from the data path to the config path by the migration.

src/gui/application.cpp Outdated Show resolved Hide resolved
src/gui/application.cpp Outdated Show resolved Hide resolved
@kaikli kaikli force-pushed the fix-7654 branch 4 times, most recently from 4e6239c to 2977634 Compare December 18, 2024 07:04
Copy link
Collaborator

@mgallien mgallien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please see my comments

Comment on lines +542 to +545
const QStringList filesList =
!Utility::isWindows()
? QDir(oldDir).entryList(QDir::Files).filter(QRegularExpression("^(?!.*\\.log).*$"))
: QDir(oldDir).entryList(QDir::Files);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused by this change
why do we need to special case windows OS ?

Copy link
Contributor Author

@kaikli kaikli Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of the way how the configPath is created in src/libsync/configfile.cpp#L366

For Windows the whole config directory is moved to the data location. On all other platforms only the configuration is moved to the config location ($XDG_CONFIG_DIR) and the log files remain in the data location ($XDG_DATA_DIR).

On all other platforms the sync run logs are moved from this location at startup and then the directory is again used to write the sync run logs into. On the next start of the application the cycle begins again.

Comment on lines +1116 to +1119
const auto defaultLogDir = QString(
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)
+ QStringLiteral("/logs")
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would create some behavior changes ?

Copy link
Contributor Author

@kaikli kaikli Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, because I find it better to place the log files into the data location ($XDG_DATA_DIR) instead of the config location like the logpath of the sync run logs.

Currently the ./logs directory is located in the config directory, but the sync run logs are written to the data location ($XDG_DATA_DIR). And because this is inconsistent I changed the default log directory to the $XDG_DATA_DIR and use the same directory for the sync run logs logPath.

On Windows the log and config directories are the same because of the way the config path in src/libsync/configfile.cpp#L366 is generated, but on all other platforms it makes more sense to keep them separated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Old log location is recreated and then moving these files to the new location failes on linux
3 participants