[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: RFS: failmalloc



Alessandro Ghedini wrote:

> I re-uploaded the package on Debian Mentors [0] with the changes suggested
> by Jonathan.

More precisely, I was suggesting something like the following (eliminating
the libfailmalloc-dev package completely).

While at it, the patch below copes better with spaces in command line
arguments.  Untested.

diff --git a/debian/control b/debian/control
index 0e929ab..c0d6251 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@ Homepage: http://www.nongnu.org/failmalloc
 
 Package: failmalloc
 Architecture: any
-Depends: ${misc:Depends}, libfailmalloc0
+Depends: ${misc:Depends}, libfailmalloc0 (= ${binary:Version})
 Description: Memory allocation failure crash-test tool
  The idea behind failmalloc is to demonstrate what really happens if
  memory allocation fails. Unfortunately, most programs in this world are
@@ -22,26 +22,9 @@ Description: Memory allocation failure crash-test tool
  program, which induces always, often or sometimes failures of memory
  allocation calls. The functions malloc, realloc and memalign are hooked,
  but other functions which use one of these functions are also affected.
-
-Package: libfailmalloc-dev
-Section: libdevel
-Architecture: any
-Depends: libfailmalloc0 (= ${binary:Version}), ${misc:Depends}
-Description: Memory allocation failure crash-test tool (development files)
- The idea behind failmalloc is to demonstrate what really happens if
- memory allocation fails. Unfortunately, most programs in this world are
- not robust, mostly because programmers are careless, but sometimes because
- programmers are too brave. Regardless of whatever reasons, the most
- critical problem is in that there is no good way to see such failures
- in reality, until a program is deployed into a heavy production system.
- Clearly, this is too late!
- .
- Failmalloc addresses this problem. Failmalloc inserts hooks into your
- program, which induces always, often or sometimes failures of memory
- allocation calls. The functions malloc, realloc and memalign are hooked,
- but other functions which use one of these functions are also affected.
  .
- This package provides the development files for the failmalloc library.
+ This package provides a failmalloc program and development files for
+ the failmalloc library.
 
 Package: libfailmalloc0
 Architecture: any
diff --git a/debian/failmalloc.install b/debian/failmalloc.install
index 6e8e483..d205b4a 100644
--- a/debian/failmalloc.install
+++ b/debian/failmalloc.install
@@ -1,2 +1,4 @@
 debian/scripts/failmalloc	usr/bin
-debian/tmp/usr/lib/libfailmalloc.so
+usr/lib/lib*.a
+usr/lib/lib*.so
+usr/lib/*.la
diff --git a/debian/libfailmalloc-dev.install b/debian/libfailmalloc-dev.install
deleted file mode 100644
index 8bfbd3c..0000000
--- a/debian/libfailmalloc-dev.install
+++ /dev/null
@@ -1,3 +0,0 @@
-usr/lib/lib*.a
-usr/lib/lib*.so
-usr/lib/*.la
diff --git a/debian/scripts/failmalloc b/debian/scripts/failmalloc
index cc4e1d5..1f24a0e 100755
--- a/debian/scripts/failmalloc
+++ b/debian/scripts/failmalloc
@@ -1,11 +1,11 @@
 #!/bin/bash
 
 usage () {
-cat - >&2 <<EOF
+cat >&2 <<EOF
 failmalloc, memory allocation failure crash-test tool.
    usage: failmalloc [-p|--probability probability] [-t|--times times]
                      [-i|--interval interval] [-s|--space space]
-		     [-h|--help] [-v|--version]
+                     [-h|--help] [-v|--version]
                      -- [command]
 EOF
   exit 1
@@ -29,25 +29,26 @@ if test "$?" -ne 0; then
   usage
 fi
 
-FAIL_COMMAND="LD_PRELOAD=/usr/lib/libfailmalloc.so "
+LD_PRELOAD="/usr/lib/libfailmalloc.so${LD_PRELOAD:+ $LD_PRELOAD}"
+export LD_PRELOAD
 
 while test "X$1" != "X--"; do
   case "$1" in
     -p|--probability)
        shift
-       FAIL_COMMAND="${FAIL_COMMAND} FAILMALLOC_PROBABILITY=$1 "
+       export FAILMALLOC_PROBABILITY="$1"
        ;;
     -i|--interval)
        shift
-       FAIL_COMMAND="${FAIL_COMMAND} FAILMALLOC_INTERVAL=$1 "
+       export FAILMALLOC_INTERVAL="$1"
        ;;
     -t|--times)
        shift
-       FAIL_COMMAND="${FAIL_COMMAND} FAILMALLOC_TIMES=$1 "
+       export FAILMALLOC_TIMES="$1"
        ;;
     -s|--space)
        shift
-       FAIL_COMMAND="${FAIL_COMMAND} FAILMALLOC_SPACE=$1 "
+       export FAILMALLOC_SPACE="$1"
        ;;
     -v|--version)
        echo "failmalloc version 1.0"
@@ -62,4 +63,4 @@ done
 
 shift
 
-env $FAIL_COMMAND $@
+exec "$@"


Reply to: