* [Bug c++/98386] C++20 module: file exists failure and success happen alternatively for windows.
2020-12-19 3:11 [Bug c++/98386] New: C++20 module: file exists failure and success happen alternatively for windows unlvsur at live dot com
@ 2020-12-19 3:13 ` unlvsur at live dot com
2020-12-19 3:18 ` unlvsur at live dot com
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: unlvsur at live dot com @ 2020-12-19 3:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98386
--- Comment #1 from cqwrteur <unlvsur at live dot com> ---
Created attachment 49805
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49805&action=edit
bugged image
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/98386] C++20 module: file exists failure and success happen alternatively for windows.
2020-12-19 3:11 [Bug c++/98386] New: C++20 module: file exists failure and success happen alternatively for windows unlvsur at live dot com
2020-12-19 3:13 ` [Bug c++/98386] " unlvsur at live dot com
@ 2020-12-19 3:18 ` unlvsur at live dot com
2020-12-21 17:06 ` nathan at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: unlvsur at live dot com @ 2020-12-19 3:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98386
--- Comment #2 from cqwrteur <unlvsur at live dot com> ---
My build of GCC for Windows can be found here.
https://github.com/expnkx/mingw-gcc
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/98386] C++20 module: file exists failure and success happen alternatively for windows.
2020-12-19 3:11 [Bug c++/98386] New: C++20 module: file exists failure and success happen alternatively for windows unlvsur at live dot com
2020-12-19 3:13 ` [Bug c++/98386] " unlvsur at live dot com
2020-12-19 3:18 ` unlvsur at live dot com
@ 2020-12-21 17:06 ` nathan at gcc dot gnu.org
2020-12-21 17:11 ` nathan at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-12-21 17:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98386
--- Comment #3 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
Hm does rename(2) fail on windows if the new name exists? (in posix it
replaces, otherwise there's gonna be a race condition)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/98386] C++20 module: file exists failure and success happen alternatively for windows.
2020-12-19 3:11 [Bug c++/98386] New: C++20 module: file exists failure and success happen alternatively for windows unlvsur at live dot com
` (2 preceding siblings ...)
2020-12-21 17:06 ` nathan at gcc dot gnu.org
@ 2020-12-21 17:11 ` nathan at gcc dot gnu.org
2020-12-21 17:12 ` unlvsur at live dot com
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-12-21 17:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98386
--- Comment #4 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
Created attachment 49823
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49823&action=edit
test patch
This does an unlink before the rename, and also adds more logging. If it
fails, please try with -fdump-lang-module added and provide that dump
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/98386] C++20 module: file exists failure and success happen alternatively for windows.
2020-12-19 3:11 [Bug c++/98386] New: C++20 module: file exists failure and success happen alternatively for windows unlvsur at live dot com
` (3 preceding siblings ...)
2020-12-21 17:11 ` nathan at gcc dot gnu.org
@ 2020-12-21 17:12 ` unlvsur at live dot com
2020-12-21 17:14 ` nathan at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: unlvsur at live dot com @ 2020-12-21 17:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98386
--- Comment #5 from cqwrteur <unlvsur at live dot com> ---
(In reply to Nathan Sidwell from comment #4)
> Created attachment 49823 [details]
> test patch
>
> This does an unlink before the rename, and also adds more logging. If it
> fails, please try with -fdump-lang-module added and provide that dump
unlink and rename is a TOCTOU security vulnerability. The correct method must
use openat and NtCreateFile.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/98386] C++20 module: file exists failure and success happen alternatively for windows.
2020-12-19 3:11 [Bug c++/98386] New: C++20 module: file exists failure and success happen alternatively for windows unlvsur at live dot com
` (4 preceding siblings ...)
2020-12-21 17:12 ` unlvsur at live dot com
@ 2020-12-21 17:14 ` nathan at gcc dot gnu.org
2020-12-21 17:35 ` unlvsur at live dot com
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-12-21 17:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98386
Nathan Sidwell <nathan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Ever confirmed|0 |1
Last reconfirmed| |2020-12-21
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/98386] C++20 module: file exists failure and success happen alternatively for windows.
2020-12-19 3:11 [Bug c++/98386] New: C++20 module: file exists failure and success happen alternatively for windows unlvsur at live dot com
` (5 preceding siblings ...)
2020-12-21 17:14 ` nathan at gcc dot gnu.org
@ 2020-12-21 17:35 ` unlvsur at live dot com
2020-12-21 17:43 ` nathan at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: unlvsur at live dot com @ 2020-12-21 17:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98386
--- Comment #6 from cqwrteur <unlvsur at live dot com> ---
(In reply to Nathan Sidwell from comment #3)
> Hm does rename(2) fail on windows if the new name exists? (in posix it
> replaces, otherwise there's gonna be a race condition)
well. tbh, on windows, the safest way to deal with filesystem is to use NT
syscalls. Or you will not be able to access at-series apis.
C++17 filesystem is a horrible mistake since every C++17 filesystem use case is
a TOCTOU
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/98386] C++20 module: file exists failure and success happen alternatively for windows.
2020-12-19 3:11 [Bug c++/98386] New: C++20 module: file exists failure and success happen alternatively for windows unlvsur at live dot com
` (6 preceding siblings ...)
2020-12-21 17:35 ` unlvsur at live dot com
@ 2020-12-21 17:43 ` nathan at gcc dot gnu.org
2020-12-21 17:45 ` unlvsur at live dot com
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-12-21 17:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98386
--- Comment #7 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
Please take your diatribes to /dev/null. Are you able to test the patch?
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/98386] C++20 module: file exists failure and success happen alternatively for windows.
2020-12-19 3:11 [Bug c++/98386] New: C++20 module: file exists failure and success happen alternatively for windows unlvsur at live dot com
` (7 preceding siblings ...)
2020-12-21 17:43 ` nathan at gcc dot gnu.org
@ 2020-12-21 17:45 ` unlvsur at live dot com
2020-12-21 17:46 ` unlvsur at live dot com
2020-12-21 17:51 ` nathan at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: unlvsur at live dot com @ 2020-12-21 17:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98386
--- Comment #8 from cqwrteur <unlvsur at live dot com> ---
(In reply to Nathan Sidwell from comment #7)
> Please take your diatribes to /dev/null. Are you able to test the patch?
Wait a second. I am testing
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/98386] C++20 module: file exists failure and success happen alternatively for windows.
2020-12-19 3:11 [Bug c++/98386] New: C++20 module: file exists failure and success happen alternatively for windows unlvsur at live dot com
` (8 preceding siblings ...)
2020-12-21 17:45 ` unlvsur at live dot com
@ 2020-12-21 17:46 ` unlvsur at live dot com
2020-12-21 17:51 ` nathan at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: unlvsur at live dot com @ 2020-12-21 17:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98386
--- Comment #9 from cqwrteur <unlvsur at live dot com> ---
(In reply to Nathan Sidwell from comment #7)
> Please take your diatribes to /dev/null. Are you able to test the patch?
fixed confirm
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/98386] C++20 module: file exists failure and success happen alternatively for windows.
2020-12-19 3:11 [Bug c++/98386] New: C++20 module: file exists failure and success happen alternatively for windows unlvsur at live dot com
` (9 preceding siblings ...)
2020-12-21 17:46 ` unlvsur at live dot com
@ 2020-12-21 17:51 ` nathan at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-12-21 17:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98386
Nathan Sidwell <nathan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|WAITING |RESOLVED
--- Comment #10 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
e798f081925 2020-12-21 | c++: Windows rename [PR 98412]
^ permalink raw reply [flat|nested] 12+ messages in thread