track-untrack.c: error out on unknown CLI options
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 7 Jan 2020 23:09:46 +0000 (18:09 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 14 Jan 2020 23:57:39 +0000 (18:57 -0500)
commitc47a705beb4d03d1a7498802047f6410814dced3
treebcebf48390d9c3d604b99d8820392624ab17e13e
parent5b64a0d0ef61c3b6a6225f2b380989c48fa60368
track-untrack.c: error out on unknown CLI options

Issue
=====
At the moment, it's possible to have unknown options in the `track` and
`untrack` commands. They are silently ignored.

For example, the following command line is accepted without problem:
  lttng untrack HELLO -k --all --pid

This was witnessed in the `test_event_tracker` tests. The
`lttng_track()` and `lttng_untrack() functions in `tests/utils/util.sh`
are currently passing the `$1` bash variable of the function to the
`track` and `untrack` througth their "$@" variable.

The commands should not silently accept those unknown options.

Fix
===
1. After looping on all the known options, check if there is any leftover
  options and error out if it's the case.
2. Fix the `utils.sh` functions to that they don't pass the `$1` variable
  to the commands.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I822ba09c8ce1ffa8366c586e760a9257e8078e43
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng/commands/track-untrack.c
tests/utils/utils.sh
This page took 0.025523 seconds and 4 git commands to generate.