On Fri, Jun 16, 2017 at 9:23 AM, Eli Zaretskii <e...@gnu.org> wrote:

> > From: Orgad Shaneh <org...@gmail.com>
> > Date: Fri, 16 Jun 2017 00:46:34 +0300
> >
> > Ok, I found out that the bug is not (entirely) in make. What causes this
> problem is the following patch applied
> > by MSYS2 packages of mingw make:
> >
> > diff -Naur make-4.2.1/main.c make-4.2.1.new/main.c
> > --- make-4.2.1/main.c 2016-05-31 09:17:26.000000000 +0200
> > +++ make-4.2.1.new/main.c 2017-02-20 22:55:09.051617838 +0100
> > @@ -1126,8 +1126,11 @@
> >
> > #endif
> >
> > +/* setlocale interferes with line buffering if using parallel make on
> MinGW */
> > +#ifndef __MINGW32__
> > /* Set up gettext/internationalization support. */
> > setlocale (LC_ALL, "");
> > +#endif
> > /* The cast to void shuts up compiler warnings on systems that
> > disable NLS. */
> > (void)bindtextdomain (PACKAGE, LOCALEDIR);
>
> I'd certainly like to know why "setlocale interferes with line
> buffering if using parallel make on MinGW".  Could you perhaps ask the
> MSYS2 maintainers to report their findings here or on make-w32?
>
> TIA
>

I'm not sure, but you can see in my bug report that the output is
interleaved without this patch.

On Fri, Jun 16, 2017 at 9:29 AM, Eli Zaretskii <e...@gnu.org> wrote:

> > From: Orgad Shaneh <org...@gmail.com>
> > Date: Fri, 16 Jun 2017 01:16:09 +0300
> >
> > ... or not. I still get it even without this patch, when running from
> IDE. Reverting the patch only fixes the issue
> > when running in command line.
> >
> > I did file a bug[1], but this is not the real reason. Probably timing
> issue.
>
> Most probably.  It also could be indirectly caused by your recipes.
>

Unlikely. I reduced it to the most minimal recipe (build a single c++
file), and it still happens

> Another thing I've noticed is that make (on Windows/MinGW) leaves behind
> suspended processes when it is
> > aborted. Maybe one of these processes holds the file and prevents it
> from being deleted?
>
> Could be, you should be able to use Process Explorer to see who holds
> a handle on the files that fail to be deleted.
>

The handle is released immediately after make is done.


> In general, killing subprocesses is problematic on Windows, because
> only child processes can be killed, the grandchildren cannot.
> Therefore, rearranging your build commands might make the issue go
> away.
>

Then this can explain the problem. g++.exe invokes a child process
cc1plus.exe. Maybe g++ is killed, but cc1plus still has the file open. Then
both g++ and make try to unlink the file, but they both fail. I attach a
Process Monitor log for this scenario.

I think g++ is the most common use-case for make, so this must be handled
properly.


>
> > If you can suggest ways to debug and fix this problem, I'll be thankful.
>
> Well, I'd start by posting a minimal Makefile and auxiliary files that
> allow to reproduce the issue.
>

I'll try to create one later.


>
> Another approach would be to try the MinGW build here:
>
>   https://sourceforge.net/projects/ezwinports/files/?source=navbar
>
> where you can also find Make built with Guile support, something I
> don't think MSYS2 guys offer.
>

It's the same.


- Orgad
"Time of Day","Process Name","PID","Operation","Path","Result","Detail"
"11:46:27.1677214","mingw32-make.exe","13368","QueryDirectory","F:\Projects\TrunkPack\GWAPP_git\Modules\GWApp\obj\unlink-test.o","NO SUCH FILE","Filter: unlink-test.o"
"11:46:27.1677882","mingw32-make.exe","13368","QueryDirectory","F:\Projects\TrunkPack\GWAPP_git\Modules\GWApp\unlink-test.cpp","SUCCESS","Filter: unlink-test.cpp, 1: unlink-test.cpp"
"11:46:27.2118299","g++.exe","4292","CreateFile","F:\Projects\TrunkPack\GWAPP_git\Modules\GWApp\unlink-test.cpp","SUCCESS","Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened"
"11:46:27.2118472","g++.exe","4292","QueryBasicInformationFile","F:\Projects\TrunkPack\GWAPP_git\Modules\GWApp\unlink-test.cpp","SUCCESS","CreationTime: 16/06/2017 11:41:27, LastAccessTime: 16/06/2017 11:41:27, LastWriteTime: 16/06/2017 11:35:12, ChangeTime: 16/06/2017 11:44:58, FileAttributes: A"
"11:46:27.2118542","g++.exe","4292","CloseFile","F:\Projects\TrunkPack\GWAPP_git\Modules\GWApp\unlink-test.cpp","SUCCESS",""
"11:46:27.2604228","as.exe","6700","QueryDirectory","F:\Projects\TrunkPack\GWAPP_git\Modules\GWApp\obj\unlink-test.o","NO SUCH FILE","Filter: unlink-test.o"
"11:46:27.2604965","as.exe","6700","CreateFile","F:\Projects\TrunkPack\GWAPP_git\Modules\GWApp\obj\unlink-test.o","SUCCESS","Desired Access: Generic Read/Write, Disposition: OverwriteIf, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: 0, OpenResult: Created"
"11:46:27.2641686","cc1plus.exe","7496","QueryDirectory","F:\Projects\TrunkPack\GWAPP_git\Modules\GWApp\unlink-test.cpp.gch","NO SUCH FILE","Filter: unlink-test.cpp.gch"
"11:46:27.2642248","cc1plus.exe","7496","CreateFile","F:\Projects\TrunkPack\GWAPP_git\Modules\GWApp\unlink-test.cpp","SUCCESS","Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a, OpenResult: Opened"
"11:46:27.2642501","cc1plus.exe","7496","QueryInformationVolume","F:\Projects\TrunkPack\GWAPP_git\Modules\GWApp\unlink-test.cpp","SUCCESS","VolumeCreationTime: 24/05/2017 09:42:58, VolumeSerialNumber: 72FC-71C5, SupportsObjects: True, VolumeLabel: SSD"
"11:46:27.2642597","cc1plus.exe","7496","QueryAllInformationFile","F:\Projects\TrunkPack\GWAPP_git\Modules\GWApp\unlink-test.cpp","BUFFER OVERFLOW","CreationTime: 16/06/2017 11:41:27, LastAccessTime: 16/06/2017 11:41:27, LastWriteTime: 16/06/2017 11:35:12, ChangeTime: 16/06/2017 11:44:58, FileAttributes: A, AllocationSize: 36,864, EndOfFile: 35,978, NumberOfLinks: 1, DeletePending: False, Directory: False, IndexNumber: 0x1900000005e5f6, EaSize: 0, Access: Generic Read, Position: 0, Mode: Synchronous IO Non-Alert, AlignmentRequirement: Word"
"11:46:27.2642796","cc1plus.exe","7496","ReadFile","F:\Projects\TrunkPack\GWAPP_git\Modules\GWApp\unlink-test.cpp","SUCCESS","Offset: 0, Length: 35,978, Priority: Normal"
"11:46:27.2643065","cc1plus.exe","7496","CloseFile","F:\Projects\TrunkPack\GWAPP_git\Modules\GWApp\unlink-test.cpp","SUCCESS",""
"11:46:28.3588322","g++.exe","4292","QueryDirectory","F:\Projects\TrunkPack\GWAPP_git\Modules\GWApp\obj\unlink-test.o","SUCCESS","Filter: unlink-test.o, 1: unlink-test.o"
"11:46:28.3589454","g++.exe","4292","CreateFile","F:\Projects\TrunkPack\GWAPP_git\Modules\GWApp\obj\unlink-test.o","SHARING VIOLATION","Desired Access: Read Attributes, Delete, Disposition: Open, Options: Non-Directory File, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a"
"11:46:28.3593194","mingw32-make.exe","13368","QueryDirectory","F:\Projects\TrunkPack\GWAPP_git\Modules\GWApp\obj\unlink-test.o","SUCCESS","Filter: unlink-test.o, 1: unlink-test.o"
"11:46:28.3598345","mingw32-make.exe","13368","CreateFile","F:\Projects\TrunkPack\GWAPP_git\Modules\GWApp\obj\unlink-test.o","SHARING VIOLATION","Desired Access: Read Attributes, Delete, Disposition: Open, Options: Non-Directory File, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a"
"11:46:28.3620521","as.exe","6700","CloseFile","F:\Projects\TrunkPack\GWAPP_git\Modules\GWApp\obj\unlink-test.o","SUCCESS",""
_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to