Fixed, thanks!

Simon

On 09 August 2005 20:45, Adam Sampson wrote:

> While writing a testcase for another bug (details to follow), I found
> that System.Posix.IO.queryFdOption doesn't work.
> 
> The problem appears to be that queryFdOption uses testBit incorrectly;
> it assumes the second argument is the bitmask, when it's actually the
> bit *position* to test. It should be an easy fix (just do a bitwise
> AND and see whether the result's zero instead).
> 
> Here's how to reproduce the problem on my system -- note that it's
> getting the correct results from the underlying system calls, but not
> returning them correctly:
> 
> $ ghc --version
> The Glorious Glasgow Haskell Compilation System, version 6.4
> $ uname -a
> Linux cartman.at.fivegeeks.net 2.6.12.2 #1 Thu Jul 14 15:28:07 BST
> 2005 i686 unknown unknown GNU/Linux
> $ gcc -v
> Reading specs from
> /opt/packages/gcc-3.4.4/bin/../lib/gcc/i686-pc-linux-gnu/3.4.4/specs
> Configured with: ./configure --prefix=/opt --sysconfdir=/etc
> --localstatedir=/var --sharedstatedir=/var/com --enable-__cxa_atexit
> --enable-threads=posix --enable-shared
> --enable-languages=c,c++,java,f77,objc
> Thread model: posix
> gcc version 3.4.4
> $ cat Query.hs
> import System.Posix.IO
> 
> showNBR = do
>       v <- System.Posix.IO.queryFdOption 0
> System.Posix.IO.NonBlockingRead
>       putStr $ "NonBlockingRead = " ++ (show v) ++ "\n"
> 
> main = do
>       showNBR
>       System.Posix.IO.setFdOption 0 System.Posix.IO.NonBlockingRead
> True
>       showNBR
> $ ghc -o query -package unix Query.hs
> $ ./query
> NonBlockingRead = False
> NonBlockingRead = False
> $ strace ./query 2>&1 | grep ETFL
> [...]
> fcntl64(0, F_GETFL)                     = 0x2 (flags O_RDWR)
> fcntl64(0, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
> fcntl64(0, F_GETFL)                     = 0x802 (flags
> O_RDWR|O_NONBLOCK) [...]
> 
> If you need any more information, please let me know.
> 
> Thanks,

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to