abipkgdiff: Respect 'create_abi_file_path' interface

Message ID 20211210104150.3248635-1-thomas@codesourcery.com
State Committed
Headers
Series abipkgdiff: Respect 'create_abi_file_path' interface |

Commit Message

Thomas Schwinge Dec. 10, 2021, 10:41 a.m. UTC
  Currently we may run into this:

    [...]
    abipkgdiff: Could not create the directory tree to store the abi for '[...]'
    abipkgdiff: Writting ABIXML file '' ...
    abipkgdiff: Wrote ABIXML file '' OK
    abipkgdiff: Reading ABIXML file '' ...
    abipkgdiff: Could not read temporary ABIXML file ''
    ==== Error happened during self check of '[...]' ====
    [...]

That is, after a failed 'create_abi_file_path', we proceed with an empty
'abi_file_path' -- because that one only gets set "iff the function return
true".  So we ought to 'return abigail::tools_utils::ABIDIFF_ERROR' in that
case.

(It's likewise strange why 'create_write_context'/'write_corpus' succeed with
an empty 'abi_file_path', but that's for another day...)

	* tools/abipkgdiff.cc (compare_to_self): Respect
	'create_abi_file_path' interface.

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
---
 tools/abipkgdiff.cc | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Thomas Schwinge Dec. 17, 2021, 9:27 a.m. UTC | #1
Hi!

Ping.


Grüße
 Thomas


On 2021-12-10T11:41:50+0100, I wrote:
> Currently we may run into this:
>
>     [...]
>     abipkgdiff: Could not create the directory tree to store the abi for '[...]'
>     abipkgdiff: Writting ABIXML file '' ...
>     abipkgdiff: Wrote ABIXML file '' OK
>     abipkgdiff: Reading ABIXML file '' ...
>     abipkgdiff: Could not read temporary ABIXML file ''
>     ==== Error happened during self check of '[...]' ====
>     [...]
>
> That is, after a failed 'create_abi_file_path', we proceed with an empty
> 'abi_file_path' -- because that one only gets set "iff the function return
> true".  So we ought to 'return abigail::tools_utils::ABIDIFF_ERROR' in that
> case.
>
> (It's likewise strange why 'create_write_context'/'write_corpus' succeed with
> an empty 'abi_file_path', but that's for another day...)
>
>       * tools/abipkgdiff.cc (compare_to_self): Respect
>       'create_abi_file_path' interface.
>
> Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
> ---
>  tools/abipkgdiff.cc | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git tools/abipkgdiff.cc tools/abipkgdiff.cc
> index 33efa23a..7fc833b2 100644
> --- tools/abipkgdiff.cc
> +++ tools/abipkgdiff.cc
> @@ -1583,6 +1583,8 @@ compare_to_self(const elf_file& elf,
>           << "Could not create the directory tree to store the abi for '"
>           << elf.path
>           << "'\n";
> +
> +     return abigail::tools_utils::ABIDIFF_ERROR;
>        }
>      ofstream of(abi_file_path.c_str(), std::ios_base::trunc);
>
> --
> 2.25.1
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
  
Dodji Seketeli Dec. 20, 2021, 2:58 p.m. UTC | #2
Hello,

Thomas Schwinge <thomas@codesourcery.com> a écrit:

> Currently we may run into this:
>
>     [...]
>     abipkgdiff: Could not create the directory tree to store the abi for '[...]'
>     abipkgdiff: Writting ABIXML file '' ...
>     abipkgdiff: Wrote ABIXML file '' OK
>     abipkgdiff: Reading ABIXML file '' ...
>     abipkgdiff: Could not read temporary ABIXML file ''
>     ==== Error happened during self check of '[...]' ====
>     [...]
>
> That is, after a failed 'create_abi_file_path', we proceed with an empty
> 'abi_file_path' -- because that one only gets set "iff the function return
> true".  So we ought to 'return abigail::tools_utils::ABIDIFF_ERROR' in that
> case.
>
> (It's likewise strange why 'create_write_context'/'write_corpus' succeed with
> an empty 'abi_file_path', but that's for another day...)
>
> 	* tools/abipkgdiff.cc (compare_to_self): Respect
> 	'create_abi_file_path' interface.
>
> Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>

Applied to master, thanks!

[...]

Cheers,
  

Patch

diff --git tools/abipkgdiff.cc tools/abipkgdiff.cc
index 33efa23a..7fc833b2 100644
--- tools/abipkgdiff.cc
+++ tools/abipkgdiff.cc
@@ -1583,6 +1583,8 @@  compare_to_self(const elf_file& elf,
 	    << "Could not create the directory tree to store the abi for '"
 	    << elf.path
 	    << "'\n";
+
+	return abigail::tools_utils::ABIDIFF_ERROR;
       }
     ofstream of(abi_file_path.c_str(), std::ios_base::trunc);