Bug #222
closedBabelTrace 1.0.0-rc1 does not report an error code in error situations
0%
Description
Hi Guys,
The latest version of babeltrace (rc1) does not report an error code in error situations (at least not this particular error).
In the following example there is a text file in the Pid directory and when babeltrace is invoked, it reports an error, but it returns 0:
SC-1:~ # ll /home/trace/Profile016_1/SC-1/ust/TestApp_type1-4459-20120423-231455/
total 20rw-r--r- 1 root root 0 Apr 23 23:16 MyTextFile.txtrw-r--r- 1 root root 0 Apr 23 23:16 MyTextFile2.txt
-rwxrwxrwx 1 root root 4096 Apr 23 23:15 channel0_0
-rwxrwxrwx 1 root root 4096 Apr 23 23:15 channel0_1
-rwxrwxrwx 1 root root 4096 Apr 23 23:15 channel0_2
-rwxrwxrwx 1 root root 4096 Apr 23 23:15 channel0_3
-rwxrwxrwx 1 root root 4096 Apr 23 23:15 metadata
SC-1:~ # babeltrace /home/trace/Profile016_1/SC-1/ust/TestApp_type1-4459-20120423-231455/
[error] Open file stream error.
[warning] [Context] Cannot open_trace of the format /home/trace/Profile016_1/SC-1/ust/TestApp_type1-4459-20120423-231455/ .
[warning] [Context] opening trace "/home/trace/Profile016_1/SC-1/ust/TestApp_type1-4459-20120423-231455/" from /home/trace/Profile016_1/SC-1/ust/TestApp_type1-4459-20120423-231455/ for reading.
SC-1:~ # echo $?
0
SC-1:~ # babeltrace -h
BabelTrace Trace Viewer and Converter 1.0.0-rc1
======================================================================
In the previous version of babaltrace, it reports the same errors, but it returns 1:
SC-1:/home/trace/Profile006_4/SC-1/ust # babeltrace /home/trace/Profile006_4/SC-1/ust/TestApp_type1-16635-20120424-101632/
[error] Open file stream error.
[error] [Context] Cannot open_trace of the format /home/trace/Profile006_4/SC-1/ust/TestApp_type1-16635-20120424-101632/ .
[error] [Context] opening trace "/home/trace/Profile006_4/SC-1/ust/TestApp_type1-16635-20120424-101632/" from /home/trace/Profile006_4/SC-1/ust/TestApp_type1-16635-20120424-101632/ for reading.
[error] opening trace "/home/trace/Profile006_4/SC-1/ust/TestApp_type1-16635-20120424-101632/" for reading.
SC-1:/home/trace/Profile006_4/SC-1/ust # echo $?
1
SC-1:/home/trace/Profile006_4/SC-1/ust # babeltrace --help
BabelTrace Trace Viewer and Converter 1.0.0-pre4
Updated by Mathieu Desnoyers over 12 years ago
- bugs@lttng.org (bugs@lttng.org) wrote:
Issue #222 has been reported by Jesus Garcia.
----------------------------------------
Bug #222: BabelTrace 1.0.0-rc1 does not report an error code in error situations
https://bugs.lttng.org/issues/222Author: Jesus Garcia
Status: New
Priority: Normal
Assignee:
Category:
Target version: Babeltrace 1.0Hi Guys,
The latest version of babeltrace (rc1) does not report an error code in error situations (at least not this particular error).
In the following example there is a text file in the Pid directory and when babeltrace is invoked, it reports an error, but it returns 0:SC-1:~ # ll /home/trace/Profile016_1/SC-1/ust/TestApp_type1-4459-20120423-231455/
total 20rw-r--r-1 root root 0 Apr 23 23:16 MyTextFile.txtrw-r--r-1 root root 0 Apr 23 23:16 MyTextFile2.txt
-rwxrwxrwx 1 root root 4096 Apr 23 23:15 channel0_0
-rwxrwxrwx 1 root root 4096 Apr 23 23:15 channel0_1
-rwxrwxrwx 1 root root 4096 Apr 23 23:15 channel0_2
-rwxrwxrwx 1 root root 4096 Apr 23 23:15 channel0_3
-rwxrwxrwx 1 root root 4096 Apr 23 23:15 metadata
SC-1:~ # babeltrace /home/trace/Profile016_1/SC-1/ust/TestApp_type1-4459-20120423-231455/
[error] Open file stream error.
[warning] [Context] Cannot open_trace of the format /home/trace/Profile016_1/SC-1/ust/TestApp_type1-4459-20120423-231455/ .[warning] [Context] opening trace "/home/trace/Profile016_1/SC-1/ust/TestApp_type1-4459-20120423-231455/" from /home/trace/Profile016_1/SC-1/ust/TestApp_type1-4459-20120423-231455/ for reading.
SC-1:~ # echo $?
0
SC-1:~ # babeltrace -h
BabelTrace Trace Viewer and Converter 1.0.0-rc1======================================================================
In the previous version of babaltrace, it reports the same errors, but it returns 1:
SC-1:/home/trace/Profile006_4/SC-1/ust # babeltrace /home/trace/Profile006_4/SC-1/ust/TestApp_type1-16635-20120424-101632/
[error] Open file stream error.
[error] [Context] Cannot open_trace of the format /home/trace/Profile006_4/SC-1/ust/TestApp_type1-16635-20120424-101632/ .[error] [Context] opening trace "/home/trace/Profile006_4/SC-1/ust/TestApp_type1-16635-20120424-101632/" from /home/trace/Profile006_4/SC-1/ust/TestApp_type1-16635-20120424-101632/ for reading.
[error] opening trace "/home/trace/Profile006_4/SC-1/ust/TestApp_type1-16635-20120424-101632/" for reading.SC-1:/home/trace/Profile006_4/SC-1/ust # echo $?
1
SC-1:/home/trace/Profile006_4/SC-1/ust # babeltrace --help
BabelTrace Trace Viewer and Converter 1.0.0-pre4
You will notice that those "error" messages became warnings, so when
opening a trace collection that contains a couple of oddly-formed
traces, rather than bailing out, babeltrace prints a warning on stderr
and continues.
One thing we could do is check if none of the traces attempted to be
opened were successful, and return an error in that case. I'll look into
it.
Thanks,
Mathieu
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
Updated by Mathieu Desnoyers over 12 years ago
- Status changed from New to Resolved
- Assignee set to Mathieu Desnoyers
commit 27cd3890b5ad7975669cf3ec3f7d575aa1e55c67
Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date: Tue Apr 24 11:50:43 2012 -0400
Fix: return an error if no trace can be opened
Fixes #222
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Updated by Mathieu Desnoyers over 12 years ago
Addendum fixing this issue:
commit b945d4a5943030cdfbe697570c8c9d76838f7473
Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date: Tue May 8 21:32:26 2012 -0400
Fix: converter error logic
- If a subdirectory is empty, just warn and continue anyway.
- On partial error, babeltrace now returns a nonzero error value to the
parent process, even though it proceeds anyway.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>