Unlink failure on abort

classic Classic list List threaded Threaded
32 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Unlink failure on abort

Orgad Shaneh
Hi,

I'm using mingw32-make 4.2.1 from MSYS2/mingw32.

When I abort a build, make fails to unlink the intermediate files. I previously used 4.1.90, and I don't remember having these problems.

This happens even for a single job (without -j).

Output:
main.cpp
mingw32-make[1]: *** Deleting file 'obj/main.o'
mingw32-make[1]: unlink: obj/main.o: Permission denied
^CTerminate batch job (Y/N)? y
mingw32-make[1]: *** [Makefile:7178: obj/main.o] Error 255
Terminate batch job (Y/N)? y
mingw32-make: *** [Makefile:5574: app.exe] Error 255

- Orgad

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unlink failure on abort

Orgad Shaneh
On Thu, Jun 15, 2017 at 10:33 PM, Orgad Shaneh <[hidden email]> wrote:
Hi,

I'm using mingw32-make 4.2.1 from MSYS2/mingw32.

When I abort a build, make fails to unlink the intermediate files. I previously used 4.1.90, and I don't remember having these problems.

This happens even for a single job (without -j).

Output:
main.cpp
mingw32-make[1]: *** Deleting file 'obj/main.o'
mingw32-make[1]: unlink: obj/main.o: Permission denied
^CTerminate batch job (Y/N)? y
mingw32-make[1]: *** [Makefile:7178: obj/main.o] Error 255
Terminate batch job (Y/N)? y
mingw32-make: *** [Makefile:5574: app.exe] Error 255

- Orgad


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

If I revert the patch, delete works as expected.

I'll file a bug there.

- Orgad

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unlink failure on abort

Orgad Shaneh
On Fri, Jun 16, 2017 at 12:46 AM, Orgad Shaneh <[hidden email]> wrote:
On Thu, Jun 15, 2017 at 10:33 PM, Orgad Shaneh <[hidden email]> wrote:
Hi,

I'm using mingw32-make 4.2.1 from MSYS2/mingw32.

When I abort a build, make fails to unlink the intermediate files. I previously used 4.1.90, and I don't remember having these problems.

This happens even for a single job (without -j).

Output:
main.cpp
mingw32-make[1]: *** Deleting file 'obj/main.o'
mingw32-make[1]: unlink: obj/main.o: Permission denied
^CTerminate batch job (Y/N)? y
mingw32-make[1]: *** [Makefile:7178: obj/main.o] Error 255
Terminate batch job (Y/N)? y
mingw32-make: *** [Makefile:5574: app.exe] Error 255

- Orgad


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

If I revert the patch, delete works as expected.

I'll file a bug there.

- Orgad


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

It doesn't reproduce with GnuWin 3.81, but that's ancient, and I need some fixes from later versions.

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?

If you can suggest ways to debug and fix this problem, I'll be thankful.

Thanks.

- Orgad


_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unlink failure on abort

Henrik Carlqvist-2
On Fri, 16 Jun 2017 01:16:09 +0300
Orgad Shaneh <[hidden email]> wrote:

> > On Thu, Jun 15, 2017 at 10:33 PM, Orgad Shaneh <[hidden email]>
> > wrote:
> >> mingw32-make[1]: *** Deleting file 'obj/main.o'
> >> mingw32-make[1]: unlink: obj/main.o: Permission denied

> 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?
>
> If you can suggest ways to debug and fix this problem, I'll be thankful.

I have seens similar problems when running make in mingw in a virtualized
qemu environment when compiling on network shared drives which are shared
by some versions of samba. For me possible workarounds have been to switch
working directory to a local drive of the virtualized machine or to switch
to an older version of samba. I had an old version 2.2.10 of samba laying
around only for the purpose of working together with qemu and
compilations. These problems seems to have disappeared about a year ago
with the latests versions of qemu and/or samba.

regards Henrik

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unlink failure on abort

Orgad Shaneh
On Friday, June 16, 2017, Henrik Carlqvist <[hidden email]> wrote:
On Fri, 16 Jun 2017 01:16:09 +0300
Orgad Shaneh <<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;orgads@gmail.com&#39;)">orgads@...> wrote:

> > On Thu, Jun 15, 2017 at 10:33 PM, Orgad Shaneh <<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;orgads@gmail.com&#39;)">orgads@...>
> > wrote:
> >> mingw32-make[1]: *** Deleting file 'obj/main.o'
> >> mingw32-make[1]: unlink: obj/main.o: Permission denied

> 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?
>
> If you can suggest ways to debug and fix this problem, I'll be thankful.

I have seens similar problems when running make in mingw in a virtualized
qemu environment when compiling on network shared drives which are shared
by some versions of samba. For me possible workarounds have been to switch
working directory to a local drive of the virtualized machine or to switch
to an older version of samba. I had an old version 2.2.10 of samba laying
around only for the purpose of working together with qemu and
compilations. These problems seems to have disappeared about a year ago
with the latests versions of qemu and/or samba.

regards Henrik

Thanks. In my case, I build locally. No network involved.

- Orgad 

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unlink failure on abort

Eli Zaretskii
In reply to this post by Orgad Shaneh
> From: Orgad Shaneh <[hidden email]>
> Date: Thu, 15 Jun 2017 22:33:30 +0300
>
> When I abort a build, make fails to unlink the intermediate files. I previously used 4.1.90, and I don't remember
> having these problems.
>
> This happens even for a single job (without -j).
>
> Output:
> main.cpp
> mingw32-make[1]: *** Deleting file 'obj/main.o'
> mingw32-make[1]: unlink: obj/main.o: Permission denied
> ^CTerminate batch job (Y/N)? y
> mingw32-make[1]: *** [Makefile:7178: obj/main.o] Error 255
> Terminate batch job (Y/N)? y
> mingw32-make: *** [Makefile:5574: app.exe] Error 255

Why does it say "Terminate batch job (Y/N)?" -- what batch job is
involved in this?  Do you have recipe commands which invoke cmd.exe in
a way that requires Make to go via temporary batch files, perhaps?  If
so, it's possible that this is the (indirect) reason for the problem.
Do you see similar problems with commands that don't need batch files?

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unlink failure on abort

Eli Zaretskii
In reply to this post by Orgad Shaneh
> From: Orgad Shaneh <[hidden email]>
> 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

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unlink failure on abort

Eli Zaretskii
In reply to this post by Orgad Shaneh
> From: Orgad Shaneh <[hidden email]>
> 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.

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

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.

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

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.

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unlink failure on abort

Orgad Shaneh
In reply to this post by Eli Zaretskii
On Fri, Jun 16, 2017 at 9:23 AM, Eli Zaretskii <[hidden email]> wrote:
> From: Orgad Shaneh <[hidden email]>
> 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 <[hidden email]> wrote:
> From: Orgad Shaneh <[hidden email]>
> 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

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make

unlink.csv (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unlink failure on abort

Orgad Shaneh
In reply to this post by Eli Zaretskii
On Fri, Jun 16, 2017 at 9:06 AM, Eli Zaretskii <[hidden email]> wrote:
> From: Orgad Shaneh <[hidden email]>
> Date: Thu, 15 Jun 2017 22:33:30 +0300
>
> When I abort a build, make fails to unlink the intermediate files. I previously used 4.1.90, and I don't remember
> having these problems.
>
> This happens even for a single job (without -j).
>
> Output:
> main.cpp
> mingw32-make[1]: *** Deleting file 'obj/main.o'
> mingw32-make[1]: unlink: obj/main.o: Permission denied
> ^CTerminate batch job (Y/N)? y
> mingw32-make[1]: *** [Makefile:7178: obj/main.o] Error 255
> Terminate batch job (Y/N)? y
> mingw32-make: *** [Makefile:5574: app.exe] Error 255

Why does it say "Terminate batch job (Y/N)?" -- what batch job is
involved in this?  Do you have recipe commands which invoke cmd.exe in
a way that requires Make to go via temporary batch files, perhaps?  If
so, it's possible that this is the (indirect) reason for the problem.
Do you see similar problems with commands that don't need batch files?

My build step is `@echo $< && g++ -c -o obj/unlink-test.o unlink-test.cpp`, so make automatically creates a batch file to run that.

I tried removing the echo, and just invoke g++ but it's the same...

- Orgad

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unlink failure on abort

Orgad Shaneh
In reply to this post by Orgad Shaneh
On Fri, Jun 16, 2017 at 11:49 AM, Orgad Shaneh <[hidden email]> wrote:
On Fri, Jun 16, 2017 at 9:23 AM, Eli Zaretskii <[hidden email]> wrote:
> From: Orgad Shaneh <[hidden email]>
> 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 <[hidden email]> wrote:
> From: Orgad Shaneh <[hidden email]>
> 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

Ok, I was able to create a minimal example. It happens only with g++ -pipe.

fib.cpp (takes very long to compile):
#include <iostream>

template <int TreePos, int N>
struct FibSlow_t {
    enum { value = FibSlow_t<TreePos, N - 1>::value + 
            FibSlow_t<TreePos + (1 << N), N - 2>::value, };
};

template <int TreePos> struct FibSlow_t<TreePos, 1> {
    enum { value = 1 };
};
 
// Explicitly specialized for N==1
template <int TreePos> struct FibSlow_t<TreePos, 0> {
    enum { value = 0 };
};

using namespace std;

int main()
{
cout<<FibSlow_t<0, 70>::value<<endl;
}

-------

Makefile:
fib.o: fib.cpp
g++ -pipe -c -o fib.o fib.cpp


Run make fib.o, then Ctrl-C.

- Orgad

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unlink failure on abort

Eli Zaretskii
In reply to this post by Orgad Shaneh
> From: Orgad Shaneh <[hidden email]>
> Date: Fri, 16 Jun 2017 11:49:33 +0300
> Cc: [hidden email]
>
>  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.

Interleaved output is not a problem, it's expected behavior.  And it
has nothing to do with buffering, since several different instances of
make are simultaneously writing to the same device.

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unlink failure on abort

Eli Zaretskii
In reply to this post by Orgad Shaneh
> From: Orgad Shaneh <[hidden email]>
> Date: Fri, 16 Jun 2017 11:49:33 +0300
> Cc: [hidden email]
>
>  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 don't see any calls to DeleteFile in this log.  I expected to see at
least one that failed with ERROR_ACCESS_DENIED.  What am I missing?

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unlink failure on abort

Orgad Shaneh
On Fri, Jun 16, 2017 at 3:52 PM, Eli Zaretskii <[hidden email]> wrote:
> From: Orgad Shaneh <[hidden email]>
> Date: Fri, 16 Jun 2017 11:49:33 +0300
> Cc: [hidden email]
>
>  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 don't see any calls to DeleteFile in this log.  I expected to see at
least one that failed with ERROR_ACCESS_DENIED.  What am I missing?

There is SHARING_VIOLATION for both g++.exe and mingw32-make.exe

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

> Interleaved output is not a problem, it's expected behavior.  And it
> has nothing to do with buffering, since several different instances of
> make are simultaneously writing to the same device.

By "interleaved" I mean that in the same line there is "expected" output and interferences. This happens even without -j. In the example that I gave in that bug report, it was caused by ^C, which looked like this:

make: *** Deleting file 'obj/m^ainC.oTerminate batch job (Y/N)? '
Is this expected? With the patch it doesn't happen.

- Orgad

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unlink failure on abort

Eli Zaretskii
In reply to this post by Orgad Shaneh
> From: Orgad Shaneh <[hidden email]>
> Date: Fri, 16 Jun 2017 14:24:13 +0300
> Cc: [hidden email]
>
> Ok, I was able to create a minimal example. It happens only with g++ -pipe.

Thanks, but I couldn't reproduce the problem on my main development
machine.  In my case, Make succeeds to delete the file every time I
try the recipe.  I will try later on other systems to which I have
access.

If you could capture a ProcessMonitor log with the failure, perhaps we
could start to understand what's going on.

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unlink failure on abort

Eli Zaretskii
> Date: Fri, 16 Jun 2017 16:15:31 +0300
> From: Eli Zaretskii <[hidden email]>
> Cc: [hidden email]
>
> > Ok, I was able to create a minimal example. It happens only with g++ -pipe.
>
> Thanks, but I couldn't reproduce the problem on my main development
> machine.

Correction: I do succeed sometimes to reproduce it, but only very
rarely, and only if I wait for about 20 sec before hitting Ctrl-C.

What's more important, once Make exits, the file fib.o is gone, the
error message notwithstanding.  Is it left on your system?

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unlink failure on abort

Eli Zaretskii
In reply to this post by Orgad Shaneh
> From: Orgad Shaneh <[hidden email]>
> Date: Fri, 16 Jun 2017 15:59:09 +0300
> Cc: [hidden email]
>
>  I don't see any calls to DeleteFile in this log. I expected to see at
>  least one that failed with ERROR_ACCESS_DENIED. What am I missing?
>
> There is SHARING_VIOLATION for both g++.exe and mingw32-make.exe

Ah, okay.  But then the problem is not with child processes of g++,
it's with g++ itself, right?

And on my system, the file is removed after Make exits, when I use
your recipe.

> > Interleaved output is not a problem, it's expected behavior. And it
> > has nothing to do with buffering, since several different instances of
> > make are simultaneously writing to the same device.
>
> By "interleaved" I mean that in the same line there is "expected" output and interferences. This happens even
> without -j. In the example that I gave in that bug report, it was caused by ^C, which looked like this:
>
> make: *** Deleting file 'obj/m^ainC.oTerminate batch job (Y/N)? '
> Is this expected?

The "*** Deleting file 'obj/main.o" part is from Make, while the
"Terminate batch job (Y/N)?" part is from cmd.exe.  IOW, two processes
are writing to the same device at the same time.

> With the patch it doesn't happen.

That's what I'd like to understand: how did the MSYS2 maintainers
arrived at the conclusion that the call to setlocale can be related.

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Unlink failure on abort

Orgad Shaneh
In reply to this post by Eli Zaretskii
On Friday, June 16, 2017, Eli Zaretskii <<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;eliz@gnu.org&#39;);" target="_blank">eliz@...> wrote:
> Date: Fri, 16 Jun 2017 16:15:31 +0300
> From: Eli Zaretskii <[hidden email]>
> Cc: [hidden email]
>
> > Ok, I was able to create a minimal example. It happens only with g++ -pipe.
>
> Thanks, but I couldn't reproduce the problem on my main development
> machine.

Correction: I do succeed sometimes to reproduce it, but only very
rarely, and only if I wait for about 20 sec before hitting Ctrl-C.

What's more important, once Make exits, the file fib.o is gone, the
error message notwithstanding.  Is it left on your system?

On my system it happens every time (I stop it after 1sec). The file stays on the disk with size 0.

- Orgad

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unlink failure on abort

Orgad Shaneh
In reply to this post by Eli Zaretskii
On Friday, June 16, 2017, Eli Zaretskii <[hidden email]> wrote:
> From: Orgad Shaneh <<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;orgads@gmail.com&#39;)">orgads@...>
> Date: Fri, 16 Jun 2017 15:59:09 +0300
> Cc: <a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;bug-make@gnu.org&#39;)">bug-make@...
>
>  I don't see any calls to DeleteFile in this log. I expected to see at
>  least one that failed with ERROR_ACCESS_DENIED. What am I missing?
>
> There is SHARING_VIOLATION for both g++.exe and mingw32-make.exe

Ah, okay.  But then the problem is not with child processes of g++,
it's with g++ itself, right?

The child process cc1plus has the file open for writing, and g++ and make fail to delete it.
 

And on my system, the file is removed after Make exits, when I use
your recipe.

Do you run mingw make or msys make?
 
> > Interleaved output is not a problem, it's expected behavior. And it
> > has nothing to do with buffering, since several different instances of
> > make are simultaneously writing to the same device.
>
> By "interleaved" I mean that in the same line there is "expected" output and interferences. This happens even
> without -j. In the example that I gave in that bug report, it was caused by ^C, which looked like this:
>
> make: *** Deleting file 'obj/m^ainC.oTerminate batch job (Y/N)? '
> Is this expected?

The "*** Deleting file 'obj/main.o" part is from Make, while the
"Terminate batch job (Y/N)?" part is from cmd.exe.  IOW, two processes
are writing to the same device at the same time.

> With the patch it doesn't happen.

That's what I'd like to understand: how did the MSYS2 maintainers
arrived at the conclusion that the call to setlocale can be related.

CC Alexey. 

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unlink failure on abort

Eli Zaretskii
> From: Orgad Shaneh <[hidden email]>
> Date: Fri, 16 Jun 2017 17:05:58 +0300
> Cc: "[hidden email]" <[hidden email]>, Alexey Pavlov <[hidden email]>
>
>  Ah, okay. But then the problem is not with child processes of g++,
>  it's with g++ itself, right?
>
> The child process cc1plus has the file open for writing, and g++ and make fail to delete it.

Then what exactly do you expect Make to do about that?  We cannot
prevent child processes from opening files in a way that disallows
deletion by Make.  We could probably wait in a loop until the deletion
succeeds, but I'm not sure this will work.  Can you try adding such a
loop to Make?  My system reproduces this with too low probability, so
I'm not a good candidate for this experiment.

>  And on my system, the file is removed after Make exits, when I use
>  your recipe.
>
> Do you run mingw make or msys make?

MinGW Make, of course.  The same one you found on ezwinports.


_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
12
Loading...