-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Accidentally writing to file system when printing to stdout with ESP_LOGx() (IDFGH-12416) #13439
Comments
@voedipus Would you mind posting the code you used in these two steps?
Could you also mention the version of ESP-IDF you are using? |
@igrr I used example project named "file_serving" with minor changes in app_main and changing channel console output to "None" in menuconfig: void app_main(void)
{
ESP_LOGI(TAG, "Starting example");
ESP_ERROR_CHECK(nvs_flash_init());
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* Initialize file storage */
const char* base_path = "/data";
ESP_ERROR_CHECK(example_mount_storage(base_path));
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.
* Read "Establishing Wi-Fi or Ethernet Connection" section in
* examples/protocols/README.md for more information about this function.
*/
ESP_ERROR_CHECK(example_connect());
/* Start the file server */
ESP_ERROR_CHECK(example_start_file_server(base_path));
ESP_LOGI(TAG, "File server started");
FILE* first = NULL;
first = fopen("/data/test1.txt", "w");
FILE* second = NULL;
second = fopen("/data/test2.txt", "w");
while (1){
ESP_LOGE(TAG, "Is this written to FS?");
vTaskDelay(200);
}
} As you can see I open 2 files(test1.txt and test2.txt) and write to stdout using ESP_LOGE() There were no explicit writes to test2.txt, but it's size is more than 0 Contents of the test2.txt file I was able to reproduce this bug using spiffs and littlefs using versions of esp-idf 5.1.2 and 5.2.1 |
Answers checklist.
General issue report
Steps to reproduce:
If channel for console output is UART0 then fopen() opens first file with fileno = 3
The text was updated successfully, but these errors were encountered: