* [Bug libstdc++/108305] FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test
2023-01-05 20:03 [Bug libstdc++/108305] New: FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test danglin at gcc dot gnu.org
@ 2023-01-06 9:40 ` redi at gcc dot gnu.org
2023-01-06 9:51 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-01-06 9:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108305
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
That test expects fopen("noreplace", "wx") to fail if the file already exists.
Does this fail too?
#include <stdio.h>
#include <stddef.h>
#include <assert.h>
int main()
{
FILE* f = fopen("noreplace", "w");
assert(f != NULL);
fclose(f);
f = fopen("noreplace", "wx");
assert(f == NULL);
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/108305] FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test
2023-01-05 20:03 [Bug libstdc++/108305] New: FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test danglin at gcc dot gnu.org
2023-01-06 9:40 ` [Bug libstdc++/108305] " redi at gcc dot gnu.org
@ 2023-01-06 9:51 ` pinskia at gcc dot gnu.org
2023-01-06 11:04 ` redi at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-06 9:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108305
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I suspect hpux does not implement a c11 fopen but only a c99 one ..
"x" was only added for c11 .
Hpux11.11 came out in 2009 after all.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/108305] FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test
2023-01-05 20:03 [Bug libstdc++/108305] New: FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test danglin at gcc dot gnu.org
2023-01-06 9:40 ` [Bug libstdc++/108305] " redi at gcc dot gnu.org
2023-01-06 9:51 ` pinskia at gcc dot gnu.org
@ 2023-01-06 11:04 ` redi at gcc dot gnu.org
2023-01-06 11:09 ` redi at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-01-06 11:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108305
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
But then wouldn't using "x" with fopen fail, return NULL, and set errno to
EINVAL?
It shouldn't just ignore the "x".
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/108305] FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test
2023-01-05 20:03 [Bug libstdc++/108305] New: FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test danglin at gcc dot gnu.org
` (2 preceding siblings ...)
2023-01-06 11:04 ` redi at gcc dot gnu.org
@ 2023-01-06 11:09 ` redi at gcc dot gnu.org
2023-01-06 13:32 ` schwab@linux-m68k.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-01-06 11:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108305
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
My assumption was that targets that don't support exclusive mode for fopen
would fail in exactly that way, and so using std::ios::noreplace would be
"conservatively unsupported". That is, it would always fail to open the file,
even if it doesn't exist. That seems acceptable.
But this test FAIL suggests that the flag is just silently ignored, allowing
non-exclusive access to the file. That is not acceptable, since the flag
*appears* to work, but fails to establish the required invariant.
Maybe we need #ifndef __hpux__ around the declaration and all uses of
std::ios::noreplace.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/108305] FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test
2023-01-05 20:03 [Bug libstdc++/108305] New: FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test danglin at gcc dot gnu.org
` (3 preceding siblings ...)
2023-01-06 11:09 ` redi at gcc dot gnu.org
@ 2023-01-06 13:32 ` schwab@linux-m68k.org
2023-01-06 13:46 ` redi at gcc dot gnu.org
2023-08-16 10:43 ` redi at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: schwab@linux-m68k.org @ 2023-01-06 13:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108305
--- Comment #5 from Andreas Schwab <schwab@linux-m68k.org> ---
Ignoring unknown fopen flags is traditional behavior which is still present
today, both in BSD and GNU. Only the first character is actually checked and
rejected if unknown.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/108305] FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test
2023-01-05 20:03 [Bug libstdc++/108305] New: FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test danglin at gcc dot gnu.org
` (4 preceding siblings ...)
2023-01-06 13:32 ` schwab@linux-m68k.org
@ 2023-01-06 13:46 ` redi at gcc dot gnu.org
2023-08-16 10:43 ` redi at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-01-06 13:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108305
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2023-01-06
Status|UNCONFIRMED |NEW
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Bah.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/108305] FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test
2023-01-05 20:03 [Bug libstdc++/108305] New: FAIL: 27_io/basic_ofstream/open/char/noreplace.cc execution test danglin at gcc dot gnu.org
` (5 preceding siblings ...)
2023-01-06 13:46 ` redi at gcc dot gnu.org
@ 2023-08-16 10:43 ` redi at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-08-16 10:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108305
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I think we need to make __cpp_lib_ios_noreplace depend on some new macro that
is undefined by default, and defined manually in os_defines.h when we know it
works.
The won't work for musl though, as it uses the generic os_defines.h
^ permalink raw reply [flat|nested] 8+ messages in thread