Open Mierunski opened 6 months ago
This issue seems to relate to Nordic's Connect SDK. If the issue is present in Zephyr please provide the information requested in the bug template so the it can be reproduced in upstream Zephyr without NCS. Otherwise please file the issue downstream instead.
CC @de-nordic @mniestroj
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.
Affecting me as well, and can also confirm that adding err && err != -EEXIST condition does indeed fix the issue. Nothing to do with Nordic SDK. Zephyr version v3.7.0
Here's the reworked patch I'm using to avoid error on startup, also not sure if it's the actual solution but it works for me - it basically skips calling mkdir_if_not_exists
if root FatFS directory is detected.
diff --git a/subsys/settings/src/settings_file.c b/subsys/settings/src/settings_file.c
index 43dcd1004f5..e75a68c7a21 100644
--- a/subsys/settings/src/settings_file.c
+++ b/subsys/settings/src/settings_file.c
@@ -539,9 +539,15 @@ static int mkdir_for_file(const char *file_path)
if (i > 0 && file_path[i] == '/') {
dir_path[i] = '\0';
- err = mkdir_if_not_exists(dir_path);
- if (err) {
- return err;
+ if (strrchr(dir_path, ':') == &dir_path[strlen(dir_path) - 1]) {
+ LOG_DBG("FatFS root directory detected, skipping mkdir for path: "
+ "%s",
+ dir_path);
+ } else {
+ err = mkdir_if_not_exists(dir_path);
+ if (err) {
+ return err;
+ }
}
}
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.
Describe the bug Settings FILE subsystem is not working with SD card with FAT filesystem, providing file directory with
/SD:/
prefix results in fail to load or create settings file.I'm testing on nRF9160DK with external SD Card module.
When settings file subsystem is trying to create directory for file, it checks directories if they exist one by one. Because mount point is first directory in path,
fs_stat
returns-ENOENT
after thatfs_mkdir
is called which returns-EEXIST
https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/settings/src/settings_file.c#L524For workaround, i tested substitiuting expression in https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/settings/src/settings_file.c#L548 to
err && err != -EEXIST
After that code is working, but it does not seem like a final solutionTo Reproduce Take a board with SD Card, enable Filesystem backend for setting
Expected behavior Settings file backend works correctly
Impact Settings file backend is useless without additional zephyr patch kept separately
Logs and console output
Environment (please complete the following information):