]> ruderich.org/simon Gitweb - coloredstderr/coloredstderr.git/log
coloredstderr/coloredstderr.git
11 years agoRemove unnecessary if in init_from_environment().
Simon Ruderich [Sun, 21 Jul 2013 12:25:54 +0000 (14:25 +0200)]
Remove unnecessary if in init_from_environment().

11 years agoconstants.h: Fix indentation.
Simon Ruderich [Sun, 7 Jul 2013 12:43:29 +0000 (14:43 +0200)]
constants.h: Fix indentation.

11 years agoREADME: Add another known issue.
Simon Ruderich [Sun, 7 Jul 2013 12:42:37 +0000 (14:42 +0200)]
README: Add another known issue.

11 years agoREADME: Some fixes.
Simon Ruderich [Sun, 7 Jul 2013 12:42:23 +0000 (14:42 +0200)]
README: Some fixes.

11 years agoAdd COLORED_STDERR_IGNORED_BINARIES to exclude binaries.
Simon Ruderich [Sun, 7 Jul 2013 11:33:44 +0000 (13:33 +0200)]
Add COLORED_STDERR_IGNORED_BINARIES to exclude binaries.

11 years agoAdd missing assert() to init_from_environment().
Simon Ruderich [Sun, 7 Jul 2013 10:54:59 +0000 (12:54 +0200)]
Add missing assert() to init_from_environment().

11 years agotests/test_noforce.sh: Add missing test_script_subshell call.
Simon Ruderich [Mon, 1 Jul 2013 11:58:24 +0000 (13:58 +0200)]
tests/test_noforce.sh: Add missing test_script_subshell call.

11 years agoREADME: Document failing test on FreeBSD.
Simon Ruderich [Mon, 1 Jul 2013 01:27:16 +0000 (03:27 +0200)]
README: Document failing test on FreeBSD.

11 years agoHandle recursive calls of handle_*_{pre,post}() functions.
Simon Ruderich [Mon, 1 Jul 2013 01:23:50 +0000 (03:23 +0200)]
Handle recursive calls of handle_*_{pre,post}() functions.

11 years agotests: Handle `sed` which append a trailing newline.
Simon Ruderich [Mon, 1 Jul 2013 01:20:38 +0000 (03:20 +0200)]
tests: Handle `sed` which append a trailing newline.

11 years agotests: Don't require bash.
Simon Ruderich [Mon, 1 Jul 2013 01:12:24 +0000 (03:12 +0200)]
tests: Don't require bash.

Instead merge continuous regions of colored output. This way different
shell implementations shouldn't make a difference.

11 years agotests/example_exec.c: Sort environment variables.
Simon Ruderich [Mon, 1 Jul 2013 00:35:11 +0000 (02:35 +0200)]
tests/example_exec.c: Sort environment variables.

11 years agoAlso hook un-macroed putc when it's a macro.
Simon Ruderich [Sun, 30 Jun 2013 20:14:33 +0000 (22:14 +0200)]
Also hook un-macroed putc when it's a macro.

The macro might define it to something else, but the non-macro version
is also used in some cases, e.g. in gcc 4.8's collect2 on Debian with
eglibc 2.17-7.

11 years agoRestore environment for execvpe() if the exec fails.
Simon Ruderich [Sat, 29 Jun 2013 21:09:05 +0000 (23:09 +0200)]
Restore environment for execvpe() if the exec fails.

11 years agoREADME: Minor improvements.
Simon Ruderich [Sat, 29 Jun 2013 21:08:22 +0000 (23:08 +0200)]
README: Minor improvements.

11 years agoSet DEFAULT_PRE_STRING to red.
Simon Ruderich [Sat, 29 Jun 2013 21:07:15 +0000 (23:07 +0200)]
Set DEFAULT_PRE_STRING to red.

Bright red doesn't work in GNU/Linux's console.

11 years agotests: Add example_stdio.c and test_stdio.sh.
Simon Ruderich [Sat, 22 Jun 2013 16:21:10 +0000 (18:21 +0200)]
tests: Add example_stdio.c and test_stdio.sh.

11 years agotests/Makefile.am: Fix for BSD's make.
Simon Ruderich [Thu, 20 Jun 2013 21:51:38 +0000 (23:51 +0200)]
tests/Makefile.am: Fix for BSD's make.

11 years agoImprove checks for invalid file descriptors.
Simon Ruderich [Fri, 21 Jun 2013 20:55:13 +0000 (22:55 +0200)]
Improve checks for invalid file descriptors.

Just in case a real dup*() or fcntl() doesn't return -1 on error, but
something like -2.

11 years agotests: Check return values of write() and dup2().
Simon Ruderich [Fri, 21 Jun 2013 16:49:11 +0000 (18:49 +0200)]
tests: Check return values of write() and dup2().

11 years agoOverwrite tracked file descriptors when exporting COLORED_STDERR_FDS.
Simon Ruderich [Fri, 21 Jun 2013 16:26:23 +0000 (18:26 +0200)]
Overwrite tracked file descriptors when exporting COLORED_STDERR_FDS.

If the list of tracked file descriptors is modified to contain unwanted
values (e.g. when a parent process closes or redirects stderr), this
makes it possible to set the tracked file descriptors back to a given
list.

This problem occurred with startx which somehow closes or redirects
stderr. As COLORED_STDERR_FDS was set in the shell running startx, this
disabled coloring stderr for all processes started in the X11 session.

This is no longer an issue. As COLORED_STDERR_FDS is set in the shell
configuration file, it automatically sets the list to the correct value
when a shell is opened in the terminal emulator once X11 is running.

11 years agoHook __swbuf() on FreeBSD.
Simon Ruderich [Thu, 20 Jun 2013 21:33:27 +0000 (23:33 +0200)]
Hook __swbuf() on FreeBSD.

Coloring works fine now on FreeBSD (with some minor issues). Tests still
fail though.

11 years agoRemove invalid assert() in tracked_fds_find().
Simon Ruderich [Thu, 20 Jun 2013 21:17:03 +0000 (23:17 +0200)]
Remove invalid assert() in tracked_fds_find().

11 years agoconfigure.ac: Check if __overflow() is available.
Simon Ruderich [Thu, 20 Jun 2013 20:14:42 +0000 (22:14 +0200)]
configure.ac: Check if __overflow() is available.

11 years agoHook __overflow() correctly.
Simon Ruderich [Thu, 20 Jun 2013 20:13:04 +0000 (22:13 +0200)]
Hook __overflow() correctly.

It takes a FILE * and must be hooked with HOOK_FILE*().

11 years agotests/Makefile.am: Remove unnecessary *_SOURCES variables.
Simon Ruderich [Tue, 18 Jun 2013 07:10:09 +0000 (09:10 +0200)]
tests/Makefile.am: Remove unnecessary *_SOURCES variables.

They are only required if more than one source file (or one with a
different name) is used.

11 years ago{fwrite,fputs,fputc}_unlocked() are not in POSIX.
Simon Ruderich [Thu, 20 Jun 2013 18:56:51 +0000 (20:56 +0200)]
{fwrite,fputs,fputc}_unlocked() are not in POSIX.

Define fwrite_unlocked(), fputs_unlocked() and fputc_unlocked() only if
they are available on the system.

11 years agotests: Remove test_symbols.sh.
Simon Ruderich [Thu, 20 Jun 2013 18:46:06 +0000 (20:46 +0200)]
tests: Remove test_symbols.sh.

It's useless as different systems provide/require different symbols.
Will be replaced by a better test.

11 years agoUpdate documentation.
Simon Ruderich [Mon, 17 Jun 2013 22:07:03 +0000 (00:07 +0200)]
Update documentation.

11 years agotests/example.c: Use errno = ENOMEM.
Simon Ruderich [Mon, 17 Jun 2013 21:28:07 +0000 (23:28 +0200)]
tests/example.c: Use errno = ENOMEM.

The output from errno = 0 is less portable.

11 years agoAdd missing #include <sys/stat.h>.
Simon Ruderich [Mon, 17 Jun 2013 21:26:00 +0000 (23:26 +0200)]
Add missing #include <sys/stat.h>.

11 years agoREADME: setuid binaries are not supported.
Simon Ruderich [Sat, 15 Jun 2013 14:53:47 +0000 (16:53 +0200)]
README: setuid binaries are not supported.

11 years agotests/example_error.c: Fix typo in function name.
Simon Ruderich [Sat, 15 Jun 2013 01:41:06 +0000 (03:41 +0200)]
tests/example_error.c: Fix typo in function name.

11 years agoMark hooked functions as visibility(("protected")).
Simon Ruderich [Sat, 15 Jun 2013 01:36:50 +0000 (03:36 +0200)]
Mark hooked functions as visibility(("protected")).

11 years agohookmacros.h: Reduce duplication in macros.
Simon Ruderich [Sat, 15 Jun 2013 01:23:53 +0000 (03:23 +0200)]
hookmacros.h: Reduce duplication in macros.

Also preparation to add attributes to function declarations.

11 years agoHook BSD err(), errx(), warn(), warnx(), etc. functions.
Simon Ruderich [Sat, 15 Jun 2013 00:39:52 +0000 (02:39 +0200)]
Hook BSD err(), errx(), warn(), warnx(), etc. functions.

err(), errx(), warn(), warnx(), verr(), verrx(), vwarn(), vwarnx() are
hooked.

11 years agoMinor documentation update.
Simon Ruderich [Sat, 15 Jun 2013 00:21:27 +0000 (02:21 +0200)]
Minor documentation update.

11 years agoUse locally defined functions in hooks where possible.
Simon Ruderich [Fri, 14 Jun 2013 23:58:36 +0000 (01:58 +0200)]
Use locally defined functions in hooks where possible.

Don't create a hook and call the "real" function when it's enough to
call an existing hook for this function.

11 years agoDefine real_*() static variables with macros.
Simon Ruderich [Fri, 14 Jun 2013 22:54:46 +0000 (00:54 +0200)]
Define real_*() static variables with macros.

11 years agoconfigure.ac: Fix Vim's syntax coloring issue with `..'.
Simon Ruderich [Fri, 14 Jun 2013 13:33:28 +0000 (15:33 +0200)]
configure.ac: Fix Vim's syntax coloring issue with `..'.

11 years agotests/Makefile.am: Enable parallel and colored test runs.
Simon Ruderich [Fri, 14 Jun 2013 13:27:31 +0000 (15:27 +0200)]
tests/Makefile.am: Enable parallel and colored test runs.

Necessary for automake < 1.13.

11 years agoInstall libcoloredstderr.so read-only.
Simon Ruderich [Fri, 14 Jun 2013 11:40:06 +0000 (13:40 +0200)]
Install libcoloredstderr.so read-only.

Prevents accidental truncates of libcoloredstderr.so with `cp` which
crash all programs which have loaded it.

11 years agoREADME: Explain how to modify pre/post variables.
Simon Ruderich [Fri, 14 Jun 2013 10:44:34 +0000 (12:44 +0200)]
README: Explain how to modify pre/post variables.

11 years agoREADME: Add first part of installation instructions.
Simon Ruderich [Fri, 14 Jun 2013 09:07:40 +0000 (11:07 +0200)]
README: Add first part of installation instructions.

11 years ago.gitignore: Ignore generated test files.
Simon Ruderich [Thu, 13 Jun 2013 20:43:43 +0000 (22:43 +0200)]
.gitignore: Ignore generated test files.

Forgotten in d8be625da928025e96417c1b62f3336251204cef and
59375c2b7949791d8cad8e5cebde2649bac83ec8.

11 years agotests/lib.sh: Fix tests for dash.
Simon Ruderich [Thu, 13 Jun 2013 20:35:42 +0000 (22:35 +0200)]
tests/lib.sh: Fix tests for dash.

11 years agoRemove duplicate code in init_from_environment().
Simon Ruderich [Thu, 13 Jun 2013 20:15:49 +0000 (22:15 +0200)]
Remove duplicate code in init_from_environment().

11 years agoMinor documentation updates.
Simon Ruderich [Thu, 13 Jun 2013 20:15:09 +0000 (22:15 +0200)]
Minor documentation updates.

11 years agoAdd missing const and document where it can't be used.
Simon Ruderich [Thu, 13 Jun 2013 20:13:16 +0000 (22:13 +0200)]
Add missing const and document where it can't be used.

11 years agotests/lib.sh: Minor cleanup.
Simon Ruderich [Thu, 13 Jun 2013 20:11:15 +0000 (22:11 +0200)]
tests/lib.sh: Minor cleanup.

11 years agoFix possible memory overwrite in init_from_environment().
Simon Ruderich [Thu, 13 Jun 2013 20:08:08 +0000 (22:08 +0200)]
Fix possible memory overwrite in init_from_environment().

It was possible for a user to overwrite memory at a relative location
with 1 by passing a negative file descriptor.

11 years agoAdd more error checks.
Simon Ruderich [Thu, 13 Jun 2013 19:56:50 +0000 (21:56 +0200)]
Add more error checks.

11 years agoRemove unnecessary calls to update_environment() in exec*().
Simon Ruderich [Thu, 13 Jun 2013 19:50:51 +0000 (21:50 +0200)]
Remove unnecessary calls to update_environment() in exec*().

11 years agoconstants.h: Fix indentation.
Simon Ruderich [Thu, 13 Jun 2013 19:45:19 +0000 (21:45 +0200)]
constants.h: Fix indentation.

11 years agoldpreload.h: Add missing unlikely() in DLSYM_FUNCTION().
Simon Ruderich [Thu, 13 Jun 2013 14:46:48 +0000 (16:46 +0200)]
ldpreload.h: Add missing unlikely() in DLSYM_FUNCTION().

11 years agohookmacros.h: Remove duplication in _HOOK_PRE_FD_/_HOOK_PRE_FILE.
Simon Ruderich [Thu, 13 Jun 2013 14:35:55 +0000 (16:35 +0200)]
hookmacros.h: Remove duplication in _HOOK_PRE_FD_/_HOOK_PRE_FILE.

11 years agotrackfds.h: Add missing inline for consistency.
Simon Ruderich [Thu, 13 Jun 2013 19:34:29 +0000 (21:34 +0200)]
trackfds.h: Add missing inline for consistency.

11 years agoAdd assert()s.
Simon Ruderich [Thu, 13 Jun 2013 19:33:27 +0000 (21:33 +0200)]
Add assert()s.

11 years agoHandle invalid arguments to close()/fclose() better.
Simon Ruderich [Thu, 13 Jun 2013 19:19:15 +0000 (21:19 +0200)]
Handle invalid arguments to close()/fclose() better.

11 years agoFix hook for putc_unlocked() with glibc.
Simon Ruderich [Thu, 13 Jun 2013 10:59:12 +0000 (12:59 +0200)]
Fix hook for putc_unlocked() with glibc.

putc_unlocked() is a macro which expands to __overflow() in some cases.

11 years agotests/test_symbols.sh: Add.
Simon Ruderich [Thu, 13 Jun 2013 00:32:27 +0000 (02:32 +0200)]
tests/test_symbols.sh: Add.

11 years agotests/Makefile.am: Sort dist_check_DATA.
Simon Ruderich [Thu, 13 Jun 2013 00:29:55 +0000 (02:29 +0200)]
tests/Makefile.am: Sort dist_check_DATA.

11 years agoconfigure.ac: fcntl.h is required.
Simon Ruderich [Thu, 13 Jun 2013 00:25:58 +0000 (02:25 +0200)]
configure.ac: fcntl.h is required.

11 years agohookmacros.h: Minor style fix.
Simon Ruderich [Wed, 12 Jun 2013 23:27:45 +0000 (01:27 +0200)]
hookmacros.h: Minor style fix.

11 years agotests: Split run.sh in multiple test files.
Simon Ruderich [Wed, 12 Jun 2013 23:26:25 +0000 (01:26 +0200)]
tests: Split run.sh in multiple test files.

Allows parallel test runs and simplifies optional tests.

11 years agotests: Rename example-* to example_* for consistency.
Simon Ruderich [Wed, 12 Jun 2013 23:05:06 +0000 (01:05 +0200)]
tests: Rename example-* to example_* for consistency.

11 years agotests: Fix tests when running under coloredstderr.
Simon Ruderich [Mon, 10 Jun 2013 20:49:58 +0000 (22:49 +0200)]
tests: Fix tests when running under coloredstderr.

11 years agoREADME: Add.
Simon Ruderich [Mon, 10 Jun 2013 20:33:59 +0000 (22:33 +0200)]
README: Add.

11 years agoAdd another debug() print to init_from_environment().
Simon Ruderich [Mon, 10 Jun 2013 20:25:31 +0000 (22:25 +0200)]
Add another debug() print to init_from_environment().

11 years agoFix compilation with clang.
Simon Ruderich [Mon, 10 Jun 2013 19:27:12 +0000 (21:27 +0200)]
Fix compilation with clang.

11 years agom4/ax_c___attribute__.m4: Add.
Simon Ruderich [Mon, 10 Jun 2013 15:17:21 +0000 (17:17 +0200)]
m4/ax_c___attribute__.m4: Add.

Forgotten in 0a2617527c9b46a587a8f34571a54347cd5c4b5a. Used in
configure.ac.

11 years agoHook execvpe(), a GNU extension.
Simon Ruderich [Mon, 10 Jun 2013 15:10:44 +0000 (17:10 +0200)]
Hook execvpe(), a GNU extension.

11 years agocoloredstderr.c: Fix parameter name in execvp().
Simon Ruderich [Mon, 10 Jun 2013 14:58:27 +0000 (16:58 +0200)]
coloredstderr.c: Fix parameter name in execvp().

11 years agocoloredstderr.c: Fix indentation.
Simon Ruderich [Mon, 10 Jun 2013 14:55:25 +0000 (16:55 +0200)]
coloredstderr.c: Fix indentation.

11 years agoconfigure.ac: Abort if a required function wasn't found.
Simon Ruderich [Mon, 10 Jun 2013 14:54:42 +0000 (16:54 +0200)]
configure.ac: Abort if a required function wasn't found.

11 years agoconfigure.ac: strdup() is no longer used, dup2() is optional.
Simon Ruderich [Mon, 10 Jun 2013 14:54:11 +0000 (16:54 +0200)]
configure.ac: strdup() is no longer used, dup2() is optional.

11 years agoconfigure.ac: Minor style fix.
Simon Ruderich [Mon, 10 Jun 2013 14:22:09 +0000 (16:22 +0200)]
configure.ac: Minor style fix.

11 years agoconfigure.ac: Add --enable-warnings.
Simon Ruderich [Mon, 10 Jun 2013 14:18:35 +0000 (16:18 +0200)]
configure.ac: Add --enable-warnings.

Enables warning() messages without the overhead of all debug output.

11 years agotests: Fix warnings about unused parameters.
Simon Ruderich [Mon, 10 Jun 2013 13:22:17 +0000 (15:22 +0200)]
tests: Fix warnings about unused parameters.

11 years agoOnly run vfork() tests if it's available.
Simon Ruderich [Mon, 10 Jun 2013 13:16:21 +0000 (15:16 +0200)]
Only run vfork() tests if it's available.

11 years agoRename __noinline/__always_inline to prevent clash with headers.
Simon Ruderich [Mon, 10 Jun 2013 12:55:13 +0000 (14:55 +0200)]
Rename __noinline/__always_inline to prevent clash with headers.

With this change noinline can be used in ldpreload.h.

11 years agoPrevent inlining for more functions.
Simon Ruderich [Mon, 10 Jun 2013 12:11:04 +0000 (14:11 +0200)]
Prevent inlining for more functions.

Clang is inlining quite aggressively.

11 years agoPrevent inlining of handle_*_pre/post() functions.
Simon Ruderich [Mon, 10 Jun 2013 04:27:18 +0000 (06:27 +0200)]
Prevent inlining of handle_*_pre/post() functions.

11 years agoDon't mark init_pre_post_string() as inline.
Simon Ruderich [Mon, 10 Jun 2013 04:25:05 +0000 (06:25 +0200)]
Don't mark init_pre_post_string() as inline.

11 years agoFix save/restore of errno for isatty().
Simon Ruderich [Mon, 10 Jun 2013 04:19:00 +0000 (06:19 +0200)]
Fix save/restore of errno for isatty().

11 years agoInline fast part of tracked_fds_find().
Simon Ruderich [Mon, 10 Jun 2013 04:08:35 +0000 (06:08 +0200)]
Inline fast part of tracked_fds_find().

11 years agoUse likely()/unlikely() macros to improve branch prediction.
Simon Ruderich [Mon, 10 Jun 2013 04:06:00 +0000 (06:06 +0200)]
Use likely()/unlikely() macros to improve branch prediction.

11 years agoInline check_handle_fd() into hook macros.
Simon Ruderich [Mon, 10 Jun 2013 03:55:51 +0000 (05:55 +0200)]
Inline check_handle_fd() into hook macros.

It's very small and prologue/epilogue have a lot of overhead.

11 years agoconfigure.ac: Compile with -Wall -Wextra -Wconversion.
Simon Ruderich [Mon, 10 Jun 2013 03:47:04 +0000 (05:47 +0200)]
configure.ac: Compile with -Wall -Wextra -Wconversion.

11 years agoldpreload.h: Split macro into function and macro.
Simon Ruderich [Mon, 10 Jun 2013 03:43:31 +0000 (05:43 +0200)]
ldpreload.h: Split macro into function and macro.

11 years agoRemove errno save/restore where not necessary.
Simon Ruderich [Mon, 10 Jun 2013 03:24:43 +0000 (05:24 +0200)]
Remove errno save/restore where not necessary.

11 years agohandle_*_pre(),handle_*_post(): Remove unused action parameter.
Simon Ruderich [Mon, 10 Jun 2013 02:53:30 +0000 (04:53 +0200)]
handle_*_pre(),handle_*_post(): Remove unused action parameter.

11 years agoconstants.h: Use "\033" instead of the non-standard "\e".
Simon Ruderich [Sun, 9 Jun 2013 14:26:36 +0000 (16:26 +0200)]
constants.h: Use "\033" instead of the non-standard "\e".

11 years agoRemove unused hook puts_unlocked().
Simon Ruderich [Fri, 7 Jun 2013 00:06:57 +0000 (02:06 +0200)]
Remove unused hook puts_unlocked().

This function doesn't exist (yet).

11 years agoFix a few strict compiler warnings.
Simon Ruderich [Fri, 7 Jun 2013 00:01:23 +0000 (02:01 +0200)]
Fix a few strict compiler warnings.

11 years agotrackfds.h: Remove incorrect debug output.
Simon Ruderich [Thu, 6 Jun 2013 23:59:27 +0000 (01:59 +0200)]
trackfds.h: Remove incorrect debug output.

11 years agoUse char const * instead of const char *.
Simon Ruderich [Thu, 6 Jun 2013 23:56:02 +0000 (01:56 +0200)]
Use char const * instead of const char *.

char const * is more consistent with char * const.

11 years agoUse static list of descriptors to reduce mallocs.
Simon Ruderich [Thu, 6 Jun 2013 23:27:58 +0000 (01:27 +0200)]
Use static list of descriptors to reduce mallocs.

Only if file descriptors with a value > 255 occur, the list
implementation is used.

11 years agotests: Run tests under valgrind if it's available.
Simon Ruderich [Thu, 6 Jun 2013 23:17:42 +0000 (01:17 +0200)]
tests: Run tests under valgrind if it's available.

11 years agoAdd warning() and use it in DEBUG mode.
Simon Ruderich [Thu, 6 Jun 2013 22:58:16 +0000 (00:58 +0200)]
Add warning() and use it in DEBUG mode.