You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2007/08/15 03:43:30 UTC

[jira] Created: (STDCXX-522) std::filebuf::overflow(EOF) writes EOF to file in unbuffered mode

std::filebuf::overflow(EOF) writes EOF to file in unbuffered mode
-----------------------------------------------------------------

                 Key: STDCXX-522
                 URL: https://issues.apache.org/jira/browse/STDCXX-522
             Project: C++ Standard Library
          Issue Type: Bug
          Components: 27. Input/Output
    Affects Versions: 4.1.3, 4.1.4
            Reporter: Martin Sebor


The program below should run successfully to completion but instead it aborts (both in 4.1.3 and on trunk):

$ cat t.cpp && make t && LD_LIBRARY_PATH=../lib ./t
#include <cassert>
#include <fstream>
#include <ios>

int main ()
{
    struct: std::filebuf {
        int_type overflow (int_type c) {
            return std::filebuf::overflow (c);
        }
    } buf;

    buf.open ("file", std::ios::out);
    buf.pubsetbuf (0, 0);
    buf.overflow (std::filebuf::traits_type::eof ());
    buf.close ();

    std::ifstream in ("file");
    assert (std::istream::traits_type::eof () == in.get ());
} 
gcc -c -I/amd/devco/sebor/stdcxx-4.1.3/include/ansi -D_RWSTDDEBUG   -pthread -D_RWSTD_USE_CONFIG -I/build/sebor/stdcxx-4.1.3-gcc-3.4.3_6-15D/include -I/amd/devco/sebor/stdcxx-4.1.3/include -I/amd/devco/sebor/stdcxx-4.1.3/examples/include  -pedantic -nostdinc++ -g  -m64 -Wall -W -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align  t.cpp
gcc t.o -o t -pthread -m64 -L/build/sebor/stdcxx-4.1.3-gcc-3.4.3_6-15D/lib -lstd15D  -lsupc++ -lm
t: t.cpp:19: int main(): Assertion `std::istream::traits_type::eof () == in.get ()' failed.
Aborted


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (STDCXX-522) std::filebuf::overflow(EOF) writes EOF to file in unbuffered mode

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-522?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12521798 ] 

Martin Sebor commented on STDCXX-522:
-------------------------------------

See the following thread for a patch and a discussion of it:
http://www.mail-archive.com/stdcxx-dev@incubator.apache.org/msg04351.html

> std::filebuf::overflow(EOF) writes EOF to file in unbuffered mode
> -----------------------------------------------------------------
>
>                 Key: STDCXX-522
>                 URL: https://issues.apache.org/jira/browse/STDCXX-522
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 27. Input/Output
>    Affects Versions: 4.1.4, 4.1.3
>            Reporter: Martin Sebor
>
> The program below should run successfully to completion but instead it aborts (both in 4.1.3 and on trunk):
> $ cat t.cpp && make t && LD_LIBRARY_PATH=../lib ./t
> #include <cassert>
> #include <fstream>
> #include <ios>
> int main ()
> {
>     struct: std::filebuf {
>         int_type overflow (int_type c) {
>             return std::filebuf::overflow (c);
>         }
>     } buf;
>     buf.open ("file", std::ios::out);
>     buf.pubsetbuf (0, 0);
>     buf.overflow (std::filebuf::traits_type::eof ());
>     buf.close ();
>     std::ifstream in ("file");
>     assert (std::istream::traits_type::eof () == in.get ());
> } 
> gcc -c -I/amd/devco/sebor/stdcxx-4.1.3/include/ansi -D_RWSTDDEBUG   -pthread -D_RWSTD_USE_CONFIG -I/build/sebor/stdcxx-4.1.3-gcc-3.4.3_6-15D/include -I/amd/devco/sebor/stdcxx-4.1.3/include -I/amd/devco/sebor/stdcxx-4.1.3/examples/include  -pedantic -nostdinc++ -g  -m64 -Wall -W -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align  t.cpp
> gcc t.o -o t -pthread -m64 -L/build/sebor/stdcxx-4.1.3-gcc-3.4.3_6-15D/lib -lstd15D  -lsupc++ -lm
> t: t.cpp:19: int main(): Assertion `std::istream::traits_type::eof () == in.get ()' failed.
> Aborted

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (STDCXX-522) std::filebuf::overflow(EOF) writes EOF to file in unbuffered mode

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-522?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor reassigned STDCXX-522:
-----------------------------------

    Assignee: Martin Sebor

> std::filebuf::overflow(EOF) writes EOF to file in unbuffered mode
> -----------------------------------------------------------------
>
>                 Key: STDCXX-522
>                 URL: https://issues.apache.org/jira/browse/STDCXX-522
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 27. Input/Output
>    Affects Versions: 4.1.4, 4.1.3
>            Reporter: Martin Sebor
>            Assignee: Martin Sebor
>
> The program below should run successfully to completion but instead it aborts (both in 4.1.3 and on trunk):
> $ cat t.cpp && make t && LD_LIBRARY_PATH=../lib ./t
> #include <cassert>
> #include <fstream>
> #include <ios>
> int main ()
> {
>     struct: std::filebuf {
>         int_type overflow (int_type c) {
>             return std::filebuf::overflow (c);
>         }
>     } buf;
>     buf.open ("file", std::ios::out);
>     buf.pubsetbuf (0, 0);
>     buf.overflow (std::filebuf::traits_type::eof ());
>     buf.close ();
>     std::ifstream in ("file");
>     assert (std::istream::traits_type::eof () == in.get ());
> } 
> gcc -c -I/amd/devco/sebor/stdcxx-4.1.3/include/ansi -D_RWSTDDEBUG   -pthread -D_RWSTD_USE_CONFIG -I/build/sebor/stdcxx-4.1.3-gcc-3.4.3_6-15D/include -I/amd/devco/sebor/stdcxx-4.1.3/include -I/amd/devco/sebor/stdcxx-4.1.3/examples/include  -pedantic -nostdinc++ -g  -m64 -Wall -W -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align  t.cpp
> gcc t.o -o t -pthread -m64 -L/build/sebor/stdcxx-4.1.3-gcc-3.4.3_6-15D/lib -lstd15D  -lsupc++ -lm
> t: t.cpp:19: int main(): Assertion `std::istream::traits_type::eof () == in.get ()' failed.
> Aborted

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (STDCXX-522) std::filebuf::overflow(EOF) writes EOF to file in unbuffered mode

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-522?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor closed STDCXX-522.
-------------------------------

    Resolution: Fixed

Fixed by the committed patch. Regression test added to the test suite.

> std::filebuf::overflow(EOF) writes EOF to file in unbuffered mode
> -----------------------------------------------------------------
>
>                 Key: STDCXX-522
>                 URL: https://issues.apache.org/jira/browse/STDCXX-522
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 27. Input/Output
>    Affects Versions: 4.1.3, 4.1.4
>            Reporter: Martin Sebor
>            Assignee: Martin Sebor
>             Fix For: 4.2
>
>
> The program below should run successfully to completion but instead it aborts (both in 4.1.3 and on trunk):
> $ cat t.cpp && make t && LD_LIBRARY_PATH=../lib ./t
> #include <cassert>
> #include <fstream>
> #include <ios>
> int main ()
> {
>     struct: std::filebuf {
>         int_type overflow (int_type c) {
>             return std::filebuf::overflow (c);
>         }
>     } buf;
>     buf.open ("file", std::ios::out);
>     buf.pubsetbuf (0, 0);
>     buf.overflow (std::filebuf::traits_type::eof ());
>     buf.close ();
>     std::ifstream in ("file");
>     assert (std::istream::traits_type::eof () == in.get ());
> } 
> gcc -c -I/amd/devco/sebor/stdcxx-4.1.3/include/ansi -D_RWSTDDEBUG   -pthread -D_RWSTD_USE_CONFIG -I/build/sebor/stdcxx-4.1.3-gcc-3.4.3_6-15D/include -I/amd/devco/sebor/stdcxx-4.1.3/include -I/amd/devco/sebor/stdcxx-4.1.3/examples/include  -pedantic -nostdinc++ -g  -m64 -Wall -W -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align  t.cpp
> gcc t.o -o t -pthread -m64 -L/build/sebor/stdcxx-4.1.3-gcc-3.4.3_6-15D/lib -lstd15D  -lsupc++ -lm
> t: t.cpp:19: int main(): Assertion `std::istream::traits_type::eof () == in.get ()' failed.
> Aborted

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (STDCXX-522) std::filebuf::overflow(EOF) writes EOF to file in unbuffered mode

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-522?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor updated STDCXX-522:
--------------------------------

    Fix Version/s: 4.2

Scheduled for 4.2.

> std::filebuf::overflow(EOF) writes EOF to file in unbuffered mode
> -----------------------------------------------------------------
>
>                 Key: STDCXX-522
>                 URL: https://issues.apache.org/jira/browse/STDCXX-522
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 27. Input/Output
>    Affects Versions: 4.1.3, 4.1.4
>            Reporter: Martin Sebor
>            Assignee: Martin Sebor
>             Fix For: 4.2
>
>
> The program below should run successfully to completion but instead it aborts (both in 4.1.3 and on trunk):
> $ cat t.cpp && make t && LD_LIBRARY_PATH=../lib ./t
> #include <cassert>
> #include <fstream>
> #include <ios>
> int main ()
> {
>     struct: std::filebuf {
>         int_type overflow (int_type c) {
>             return std::filebuf::overflow (c);
>         }
>     } buf;
>     buf.open ("file", std::ios::out);
>     buf.pubsetbuf (0, 0);
>     buf.overflow (std::filebuf::traits_type::eof ());
>     buf.close ();
>     std::ifstream in ("file");
>     assert (std::istream::traits_type::eof () == in.get ());
> } 
> gcc -c -I/amd/devco/sebor/stdcxx-4.1.3/include/ansi -D_RWSTDDEBUG   -pthread -D_RWSTD_USE_CONFIG -I/build/sebor/stdcxx-4.1.3-gcc-3.4.3_6-15D/include -I/amd/devco/sebor/stdcxx-4.1.3/include -I/amd/devco/sebor/stdcxx-4.1.3/examples/include  -pedantic -nostdinc++ -g  -m64 -Wall -W -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align  t.cpp
> gcc t.o -o t -pthread -m64 -L/build/sebor/stdcxx-4.1.3-gcc-3.4.3_6-15D/lib -lstd15D  -lsupc++ -lm
> t: t.cpp:19: int main(): Assertion `std::istream::traits_type::eof () == in.get ()' failed.
> Aborted

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.