Subject: [Boost-bugs] [Boost C++ Libraries] #3935: stream<file_sink> does not throw an exception and not set fail/bad bits when file is wrong
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-02-16 13:28:02
#3935: stream<file_sink> does not throw an exception and not set fail/bad bits
when file is wrong
------------------------------------+---------------------------------------
Reporter: zxspeccy.cpp@⦠| Owner: turkanis
Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: iostreams
Version: Boost 1.42.0 | Severity: Problem
Keywords: |
------------------------------------+---------------------------------------
I'm trying to write some content to a new file using
boost::stream<file_sink> class.
Unfortunately errors/failures during opening the file are ignored by
boost library.
See attached test.cpp file for snippet.
Above program is started as non root user and have not access for file
/wrong.txt
Result is:[[BR]]
mariusz_at_ppbw:~/boost-1.42$ ./test [[BR]]
boost ver:1_42
[[BR]]
0 0[[BR]]
nothing thrown[[BR]]
mariusz_at_ppbw:~/boost-1.42$ ls /[[BR]]
bin dev initrd.img lost+found opt sbin tmp vmlinuz[[BR]]
boot etc initrd.img.old media proc srv usr
vmlinuz.old[[BR]]
cdrom home lib mnt root sys var[[BR]]
mariusz_at_ppbw:~/boost-1.42$ ldd ./test[[BR]]
linux-gate.so.1 => (0xb7fc4000)[[BR]]
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7eb0000)[[BR]]
libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7e8a000)[[BR]]
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7e6c000)[[BR]]
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7d0e000)[[BR]]
/lib/ld-linux.so.2 (0xb7faa000)[[BR]]
mariusz_at_ppbw:~/boost-1.42$ [[BR]]
Similar program using std::ofstream works as I expected:
- console prints: 1 0[[BR]]
- exception is thrown [[BR]]
I made tests using:[[BR]]
boost 1.42[[BR]]
Ubuntu 8.10 intrepid[[BR]]
g++ (Debian 4.3.2-1.1) 4.3.2[[BR]]
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3935> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC