Public bug reported: Redirect does not seem to work properly when program uses a sleep. I used the following test program. It works well if I do not redirect the output If I redirect the output to a file, I won't see anything in the file. tail -f does not show me anything. I can do redirect if I remove the sleep. I am using 64bits 13.04 with 3.8.0-25-generic #37 kernel. bash version is version 4.2.45(1).
#include <stdio.h> #include <sys/time.h> #include <time.h> int main() { struct timeval tv; struct tm* ltm; while(1) { sleep(1); gettimeofday(&tv, NULL); ltm = localtime(&tv.tv_sec); printf("%s\n", asctime(ltm)); } } ProblemType: Bug DistroRelease: Ubuntu 13.04 Package: bash 4.2-5ubuntu3 ProcVersionSignature: Ubuntu 3.8.0-25.37-generic 3.8.13 Uname: Linux 3.8.0-25-generic x86_64 ApportVersion: 2.9.2-0ubuntu8.1 Architecture: amd64 Date: Thu Jun 27 11:59:39 2013 InstallationDate: Installed on 2013-04-02 (86 days ago) InstallationMedia: Ubuntu 12.10 "Quantal Quetzal" - Release amd64 (20121017.5) MarkForUpload: True ProcEnviron: TERM=xterm PATH=(custom, no user) XDG_RUNTIME_DIR=<set> LANG=en_US.UTF-8 SHELL=/bin/bash SourcePackage: bash UpgradeStatus: Upgraded to raring on 2013-06-23 (3 days ago) ** Affects: bash (Ubuntu) Importance: Undecided Status: New ** Tags: amd64 apport-bug raring -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1195394 Title: redirect program output into a log file does not seem to work properly when there is sleep in the program To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1195394/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs