public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/24217]  New: filebuf.open call sets the error bits incorrectly
@ 2005-10-05 17:10 hemasai at yahoo dot com
  2005-10-06 12:27 ` [Bug libstdc++/24217] " pcarlini at suse dot de
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: hemasai at yahoo dot com @ 2005-10-05 17:10 UTC (permalink / raw)
  To: gcc-bugs

We are using filebuf.open call to open a file in readonly mode in a
multi-threaded application.  The result of the open call is checked with
is_open.  The truss log shows that the file was opened successfully giving the
file handle.  However, the application log shows that the open call failed and
that fail() was true with rdstate=4.  This behaviour is seen only after a few
minutes of application running (during which time it successfully opens the
same file).


-- 
           Summary: filebuf.open call sets the error bits incorrectly
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hemasai at yahoo dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24217


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/24217] filebuf.open call sets the error bits incorrectly
  2005-10-05 17:10 [Bug c++/24217] New: filebuf.open call sets the error bits incorrectly hemasai at yahoo dot com
@ 2005-10-06 12:27 ` pcarlini at suse dot de
  2005-10-06 18:12 ` hemasai at yahoo dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pcarlini at suse dot de @ 2005-10-06 12:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pcarlini at suse dot de  2005-10-06 12:27 -------
Hi. Certaintly, we cannot hope to debug further the issue without a proper,
self-contained, piece of code useful to reproduce the problem: this is a
strict requirement for any PR, in particular for very hard to reproduce
issues related to MT. That said, I'm afraid you are assuming a level of MT
safety that we don't (wo don't *want*, I would say, but this is very large
topic and the actual guarantees are also highly dependent on the underlying
libc, which we don't control, unfortunately) provide: for example, if running
your application single-threaded or protecting the filebuf operations with a
mutex avoids the problem, then very likely we would not consider the behavior
a bug.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24217


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/24217] filebuf.open call sets the error bits incorrectly
  2005-10-05 17:10 [Bug c++/24217] New: filebuf.open call sets the error bits incorrectly hemasai at yahoo dot com
  2005-10-06 12:27 ` [Bug libstdc++/24217] " pcarlini at suse dot de
@ 2005-10-06 18:12 ` hemasai at yahoo dot com
  2005-10-06 18:32 ` pcarlini at suse dot de
  2005-12-16 18:43 ` pcarlini at suse dot de
  3 siblings, 0 replies; 5+ messages in thread
From: hemasai at yahoo dot com @ 2005-10-06 18:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hemasai at yahoo dot com  2005-10-06 18:12 -------
sample code:
fn(const char* fname)
{
   ifstream fstr;

   if (!fname)
      return;

   fstr.clear();
      fstr.open(fname, ios::in | ios::nocreate);
   if (!(fstr.is_open())) {
            cout << "rdstate():" << fstr.rdstate();
            cout << "bad():" << fstr.bad();
            cout << "fail():" << fstr.fail();
            return;
   }
//Read the file contents
}

As you can see, the fstr is a stack variable that is used to access the file. 
The flags were cleared before the open call. When it failed rdstate was set to
4.
This function call successfully opened the file multiple times before the
failure.


-- 

hemasai at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |UNCONFIRMED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24217


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/24217] filebuf.open call sets the error bits incorrectly
  2005-10-05 17:10 [Bug c++/24217] New: filebuf.open call sets the error bits incorrectly hemasai at yahoo dot com
  2005-10-06 12:27 ` [Bug libstdc++/24217] " pcarlini at suse dot de
  2005-10-06 18:12 ` hemasai at yahoo dot com
@ 2005-10-06 18:32 ` pcarlini at suse dot de
  2005-12-16 18:43 ` pcarlini at suse dot de
  3 siblings, 0 replies; 5+ messages in thread
From: pcarlini at suse dot de @ 2005-10-06 18:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pcarlini at suse dot de  2005-10-06 18:32 -------
(In reply to comment #2)
> sample code:

Sorry, but this is not useful. We need a *self-contained* source file, which
we can compile and run as-is, using your very same build options. We need to
exactly reproduce the problem in all its details before taking any further
action.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24217


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/24217] filebuf.open call sets the error bits incorrectly
  2005-10-05 17:10 [Bug c++/24217] New: filebuf.open call sets the error bits incorrectly hemasai at yahoo dot com
                   ` (2 preceding siblings ...)
  2005-10-06 18:32 ` pcarlini at suse dot de
@ 2005-12-16 18:43 ` pcarlini at suse dot de
  3 siblings, 0 replies; 5+ messages in thread
From: pcarlini at suse dot de @ 2005-12-16 18:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pcarlini at suse dot de  2005-12-16 18:43 -------
Feedback not forthcoming.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24217


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-12-16 18:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-05 17:10 [Bug c++/24217] New: filebuf.open call sets the error bits incorrectly hemasai at yahoo dot com
2005-10-06 12:27 ` [Bug libstdc++/24217] " pcarlini at suse dot de
2005-10-06 18:12 ` hemasai at yahoo dot com
2005-10-06 18:32 ` pcarlini at suse dot de
2005-12-16 18:43 ` pcarlini at suse dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).