coloredstderr/coloredstderr.git
3 years agoPrevent crash in execve() if env is NULL master
Simon Ruderich [Thu, 1 Feb 2018 20:40:02 +0000 (21:40 +0100)]
Prevent crash in execve() if env is NULL

3 years agoUpdate copyright year
Simon Ruderich [Thu, 1 Feb 2018 20:10:46 +0000 (21:10 +0100)]
Update copyright year

6 years agoupdate copyright year
Simon Ruderich [Fri, 28 Aug 2015 10:25:36 +0000 (12:25 +0200)]
update copyright year

6 years agovfork(): fix incorrect comment
Simon Ruderich [Sat, 15 Nov 2014 17:35:05 +0000 (18:35 +0100)]
vfork(): fix incorrect comment

7 years agoNEWS: improve 0.2 notes
Simon Ruderich [Sun, 22 Jun 2014 16:54:45 +0000 (18:54 +0200)]
NEWS: improve 0.2 notes

7 years agoNEWS: release 0.2 0.2
Simon Ruderich [Sun, 22 Jun 2014 16:34:34 +0000 (18:34 +0200)]
NEWS: release 0.2

7 years agofix typos in comments
Simon Ruderich [Sun, 22 Jun 2014 16:24:49 +0000 (18:24 +0200)]
fix typos in comments

7 years agom4: Update to autoconf-archive 2014-02-28.
Simon Ruderich [Tue, 20 May 2014 15:49:33 +0000 (17:49 +0200)]
m4: Update to autoconf-archive 2014-02-28.

No changes.

7 years agoREADME: add multi-lib instructions
Simon Ruderich [Sat, 17 May 2014 19:52:53 +0000 (21:52 +0200)]
README: add multi-lib instructions

7 years agoconfigure.ac: fix typo in TLS error message
Simon Ruderich [Fri, 16 May 2014 02:50:06 +0000 (04:50 +0200)]
configure.ac: fix typo in TLS error message

7 years agoconfigure.ac: warn if TLS is not available
Simon Ruderich [Tue, 13 May 2014 16:32:56 +0000 (18:32 +0200)]
configure.ac: warn if TLS is not available

7 years agohandle_recursive: fix race condition if threads are used
Simon Ruderich [Tue, 8 Apr 2014 12:38:01 +0000 (14:38 +0200)]
handle_recursive: fix race condition if threads are used

Requires thread-local storage.

Another solution would be a mutex, but this is slower and more
complicated and might cause issues with some programs.

7 years agotests/test_environment.sh: echo test part to simplify debugging
Simon Ruderich [Fri, 14 Mar 2014 16:05:43 +0000 (17:05 +0100)]
tests/test_environment.sh: echo test part to simplify debugging

7 years agoREADME: mention autoreconf -fsi when using the git version
Simon Ruderich [Fri, 14 Mar 2014 15:10:58 +0000 (16:10 +0100)]
README: mention autoreconf -fsi when using the git version

7 years agom4: Update to autoconf-archive 2013-11-01.
Simon Ruderich [Sat, 1 Feb 2014 16:57:46 +0000 (17:57 +0100)]
m4: Update to autoconf-archive 2013-11-01.

No changes.

7 years agoREADME: /proc/self/exe is required for _IGNORED_BINARIES.
Simon Ruderich [Thu, 2 Jan 2014 14:20:43 +0000 (15:20 +0100)]
README: /proc/self/exe is required for _IGNORED_BINARIES.

7 years agoUpdate copyright year.
Simon Ruderich [Wed, 1 Jan 2014 15:41:01 +0000 (16:41 +0100)]
Update copyright year.

7 years agoFix error_at_line() not always exiting if status != 0.
Simon Ruderich [Wed, 1 Jan 2014 15:37:48 +0000 (16:37 +0100)]
Fix error_at_line() not always exiting if status != 0.

Also add tests.

7 years agoREADME: Minor improvements.
Simon Ruderich [Mon, 9 Dec 2013 20:43:58 +0000 (21:43 +0100)]
README: Minor improvements.

7 years agom4/README: Add.
Simon Ruderich [Mon, 9 Dec 2013 20:43:42 +0000 (21:43 +0100)]
m4/README: Add.

7 years ago.gitignore: Sort.
Simon Ruderich [Mon, 9 Dec 2013 20:43:28 +0000 (21:43 +0100)]
.gitignore: Sort.

7 years agoREADME: Update.
Simon Ruderich [Wed, 4 Dec 2013 00:51:02 +0000 (01:51 +0100)]
README: Update.

7 years agoNEWS: Add. Release 0.1. 0.1
Simon Ruderich [Tue, 3 Dec 2013 23:48:03 +0000 (00:48 +0100)]
NEWS: Add. Release 0.1.

8 years agoAdd likely() to tracked_fds_find().
Simon Ruderich [Sat, 14 Sep 2013 22:15:50 +0000 (00:15 +0200)]
Add likely() to tracked_fds_find().

8 years agoRemove unnecessary check in handle_*_pre().
Simon Ruderich [Sat, 14 Sep 2013 22:10:45 +0000 (00:10 +0200)]
Remove unnecessary check in handle_*_pre().

init_pre_post_string() sets both pre_string and post_string, so checking
only one suffices.

8 years agoREADME: Fix minor typos.
Simon Ruderich [Sat, 14 Sep 2013 22:10:15 +0000 (00:10 +0200)]
README: Fix minor typos.

8 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().

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

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

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

8 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.

8 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().

8 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.

8 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.

8 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.

8 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.

8 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.

8 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.

8 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.

8 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.

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

8 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.

8 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.

8 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.

8 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.

8 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().

8 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.

8 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.

8 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().

8 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.

8 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*().

8 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.

8 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.

8 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.

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

8 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.

8 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>.

8 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.

8 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.

8 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")).

8 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.

8 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.

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

8 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.

8 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.

8 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 `..'.

8 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.

8 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.

8 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.

8 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.

8 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.

8 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.

8 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().

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

8 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.

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

8 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.

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

8 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*().

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

8 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().

8 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.

8 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.

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

8 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.

8 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.

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

8 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.

8 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.

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

8 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.

8 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.

8 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.

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

8 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().

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

8 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.

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

8 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().

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