[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: The darnest thing! (aka: Mandrake 8 is out there(tm))
> 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 ;-)
>
I am not sure about who isn't behaving properly, if any:
[17:02:16 tmp]$ bash --version
GNU bash, version 2.05.0(1)-release (i386-pc-linux-gnu)
Copyright 2000 Free Software Foundation, Inc.
[17:02:19 tmp]$ cat bug.c
#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;
}
[17:02:22 tmp]$ cc -Wall -o bug bug.c
bug.c: In function `main':
bug.c:8: warning: implicit declaration of function `write'
[17:02:33 tmp]$ ./bug
test[17:02:49 tmp]$ diff -c bug1.c bug.c
*** bug1.c Fri Apr 27 17:03:53 2001
--- bug.c Fri Apr 27 16:59:10 2001
***************
*** 1,6 ****
#include <string.h>
#include <stdio.h>
- #include <unistd.h>
int main (int argc, char* argv[]) {
char temp[200];
--- 1,5 ----
[17:04:06 tmp]$ cc -Wall -o bug1 bug1.c
[17:04:49 tmp]$ ./bug1
test[17:04:53 tmp]$
--
Shaul Karl <shaulka@bezeqint.net>
=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il