public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/59687] New: The description of ios::noreplace is hilarious
@ 2014-01-05 19:45 giecrilj at stegny dot 2a.pl
  2014-01-06 17:35 ` [Bug libstdc++/59687] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: giecrilj at stegny dot 2a.pl @ 2014-01-05 19:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59687
           Summary: The description of ios::noreplace is hilarious
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: giecrilj at stegny dot 2a.pl

The page "Backwards Compatibility" [1] says:

> For output streams, “nocreate” is probably the default, unless you specify std::ios::trunc ?

Probably???  Could you please estimate the probability?
Also inconsistent with the table at filebuf::open that does not mention "x"
mode to be actually used.

> To be safe, you can open the file for reading, check if it has been opened, and then decide whether you want to create/replace or not.

This may be true when there is only one process and one thread; otherwise it is
blatant disinformation and wishful thinking — see the page "C++ TOCTOU
Vulnerability" in the CERT Secure Coding Manual [2].

___
[1] <URL:
http://gcc.gnu.org/onlinedocs/libstdc++/manual/backwards.html#backwards.third.nocreate_noreplace
> 
[2] <URL:
https://www.securecoding.cert.org/confluence/download/attachments/40402999/09%20Race%20Conditions.pdf
>
>From gcc-bugs-return-439103-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Jan 05 19:46:49 2014
Return-Path: <gcc-bugs-return-439103-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 24292 invoked by alias); 5 Jan 2014 19:46:49 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 24272 invoked by uid 48); 5 Jan 2014 19:46:45 -0000
From: "pab at pabigot dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/59681] SVN 197248 adding N3582 support broke Boost.Regex with -std=c++1y
Date: Sun, 05 Jan 2014 19:46:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: pab at pabigot dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59681-4-CZsMBXWQZN@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59681-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59681-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-01/txt/msg00245.txt.bz2
Content-length: 969

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

--- Comment #3 from Peter A. Bigot <pab at pabigot dot com> ---
But also note [dcl.type.simple] p4:

The type denoted by decltype(e) is defined as follows:
— if e is an unparenthesized id-expression or an unparenthesized class member
access (5.2.5), decltype(e) is the type of the entity named by e. If there is
no such entity, or if e names a set of overloaded functions, the program is
ill-formed;
— otherwise, if e is an xvalue, decltype(e) is T&&, where T is the type of e;
— otherwise, if e is an lvalue, decltype(e) is T&, where T is the type of e;
— otherwise, decltype(e) is the type of e.
The operand of the decltype specifier is an unevaluated operand (Clause 5).

which means decltype((e)) is not necessarily the same as decltype(e).

Perhaps the change was made to make this work, but it has side effects in some
context that does not (explicitly) use decltype.
>From gcc-bugs-return-439104-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Jan 05 19:54:17 2014
Return-Path: <gcc-bugs-return-439104-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 26193 invoked by alias); 5 Jan 2014 19:54:17 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 26177 invoked by uid 48); 5 Jan 2014 19:54:13 -0000
From: "giecrilj at stegny dot 2a.pl" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/59687] The description of ios::noreplace is hilarious
Date: Sun, 05 Jan 2014 19:54:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords: documentation
X-Bugzilla-Severity: major
X-Bugzilla-Who: giecrilj at stegny dot 2a.pl
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59687-4-ZHHdGkWs7v@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59687-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59687-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-01/txt/msg00246.txt.bz2
Content-length: 337

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY687

--- Comment #1 from Christopher Yeleighton <giecrilj at stegny dot 2a.pl> ---
(In reply to Christopher Yeleighton from comment #0)
> Also inconsistent with the table at filebuf::open that does not mention "x"
> mode to be actually used.

Oops, scratch that, I had "noreplace" in mind.


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

* [Bug libstdc++/59687] The description of ios::noreplace is hilarious
  2014-01-05 19:45 [Bug libstdc++/59687] New: The description of ios::noreplace is hilarious giecrilj at stegny dot 2a.pl
@ 2014-01-06 17:35 ` redi at gcc dot gnu.org
  2014-01-10 14:31 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2014-01-06 17:35 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal


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

* [Bug libstdc++/59687] The description of ios::noreplace is hilarious
  2014-01-05 19:45 [Bug libstdc++/59687] New: The description of ios::noreplace is hilarious giecrilj at stegny dot 2a.pl
  2014-01-06 17:35 ` [Bug libstdc++/59687] " redi at gcc dot gnu.org
@ 2014-01-10 14:31 ` redi at gcc dot gnu.org
  2014-01-10 14:33 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2014-01-10 14:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Fri Jan 10 14:30:27 2014
New Revision: 206525

URL: http://gcc.gnu.org/viewcvs?rev=206525&root=gcc&view=rev
Log:
    PR libstdc++/59687
    * doc/xml/manual/backwards_compatibility.xml
    (backwards.third.nocreate_noreplace): Correct and expand.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/doc/xml/manual/backwards_compatibility.xml


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

* [Bug libstdc++/59687] The description of ios::noreplace is hilarious
  2014-01-05 19:45 [Bug libstdc++/59687] New: The description of ios::noreplace is hilarious giecrilj at stegny dot 2a.pl
  2014-01-06 17:35 ` [Bug libstdc++/59687] " redi at gcc dot gnu.org
  2014-01-10 14:31 ` redi at gcc dot gnu.org
@ 2014-01-10 14:33 ` redi at gcc dot gnu.org
  2014-01-11 12:30 ` giecrilj at stegny dot 2a.pl
  2014-01-11 12:57 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2014-01-10 14:33 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.9.0

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
fixed for 4.9


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

* [Bug libstdc++/59687] The description of ios::noreplace is hilarious
  2014-01-05 19:45 [Bug libstdc++/59687] New: The description of ios::noreplace is hilarious giecrilj at stegny dot 2a.pl
                   ` (2 preceding siblings ...)
  2014-01-10 14:33 ` redi at gcc dot gnu.org
@ 2014-01-11 12:30 ` giecrilj at stegny dot 2a.pl
  2014-01-11 12:57 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: giecrilj at stegny dot 2a.pl @ 2014-01-11 12:30 UTC (permalink / raw)
  To: gcc-bugs

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

Christopher Yeleighton <giecrilj at stegny dot 2a.pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|FIXED                       |---

--- Comment #4 from Christopher Yeleighton <giecrilj at stegny dot 2a.pl> ---
(In reply to Jonathan Wakely from comment #2)
> Author: redi
> Date: Fri Jan 10 14:30:27 2014
> New Revision: 206525
>     trunk/libstdc++-v3/doc/xml/manual/backwards_compatibility.xml

You:

Because iostream modes correspond
to <function>fopen(3)</function> modes these flags are not supported.

Me:

The implication is 1⇒1, so this is formally valid.  But correlation is not
causation; in this case, you have (fopen (path, "wx")) both implemented in GNU
and standardised.  So your statement is misleading, at least for (noreplace).

You:

If you need
to check for existence and open a file as a single operation then you will
need to use OS-specific facilities outside the C++ standard library, such
as <function>open(2)</function>

Me:

Maybe it would be worth mentioning how you can construct a stream from a file
descriptor so as to avoid a resource leak (the constructor must not throw for
this scheme to work).  

It seems (noreplace) is more important in practice than (nocreate).  Now that
it is standardised, could you consider providing (__noreplace) instead?

See also <URL:
https://groups.google.com/a/isocpp.org/d/msg/std-proposals/I5z9QIo7KHU/D3eC_NRlMjMJ
>

Meta:

I admit the bug is sort-of fixed but still I tentatively reopen to see if you
would reconsider the text given the remarks above.  Please forgive me if it is
too much disruption for you.
>From gcc-bugs-return-440087-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Jan 11 12:55:40 2014
Return-Path: <gcc-bugs-return-440087-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 28959 invoked by alias); 11 Jan 2014 12:55:40 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 28940 invoked by uid 48); 11 Jan 2014 12:55:36 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/59687] The description of ios::noreplace is hilarious
Date: Sat, 11 Jan 2014 12:55:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords: documentation
X-Bugzilla-Severity: normal
X-Bugzilla-Who: redi at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status resolution
Message-ID: <bug-59687-4-ycaOUGLCH4@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59687-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59687-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-01/txt/msg01229.txt.bz2
Content-length: 669

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY687

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I'm not spending any more time on documentation for features that we don't
support, and that most compilers have not supported since last century.

That chapter of the libstdc++ manual is not the place for people to learn how
to write correct programs.


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

* [Bug libstdc++/59687] The description of ios::noreplace is hilarious
  2014-01-05 19:45 [Bug libstdc++/59687] New: The description of ios::noreplace is hilarious giecrilj at stegny dot 2a.pl
                   ` (3 preceding siblings ...)
  2014-01-11 12:30 ` giecrilj at stegny dot 2a.pl
@ 2014-01-11 12:57 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2014-01-11 12:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
And if you want to request __noreplace as an enhancement then please open a
separate enhancement request.


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

end of thread, other threads:[~2014-01-11 12:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-05 19:45 [Bug libstdc++/59687] New: The description of ios::noreplace is hilarious giecrilj at stegny dot 2a.pl
2014-01-06 17:35 ` [Bug libstdc++/59687] " redi at gcc dot gnu.org
2014-01-10 14:31 ` redi at gcc dot gnu.org
2014-01-10 14:33 ` redi at gcc dot gnu.org
2014-01-11 12:30 ` giecrilj at stegny dot 2a.pl
2014-01-11 12:57 ` redi at gcc dot gnu.org

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).