{"action":"created","issue":{"url":"https://api.github.com/repos/espressif/esp-idf/issues/44","repository_url":"https://api.github.com/repos/espressif/esp-idf","labels_url":"https://api.github.com/repos/espressif/esp-idf/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/espressif/esp-idf/issues/44/comments","events_url":"https://api.github.com/repos/espressif/esp-idf/issues/44/events","html_url":"https://github.com/espressif/esp-idf/issues/44","id":181339718,"number":44,"title":"printf stops printing after first newline","user":{"login":"jmattsson","id":869607,"avatar_url":"https://avatars.githubusercontent.com/u/869607?v=3","gravatar_id":"","url":"https://api.github.com/users/jmattsson","html_url":"https://github.com/jmattsson","followers_url":"https://api.github.com/users/jmattsson/followers","following_url":"https://api.github.com/users/jmattsson/following{/other_user}","gists_url":"https://api.github.com/users/jmattsson/gists{/gist_id}","starred_url":"https://api.github.com/users/jmattsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmattsson/subscriptions","organizations_url":"https://api.github.com/users/jmattsson/orgs","repos_url":"https://api.github.com/users/jmattsson/repos","events_url":"https://api.github.com/users/jmattsson/events{/privacy}","received_events_url":"https://api.github.com/users/jmattsson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-06T07:10:16Z","updated_at":"2016-10-06T07:27:58Z","closed_at":null,"body":"It appears that for some strange reason the regular C `printf()` function stops printing when it encounters the first newline (`\\n`) in a string. This can be trivially reproduced by attempting to print two lines in the one call; see below for a patch to the official 01_hello_world example.\r\n\r\n```\r\ndiff --git i/examples/01_hello_world/main/hello_world_main.c w/examples/01_hello_world/main/hello_world_main.c\r\nindex ad2c0ac..ca907ea 100644\r\n--- i/examples/01_hello_world/main/hello_world_main.c\r\n+++ w/examples/01_hello_world/main/hello_world_main.c\r\n@@ -14,7 +14,7 @@\r\n \r\n void hello_task(void *pvParameter)\r\n {\r\n-    printf(\"Hello world!\\n\");\r\n+    printf(\"Hello world!\\nHiding in plain sight...\\n\");\r\n     for (int i = 10; i >= 0; i--) {\r\n         printf(\"Restarting in %d seconds...\\n\", i);\r\n         vTaskDelay(1000 / portTICK_RATE_MS);\r\n```\r\nDespite applying the above patch, the output stays at:\r\n```\r\nHello world!\r\n```\r\n\r\nIf using the `%s` modifier, a newline in the argument string also causes `printf()` to stop outputting characters, effectively cutting short the output. E.g.\r\n```\r\nprintf(\"Hello%s world!\\n\", \"Hiding\\n in plain sight...\");\r\n```\r\nyields the following output:\r\n```\r\nHelloHiding\r\n```"},"comment":{"url":"https://api.github.com/repos/espressif/esp-idf/issues/comments/251887175","html_url":"https://github.com/espressif/esp-idf/issues/44#issuecomment-251887175","issue_url":"https://api.github.com/repos/espressif/esp-idf/issues/44","id":251887175,"user":{"login":"projectgus","id":205573,"avatar_url":"https://avatars.githubusercontent.com/u/205573?v=3","gravatar_id":"","url":"https://api.github.com/users/projectgus","html_url":"https://github.com/projectgus","followers_url":"https://api.github.com/users/projectgus/followers","following_url":"https://api.github.com/users/projectgus/following{/other_user}","gists_url":"https://api.github.com/users/projectgus/gists{/gist_id}","starred_url":"https://api.github.com/users/projectgus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectgus/subscriptions","organizations_url":"https://api.github.com/users/projectgus/orgs","repos_url":"https://api.github.com/users/projectgus/repos","events_url":"https://api.github.com/users/projectgus/events{/privacy}","received_events_url":"https://api.github.com/users/projectgus/received_events","type":"User","site_admin":false},"created_at":"2016-10-06T07:27:58Z","updated_at":"2016-10-06T07:27:58Z","body":"That @jmattsson . I committed a patch for this into our review queue yesterday, it's a bug in the write syscall.\r\n\r\nBecause everyone's on holidays this week I'm not sure if we'll get the merged to github until next week (review policy), but I might be able to pop up a temporary branch."}}
{"actor":{"display_login":"projectgus"}}