docs: Replace usernames with references to $HOME

Instead of leaving our own users in doc references, replace
/home/$USER to simply $HOME.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
avocado.runner: Fix typo in test stream

We're looking to replace `stderr`, not `sterr`.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Merge pull request #306 from lmr/fix_user_references_docs

docs: Replace usernames with references to $HOME
avocado: Mass import cleanup

Make non standard python modules to be imported after
standard ones, also respect lines between imports and
the rest of the code. Also, remove unused imports.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Merge pull request #307 from lmr/refactor-cleanups

Refactor cleanups
avocado: Remove references to /var/tmp/avocado

This probably won't work for multi-users and/or
if /var/tmp/avocado exists before avocado is run
for the first time (with different permissions from
a different user). It's also probably a security
issue: a malicious user could create a /var/tmp/avocado
symlink pointing to /home/someone/important-dir.

This patch removes references to /var/tmp/avocado,
fixing this important security bug.

Recommended reading:

https://kurt.seifried.org/2012/03/14/creating-temporary-files-securely/
http://www.linuxsecurity.com/content/view/115462/151/

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Merge pull request #308 from lmr/fix-var-tmp

avocado: Remove references to /var/tmp/avocado
Revert "Merge pull request #308 from lmr/fix-var-tmp"

This reverts commit 954ebf4d5febd75157ddf0eb7e8631fe1d6af55b, reversing
changes made to 1662755962371fad8348f371289fce095dcb587a.
avocado.utils: Introduce data_structures module

Introduce a module with useful classes for use inside
avocado core code or plugins. We start with the Borg
class, a design pattern considered to be better than
the Singleton [1]

[1] http://www.aleax.it/5ep.html

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
avocado: Create and keep track of avocado tmp dir safely

Currently avocado uses /var/tmp/avocado as the default
location for the avocado tmp dir. This is a bug from the
security standpoint, since a malicious user could create
a /var/tmp/avocado symlink pointing to an important directory
of the system.

So, instead of using /var/tmp/avocado, remove the ability
to configure the base tmp directory (other than the traditional
$TMPDIR environment variable), and make the data_dir.get_tmp_dir()
API to return a safe, non predictable temporary directory.

Recommended reading:

https://kurt.seifried.org/2012/03/14/creating-temporary-files-securely/
http://www.linuxsecurity.com/content/view/115462/151/

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Merge pull request #309 from lmr/fix-var-tmp_v2

[V2] Fix avocado tmp directory security issue
avocado: Bump to version 0.17.0

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
examples.wrappers: Use "$@" in dummy.sh.

Use "$@" for command line execution.

Signed-off-by: Rudá Moura <rmoura@redhat.com>
examples.wrappers: Turn ltrace.sh smarter.

Use 'set -e' to exit in the first error problem, for example, when
the ltrace command is not installed.

The script now looks inside the log to probe for exit code, after
that, it tries to look if the process has been killed by a signal.
This order is different from the previous implementation.

The regular expression to probe for exit code and signals are improved.

Signed-off-by: Rudá Moura <rmoura@redhat.com>
examples.wrappers: Use "$@" and --quiet in perf.sh.

Use "$@" for command line execution and pass the option --quiet
to perf, to avoid touching the stderr.

Note that even with --quiet option, the perf utility could
display messages in the output. It's not 100% free of output.

Signed-off-by: Rudá Moura <rmoura@redhat.com>
examples.wrappers: Use "$@" in strace.sh.

Use "$@" for command line execution.

Signed-off-by: Rudá Moura <rmoura@redhat.com>
examples.wrappers: Use exec and "$@" in valgrind.sh.

Use "$@" for command line execution.

Signed-off-by: Rudá Moura <rmoura@redhat.com>
examples.wrappers: New wrapper time.sh.

New wrapper script: run process inside /usr/bin/time.

Signed-off-by: Rudá Moura <rmoura@redhat.com>
Rename avocado.core.error_codes to avocado.core.exit_codes.

Signed-off-by: Rudá Moura <rmoura@redhat.com>
avocado.core.exit_codes: Use constant exit codes.

Create constants which maps the exit codes.
Remove the previous dictionary with exit codes (numeric_status).

Signed-off-by: Rudá Moura <rmoura@redhat.com>