bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: it seems that variables red by builtin function "read" are modified


From: Chet Ramey
Subject: Re: it seems that variables red by builtin function "read" are modified (or ignored) during execution
Date: Thu, 26 Apr 2007 11:50:42 -0400

> Machine Type: i386-pc-linux-gnu
> 
> Bash Version: 2.05b
> Patch Level: 0
> Release Status: release
> 
> Description:
> When lauching the following script, it occurs that :
> --------------------------------
> data=00000000 00000 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> data=abcd
> data=efghi
> 3
> --------------------------------
> My system is a debian 3.1. The script was correctly running before (maybe en 
> update
> of bash ?)
> mplayer (which is involved in the bug), is in the following version :
> MPlayer 1.0rc1-3.3.5 (C) 2000-2006 MPlayer Team
> CPU: Intel Pentium III Katmai/Pentium III Xeon Tanner (Family: 6, Model: 7, 
> Stepping: 3)
> CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 0
> Compiled for x86 CPU with extensions: MMX MMX2 SSE
> 
> 
> Repeat-By:
> Here is the script :
> --------------------------------
> #!/bin/bash
> 
> temp=/tmp/file.$$
> cat > $temp << EOF
> 00000000 00000 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> 12345678 01234 6789012345678901234567890123456789012345678901234
> 12345678 01234 6789012345678901234567890123456789012345678901234
> 12345678 01234 6789012345678901234567890123456789012345678901234
> 12345678 01234 6789012345678901234567890123456789012345678901 abcd
> 12345678 01234 6789012345678901234567890123456789012345678901234
> 12345678 01234 6789012345678901234567890123456789012345678901234
> 12345678 01234 6789012345678901234567890123456789012345678901234
> 12345678 01234 6789012345678901234567890123456789012345678901 efghi
> EOF
> 
> cat $temp | ( while read data;
>               do
>               echo "data=$data"
>               mplayer "inexistant-file.avi"  2>/dev/null 1>&2
>               let nb=($nb + 1)
>               done
>               echo $nb )
> 
> rm $temp

Since the script works for me without mplayer installed, and (apparently)
fails for you with mplayer installed, I would guess that mplayer is
reading bytes from the standard input stream and `stealing' them from
bash.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                                Live Strong.
Chet Ramey, ITS, CWRU    chet@case.edu    http://tiswww.tis.case.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]