public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Honour errors when processing more than one file
@ 2019-01-01  0:00 Tom de Vries
  2019-01-01  0:00 ` Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: Tom de Vries @ 2019-01-01  0:00 UTC (permalink / raw)
  To: dwz, jakub

Hi,

When using dwz -L0 on a hello world a.out, it fails:
...
$ dwz -L0 a.out
$ echo $?
1
...

But when we do the same for a.out and a copy b.out, it passes:
...
$ cp a.out b.out
$ dwz -L0 a.out b.out
$ echo $?
0
...

Fix this by honouring dwz return codes when processing more than one file.

OK for trunk?

Thanks,
- Tom

Honour errors when processing more than one file

2019-03-04  Tom de Vries  <tdevries@suse.de>

	PR dwz/24301
	* dwz.c (main): Handle dwz returning 1 if processing more than one file.
	* testsuite/dwz.tests/two-files-too-many-dies.sh: New test.

---
 dwz.c                                          |  2 ++
 testsuite/dwz.tests/two-files-too-many-dies.sh | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/dwz.c b/dwz.c
index d348418..0c53c4b 100644
--- a/dwz.c
+++ b/dwz.c
@@ -11940,6 +11940,8 @@ main (int argc, char *argv[])
 	    }
 	  else if (resa[i - optind].res == 0)
 	    successcount++;
+	  if (thisret == 1)
+	    return 1;
 	  if (hardlink
 	      && resa[i - optind].res >= 0
 	      && resa[i - optind].nlink > 1)
diff --git a/testsuite/dwz.tests/two-files-too-many-dies.sh b/testsuite/dwz.tests/two-files-too-many-dies.sh
new file mode 100755
index 0000000..7214ff6
--- /dev/null
+++ b/testsuite/dwz.tests/two-files-too-many-dies.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -e
+
+cp ../hello 1
+cp ../hello 2
+
+if dwz -L0 1 2 2>/dev/null; then
+    exit 1
+fi
+
+cmp 1 ../hello
+cmp 2 ../hello
+
+ls=$(ls)
+ls=$(echo $ls)
+[ "$ls" = "1 2" ]
+
+rm -f 1 2

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-05-10  7:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-01  0:00 [PATCH] Honour errors when processing more than one file Tom de Vries
2019-01-01  0:00 ` Jakub Jelinek
2019-01-01  0:00   ` Tom de Vries
2019-01-01  0:00     ` Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).