File 2917-compile-Remove-pedantic-error-message.patch of Package erlang
From 6fc44f8053c787fe04f894e22c0e4a5969cc4c0c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Wed, 10 Feb 2021 11:44:06 +0100
Subject: [PATCH 07/18] compile: Remove pedantic error message
Stop reporting failure to remove the temporary file after a failed
rename, because it is very unlikely to ever happen in practice, and
the compilation has already been aborted because of the failed
renaming.
---
lib/compiler/src/compile.erl | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index 20fd0df6c7..07ee9b7bbf 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -316,9 +316,6 @@ format_error({rename,From,To,Error}) ->
format_error({delete,File,Error}) ->
io_lib:format("failed to delete file ~ts: ~ts",
[File,file:format_error(Error)]);
-format_error({delete_temp,File,Error}) ->
- io_lib:format("failed to delete temporary file ~ts: ~ts",
- [File,file:format_error(Error)]);
format_error({parse_transform,M,R}) ->
io_lib:format("error in parse transform '~ts': ~tp", [M, R]);
format_error({undef_parse_transform,M}) ->
@@ -1698,16 +1695,9 @@ save_binary_1(Code, St) ->
ok ->
{ok,none,St};
{error,RenameError} ->
- Es0 = [{Ofile,[{none,?MODULE,{rename,Tfile,Ofile,
- RenameError}}]}],
- Es = case file:delete(Tfile) of
- ok -> Es0;
- {error,DeleteError} ->
- Es0 ++
- [{Ofile,
- [{none,?MODULE,{delete_temp,Tfile,
- DeleteError}}]}]
- end,
+ Es = [{Ofile,[{none,?MODULE,{rename,Tfile,Ofile,
+ RenameError}}]}],
+ _ = file:delete(Tfile),
{error,St#compile{errors=St#compile.errors ++ Es}}
end;
{error,Error} ->
--
2.26.2