Hi list.

We've just solved this really weird problem with Mandrake 8 (well - solved
is a harsh word - let's say : we found it why we were going in circles and
wanted to show you the way in case you get lost too :-), which made my
life a bit diificult in the last three days or so -

We have a program which writes a single line (with no new line) to stdout
and quits - this small test program is a good example:
--------------------------------
#include <string.h>
#include <stdio.h>

int main (int argc, char* argv[]) {
    char temp[200];

    sprintf(temp,"test");
    write(1,temp,strlen(temp));
    return 0;
}
-------------------------------

Now, on a MDK72 and any other well behaving 2.2 distro running this would
get you something like this :
-------------------------------
[user@computer user]$ ./test
test[user@computer user]$
-------------------------------
But on MDK8 I got this :
-------------------------------
[user@computer user]$ ./test
[user@computer user]$
-------------------------------
no mention of the output text at all. redirecting stdout to a file and
'cat'ing the file it seemed like it does not do output at all.
stracing proved that not only it does call write() it actually prints what
I want it to print.
Although at first we thought we had a glibc flush problem (the original
program uses printf) or (weird as it may seem) a kernel buffer flushing
problem, and we were about to raise hell on the kernel development mailing
list - the solution was pretty simple :

it seems that the Mandrake 8 default shell - bash 2.04.18 -  sends a
carriage return before printing it's prompt - overwriting everything
written on the same line, as this revised code shows:
--------------------------------
#include <string.h>
#include <stdio.h>

int main (int argc, char* argv[]) {
    char temp[200];

    sprintf(temp,"test");
    write(1,temp,strlen(temp));
    sleep(1);
    return 0;
}
-------------------------------

simply annoying.
I was wandering if I should report this as a bug, and if so - to how ?
Mandrake ?

Oded

p.s. -
All you csh lovers, please no flaims as to the superiority of tcsh over
bash, this is not a good example, as even considering this minor
anoyance, Bash is clearly supreme ;-)


=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to