I am uploading a NMU to DELAYED/10 in order to fix this.
The debdiff is attached.
diff -Nru binstats-1.08/Makefile binstats-1.08/Makefile
--- binstats-1.08/Makefile 2024-02-18 16:23:57.000000000 +0000
+++ binstats-1.08/Makefile 1999-12-06 19:36:05.000000000 +0000
@@ -12,8 +12,8 @@
PREFIX= /usr/local
# If you want to install derefsymlink in some place other than
# /usr/local/bin then make sure PATH is set accordingly in binstats
-DESTBIN= $(DESTDIR)/$(PREFIX)/bin
-DESTMAN= $(DESTDIR)/$(PREFIX)/man/man1
+DESTBIN= $(PREFIX)/bin
+DESTMAN= $(PREFIX)/man/man1
derefsymlink: derefsymlink.o
$(CC) -o $@ $(CFLAGS) $(LDFLAGS) derefsymlink.o
@@ -24,4 +24,4 @@
install -m 644 binstats.1 derefsymlink.1 $(DESTMAN)
clean:
- rm -f derefsymlink derefsymlink.o *~ *.00 bstats.log*
+ rm -f derefsymlink derefsymlink.o
diff -Nru binstats-1.08/binstats binstats-1.08/binstats
--- binstats-1.08/binstats 2024-02-18 16:23:57.000000000 +0000
+++ binstats-1.08/binstats 2001-01-18 12:31:38.000000000 +0000
@@ -100,7 +100,6 @@
# your system or ignore if USEPATH=1)
EXEDIR="/bin /usr/bin /usr/local/bin /sbin /usr/sbin /usr/local/sbin
/usr/X11R6/bin /usr/games"
-USEMANPATH=1
# the list of directories where your man pages reside
MANDIR="/usr/man /usr/share/man /usr/X11R6/man /usr/local/man"
@@ -136,8 +135,6 @@
DEBUG=0
# another debugging option, set to 0 to reuse old temp files
FILEOPS=1
-# Debian checks? Set to 1 to skip Debian-specific checks
-NODEBIAN=0
#----------process command line arguments---------------
CLI_USAGE=\
@@ -146,7 +143,7 @@
[-l[ibraries]=\"/lib /usr/lib\"]
[-m[anuals]=\"/usr/man /usr/local/man\"]
[-p[ath]=\"/bin:/usr/bin:/usr/local/bin\"]
- [-t[emp]=/tmp] [-s[kip-debian] [-v[ersion]]"
+ [-t[emp]=/tmp] [-v[ersion]]"
for CLI_OPT
do
@@ -165,11 +162,8 @@
-l*=*) USELDSOCONF=0
DLIBDIR="$CLI_ARG" ;;
-m*=*) MANDIR="$CLI_ARG" ;;
- -m*=*) USEMANPATH=0
- MANDIR="$CLI_ARG" ;;
-p*=*) PATH="$CLI_ARG" ;;
-t*=*) TMPDIR="$CLI_ARG" ;;
- -s*=*) NODEBIAN=1 ;;
-v*) echo "binstats-$BSVER"
exit 0 ;;
*) echo "$CLI_USAGE"
@@ -183,23 +177,10 @@
EXEDIR=`echo $OLDPATH | tr : ' ' | sed s:\~:$HOME:g`
fi
-if [ $USEMANPATH -eq 1 ];then
- MANDIR=`manpath | tr : ' '`
-fi
-
if [ $USELDSOCONF -eq 1 ]; then
# use /etc/ld.so.conf plus the two "trusted" locations
- LDSOCONF=`cat /etc/ld.so.conf | grep -v '^#' | grep -v '^include ' | xargs
echo`
+ LDSOCONF=`cat /etc/ld.so.conf | grep -v '^#' | xargs echo`
DLIBDIR="/lib /usr/lib $LDSOCONF"
-
- # Handle includes in LDSOCONF
- LDSOCONF_INC=`cat /etc/ld.so.conf | grep -v '^#' | grep '^include ' | sed -e
's/^include //' | xargs echo`
- for file in `ls $LDSOCONF_INC 2>/dev/null`; do
- if [ -e "$file" ]; then
- LDSOCONF=`cat $file | grep -v '^#' | grep -v '^include ' | xargs echo`
- DLIBDIR="$DLIBDIR $LDSOCONF"
- fi
- done
fi
# ID number
@@ -207,107 +188,52 @@
# name of temp log
BSLOGTMP=$BSLOG.$PIDNO
-# Create the files we are going to use
-# backup old log file
-if [ -f $BSLOG ]; then mv -f $BSLOG $BSLOG~; fi
-{ umask 066; touch $BSLOG; [ -e $BSLOGTMP ] && rm -f $BSLOGTMP; touch
$BSLOGTMP ; }
if [ $DEBUG -gt 0 ]; then
- BINSDIR=.
+ TMPDIR=.
PIDNO=00
else
- BINSDIR=`mktemp -t -d binstats.XXXXXX` || { echo "$0: Cannot create temporary
directory!" >&2; exit 1; }
-fi
-# tidy up
-if [ $DEBUG -eq 0 ]; then
- trap " [ -d \"$BINSDIR\" ] && /bin/rm -rf -- \"$BINSDIR\"" 0 1 2 3 13 15
+ TMPDIR=$TMPDIR/binstats.$PIDNO
+ mkdir -m 700 $TMPDIR || exit 1
fi
+
# list of executables
-EXELIST=$BINSDIR/exelist.$PIDNO
+EXELIST=$TMPDIR/exelist.$PIDNO
# list of dynamic libraries
-DLIBLIST=$BINSDIR/dliblist.$PIDNO
+DLIBLIST=$TMPDIR/dliblist.$PIDNO
# list of man pages
-MANLIST=$BINSDIR/manlist.$PIDNO
+MANLIST=$TMPDIR/manlist.$PIDNO
# executable types
-EXEFILE=$BINSDIR/exefile.$PIDNO
+EXEFILE=$TMPDIR/exefile.$PIDNO
# list of dependent (used) libraries
-EXELIB=$BINSDIR/exelib.$PIDNO
+EXELIB=$TMPDIR/exelib.$PIDNO
# list of unused libraries
-DLIBUN=$BINSDIR/dlibun.$PIDNO
-# list of unused libraries with packages
-DLIBUNP=$BINSDIR/dlibunp.$PIDNO
-
-# Unused library packages
-LIBPUN=$BINSDIR/libpun.$PIDNO
-# Package list
-PACKLIST=$BINSDIR/packlist.$PIDNO
+DLIBUN=$TMPDIR/dlibun.$PIDNO
# temporary storage
-DTEMPA=$BINSDIR/dtempa.$PIDNO # all dynamic libs in $DLIBDIR
-DTEMPB=$BINSDIR/dtempb.$PIDNO # missing dynamic libs in $EXELIB
-DTEMPC=$BINSDIR/dtempc.$PIDNO # dereferenced list of $DTEMPA
-
-ETEMPA=$BINSDIR/etempa.$PIDNO # all files in $EXEDIR
-ETEMPB=$BINSDIR/etempb.$PIDNO # output of ldd on files in $EXEFILE
-ETEMPC=$BINSDIR/etempc.$PIDNO # statically linked binaries in $ETEMPB
-ETEMPD=$BINSDIR/etempd.$PIDNO # duplicate executable names in $ETEMPA
-ETEMPE=$BINSDIR/etempe.$PIDNO # 'not stripped' binaries in $EXEFILE
-ETEMPF=$BINSDIR/etempf.$PIDNO # setuid binaries in $EXEFILE
+DTEMPA=$TMPDIR/dtempa.$PIDNO # all dynamic libs in $DLIBDIR
+DTEMPB=$TMPDIR/dtempb.$PIDNO # missing dynamic libs in $EXELIB
+DTEMPC=$TMPDIR/dtempc.$PIDNO # dereferenced list of $DTEMPA
+
+ETEMPA=$TMPDIR/etempa.$PIDNO # all files in $EXEDIR
+ETEMPB=$TMPDIR/etempb.$PIDNO # output of ldd on files in $EXEFILE
+ETEMPC=$TMPDIR/etempc.$PIDNO # statically linked binaries in $ETEMPB
+ETEMPD=$TMPDIR/etempd.$PIDNO # duplicate executable names in $ETEMPA
+ETEMPE=$TMPDIR/etempe.$PIDNO # 'not stripped' binaries in $EXEFILE
+ETEMPF=$TMPDIR/etempf.$PIDNO # setuid binaries in $EXEFILE
-MTEMPA=$BINSDIR/mtempa.$PIDNO # all files in $MANDIR
-MTEMPB=$BINSDIR/mtempb.$PIDNO # duplicate executable names in $MTEMPA
-
-# A wrapper around readlink(1).
-derefsymlink()
-{
- while [ $# -gt 0 ]; do
- if [ "$1" = -f ]; then
- shift
- while read f; do
- readlink -f "$f" || echo "$f"
- done < "$1"
- elif [ "$1" = -s ]; then
- while read f; do
- readlink -f "$f" || echo "$f"
- done
- else
- readlink -f "$1" || echo "$1"
- fi
- shift
- done
-}
-
-isdebian()
-{
- if [ -e /etc/debian_version ] && [ "$NODEBIAN" -eq 0 ] ; then
- return 0
- else
- return 1
- fi
-}
-
-# Abort gracefully if a file is missing
-check_aborted()
-{
- file=$1
- if [ ! -e "$file" ] ; then
- echo "$0: Task aborted and missing temporary file ($file). Exiting. "
>&2
- exit 1
- fi
- return 0
-}
+MTEMPA=$TMPDIR/mtempa.$PIDNO # all files in $MANDIR
+MTEMPB=$TMPDIR/mtempb.$PIDNO # duplicate executable names in $MTEMPA
#----------begin program---------------
if [ $FILEOPS -gt 0 ]; then
echo "Look in $EXEDIR for executables"
-find $EXEDIR -perm /111 -maxdepth 1 -type f -follow -print 2>/dev/null| \
+find $EXEDIR -perm +111 -maxdepth 1 -type f -follow -print | \
derefsymlink -s | sort | uniq | \
awk -F '/' '{ printf "%s:%s\n", $NF, $0 }' > $ETEMPA
-check_aborted $ETEMPA
-
echo "Find duplicated executable names"
# use an awk script instead of whereis later (as suggested by Preston Crow)
# R=repetition, N=name, P=path
@@ -321,33 +247,27 @@
END { if (R==1) {printf("%s\n",P)} }' \
> $ETEMPD
-check_aborted $ETEMPD
-
echo "Sort out list by alphabetical order"
sort -t ':' $ETEMPA | cut -d ':' -f 2- > $EXELIST
-check_aborted $EXELIST
-
echo "Find executable type (this will take a long time)"
cat $EXELIST | xargs file > $EXEFILE
-check_aborted $EXEFILE
-
echo "Look for dynamic library dependence (this will take an even longer time)"
# hmm, ldd (1.7.14) seems to output some unprintable character when it
# encounters a static a.out image
# And ldd (1.9.2) prints some hex numbers after library name in parentheses
if [ $LDDBA -eq 0 ]; then
grep 'executable' $EXEFILE | cut -d ':' -f 1 | \
- xargs ldd 2>/dev/null | col -b | cut -d '(' -f 1 >& $ETEMPB
+ xargs ldd | col -b | cut -d '(' -f 1 >& $ETEMPB
else
grep 'executable' $EXEFILE | cut -d ':' -f 1 | \
- xargs ldd 2>/dev/null | awk cut -d '(' -f 1 >& $ETEMPB
+ xargs ldd | awk cut -d '(' -f 1 >& $ETEMPB
fi
echo "List the used dynamic libraries"
grep 'lib[^:]*\.so' $ETEMPB | sort -b | uniq -c > $EXELIB
-grep 'statically linked' $EXEFILE > $ETEMPC
+grep 'statically linked' $ETEMPB > $ETEMPC
echo "Hunt down binaries that depend on missing libraries"
awk \
@@ -355,61 +275,18 @@
/not found/ { if (NEW == 1) print CURPROG; NEW = 0 }' \
$ETEMPB > $DTEMPB
-check_aborted $DTEMPB
-
echo "Look in $DLIBDIR for dynamic libraries"
find $DLIBDIR -maxdepth 1 -type f -name 'lib*.so*' | \
derefsymlink -s | sort | uniq > $DLIBLIST
-check_aborted $DLIBLIST
-
echo "Search for unused dynamic libraries"
grep -v 'not found' $EXELIB | cut -d '/' -f 2- | cut -d ' ' -f 1 | \
sort | uniq | sed 's,^,/,g' > $DTEMPA
-check_aborted $DTEMPA
-
derefsymlink -f $DTEMPA | sort | uniq > $DTEMPC
-check_aborted $DTEMPC
-
diff -du $DLIBLIST $DTEMPC | grep '^-/' | cut -b 2- > $DLIBUN
-check_aborted $DLIBUN
-
-# If this is a Debian system, add the packages in too
-if isdebian ; then
- echo "Search for packages holding unused dynamic libraries"
- >$PACKLIST
- >$DLIBUNP
- cat $DLIBUN |
- while read file; do
- package=`dpkg -S $file 2>/dev/null | cut -f 1 -d :`
- if [ -n "$package" ] ; then
- echo $package >>$PACKLIST
- echo "$file ($package)" >>$DLIBUNP
- else
- echo "$file" >>$DLIBUNP
- fi
- done
- echo "Reviewing packages holding unused dynamic libraries"
- cat $PACKLIST | sort -u |
- while read package ; do
- # TODO, could be done on packages that begin with 'lib'
- unused=1
- for library in `dpkg -L $package |grep lib/`; do
- if [ -z "`grep ^$library\$ $DLIBUN`" ] ; then
- unused=0
- break
- fi
- done
- if [ $unused -eq 1 ] ; then
- echo "$package" >>$LIBPUN
- fi
- done
-fi
-
-
echo "Find un-stripped binaries"
grep 'not stripped' $EXEFILE | sort > $ETEMPE
@@ -423,8 +300,6 @@
derefsymlink -s | sort | uniq | \
awk -F '/' '{ printf "%s;%s\n", $NF, $0 }' > $MTEMPA
-check_aborted $MTEMPA
-
echo "Find duplicated man page names"
sort -t ';' $MTEMPA | awk -F ';' \
'BEGIN { R=0;N="";P="" }
@@ -436,8 +311,6 @@
END { if (R==1) {printf("%s\n",P)} }' \
> $MTEMPB
-check_aborted $MTEMPB
-
# finish messing around with files and lists of files
# now work out some numbers
@@ -452,7 +325,6 @@
JAVAC=`grep 'Java bytecode' $EXEFILE | wc -l`
LIBC=`cat $EXELIB | wc -l`
UNLIBC=`cat $DLIBUN | wc -l`
-LIBPUNC=`cat $LIBPUN | wc -l`
DLLIBC=`grep 'DLL' $EXELIB | wc -l`
SELFC=`grep 'ELF' $ETEMPC | wc -l`
SECOFFC=`grep 'ECOFF' $ETEMPC | wc -l`
@@ -533,9 +405,6 @@
echo "Used libraries: $LIBC" >> $BSLOGTMP
echo " DLL: $DLLIBC" >> $BSLOGTMP
echo "Unused libs: $UNLIBC" >> $BSLOGTMP
-if isdebian ; then
-echo "Packages with unused libs: $LIBPUNC" >> $BSLOGTMP
-fi
echo "Man pages: $MANC" >> $BSLOGTMP
echo " Duplicate names: $MANDUPC" >> $BSLOGTMP
@@ -601,7 +470,8 @@
DOTLINE=0
if [ $SELFC -gt 0 ]; then
echo "statically linked (ELF):" >> $BSLOGTMP
- grep 'ELF' $ETEMPC | cut -d ':' -f 1 >> $BSLOGTMP
+ grep -B 1 'statically linked (ELF)' $ETEMPB | grep '^/' | \
+ cut -d ':' -f 1 >> $BSLOGTMP
DOTLINE=1
fi
if [ $ELFUNSTR -gt 0 ]; then
@@ -701,18 +571,7 @@
if [ $UNLIBC -gt 0 ]; then
echo "--------------------------------------------------------------" >>
$BSLOGTMP
echo "unused:" >> $BSLOGTMP
- if isdebian ; then
- cat $DLIBUNP >> $BSLOGTMP
- else
- cat $DLIBUN >> $BSLOGTMP
- fi
-fi
-echo "==============================================================" >>
$BSLOGTMP
-if isdebian && [ $LIBPUNC -gt 0 ]; then
- echo "PACKAGES:" >> $BSLOGTMP
- echo "--------------------------------------------------------------" >>
$BSLOGTMP
- echo "with all libraries unused:" >> $BSLOGTMP
- cat $LIBPUN >> $BSLOGTMP
+ cat $DLIBUN >> $BSLOGTMP
fi
echo "==============================================================" >>
$BSLOGTMP
if [ $MANDUPC -gt 0 ]; then
@@ -721,6 +580,8 @@
echo "==============================================================" >>
$BSLOGTMP
fi
+# backup old log file
+if [ -f $BSLOG ]; then mv -f $BSLOG $BSLOG~; fi
# filter through sed to beautify (note the embedded TAB)
sed -e 's,^/\(.*[^:]\)$, /\1,g' $BSLOGTMP > $BSLOG
rm -f $BSLOGTMP
@@ -777,6 +638,10 @@
echo "Man pages: $MANC"
echo " Duplicate names: $MANDUPC"
+# tidy up
+if [ $DEBUG -eq 0 ]; then
+ rm -rf $TMPDIR
+fi
echo "=============================================================="
echo "More detailed information can be obtained in $BSLOG"
diff -Nru binstats-1.08/binstats.1 binstats-1.08/binstats.1
--- binstats-1.08/binstats.1 2024-02-18 16:23:57.000000000 +0000
+++ binstats-1.08/binstats.1 1999-12-06 19:37:56.000000000 +0000
@@ -6,7 +6,6 @@
.RB [ -b [ inaries ]\c
.RI = bindirs ]
.RB [ -d [ ebug ]]
-.RB [ -s [ kip-debian ]
.RB [ -f [ ile ]\c
.RI = logfile ]
.RB [ -l [ ibraries ]\c
@@ -34,10 +33,6 @@
Store temporary files in the current directory and do not remove them when
finished.
.TP
-.B -skip-debian
-Skip Debian tests that analyse installed packages even if this is a
-Debian system.
-.TP
.BI -file " logfile"
Output report to
.I logfile
diff -Nru binstats-1.08/debian/changelog binstats-1.08/debian/changelog
--- binstats-1.08/debian/changelog 2024-02-18 16:23:57.000000000 +0000
+++ binstats-1.08/debian/changelog 2024-02-18 16:19:50.000000000 +0000
@@ -1,3 +1,10 @@
+binstats (1.08-9.2) unstable; urgency=medium
+
+ * Non-maintainer upload
+ * Convert to source format 3.0 (Closes: #1007548)
+
+ -- Bastian Germann <[email protected]> Sun, 18 Feb 2024 16:19:50 +0000
+
binstats (1.08-9.1) unstable; urgency=medium
* Non-maintainer upload.
diff -Nru binstats-1.08/debian/patches/debian.patch
binstats-1.08/debian/patches/debian.patch
--- binstats-1.08/debian/patches/debian.patch 1970-01-01 00:00:00.000000000
+0000
+++ binstats-1.08/debian/patches/debian.patch 2024-02-18 16:19:50.000000000
+0000
@@ -0,0 +1,421 @@
+--- binstats-1.08.orig/Makefile
++++ binstats-1.08/Makefile
+@@ -12,8 +12,8 @@ LDFLAGS= -s
+ PREFIX= /usr/local
+ # If you want to install derefsymlink in some place other than
+ # /usr/local/bin then make sure PATH is set accordingly in binstats
+-DESTBIN= $(PREFIX)/bin
+-DESTMAN= $(PREFIX)/man/man1
++DESTBIN= $(DESTDIR)/$(PREFIX)/bin
++DESTMAN= $(DESTDIR)/$(PREFIX)/man/man1
+
+ derefsymlink: derefsymlink.o
+ $(CC) -o $@ $(CFLAGS) $(LDFLAGS) derefsymlink.o
+@@ -24,4 +24,4 @@ install:: derefsymlink
+ install -m 644 binstats.1 derefsymlink.1 $(DESTMAN)
+
+ clean:
+- rm -f derefsymlink derefsymlink.o
++ rm -f derefsymlink derefsymlink.o *~ *.00 bstats.log*
+--- binstats-1.08.orig/binstats
++++ binstats-1.08/binstats
+@@ -100,6 +100,7 @@ USEPATH=1
+ # your system or ignore if USEPATH=1)
+ EXEDIR="/bin /usr/bin /usr/local/bin /sbin /usr/sbin /usr/local/sbin
/usr/X11R6/bin /usr/games"
+
++USEMANPATH=1
+ # the list of directories where your man pages reside
+ MANDIR="/usr/man /usr/share/man /usr/X11R6/man /usr/local/man"
+
+@@ -135,6 +136,8 @@ LDDBB=0 # executable name missing for si
+ DEBUG=0
+ # another debugging option, set to 0 to reuse old temp files
+ FILEOPS=1
++# Debian checks? Set to 1 to skip Debian-specific checks
++NODEBIAN=0
+
+ #----------process command line arguments---------------
+ CLI_USAGE=\
+@@ -143,7 +146,7 @@ CLI_USAGE=\
+ [-l[ibraries]=\"/lib /usr/lib\"]
+ [-m[anuals]=\"/usr/man /usr/local/man\"]
+ [-p[ath]=\"/bin:/usr/bin:/usr/local/bin\"]
+- [-t[emp]=/tmp] [-v[ersion]]"
++ [-t[emp]=/tmp] [-s[kip-debian] [-v[ersion]]"
+
+ for CLI_OPT
+ do
+@@ -162,8 +165,11 @@ do
+ -l*=*) USELDSOCONF=0
+ DLIBDIR="$CLI_ARG" ;;
+ -m*=*) MANDIR="$CLI_ARG" ;;
++ -m*=*) USEMANPATH=0
++ MANDIR="$CLI_ARG" ;;
+ -p*=*) PATH="$CLI_ARG" ;;
+ -t*=*) TMPDIR="$CLI_ARG" ;;
++ -s*=*) NODEBIAN=1 ;;
+ -v*) echo "binstats-$BSVER"
+ exit 0 ;;
+ *) echo "$CLI_USAGE"
+@@ -177,10 +183,23 @@ if [ $USEPATH -eq 1 ]; then
+ EXEDIR=`echo $OLDPATH | tr : ' ' | sed s:\~:$HOME:g`
+ fi
+
++if [ $USEMANPATH -eq 1 ];then
++ MANDIR=`manpath | tr : ' '`
++fi
++
+ if [ $USELDSOCONF -eq 1 ]; then
+ # use /etc/ld.so.conf plus the two "trusted" locations
+- LDSOCONF=`cat /etc/ld.so.conf | grep -v '^#' | xargs echo`
++ LDSOCONF=`cat /etc/ld.so.conf | grep -v '^#' | grep -v '^include ' | xargs
echo`
+ DLIBDIR="/lib /usr/lib $LDSOCONF"
++
++ # Handle includes in LDSOCONF
++ LDSOCONF_INC=`cat /etc/ld.so.conf | grep -v '^#' | grep '^include ' | sed -e
's/^include //' | xargs echo`
++ for file in `ls $LDSOCONF_INC 2>/dev/null`; do
++ if [ -e "$file" ]; then
++ LDSOCONF=`cat $file | grep -v '^#' | grep -v '^include ' | xargs echo`
++ DLIBDIR="$DLIBDIR $LDSOCONF"
++ fi
++ done
+ fi
+
+ # ID number
+@@ -188,52 +207,107 @@ PIDNO=$$
+
+ # name of temp log
+ BSLOGTMP=$BSLOG.$PIDNO
++# Create the files we are going to use
++# backup old log file
++if [ -f $BSLOG ]; then mv -f $BSLOG $BSLOG~; fi
++{ umask 066; touch $BSLOG; [ -e $BSLOGTMP ] && rm -f $BSLOGTMP; touch
$BSLOGTMP ; }
+
+ if [ $DEBUG -gt 0 ]; then
+- TMPDIR=.
++ BINSDIR=.
+ PIDNO=00
+ else
+- TMPDIR=$TMPDIR/binstats.$PIDNO
+- mkdir -m 700 $TMPDIR || exit 1
++ BINSDIR=`mktemp -t -d binstats.XXXXXX` || { echo "$0: Cannot create
temporary directory!" >&2; exit 1; }
++fi
++# tidy up
++if [ $DEBUG -eq 0 ]; then
++ trap " [ -d \"$BINSDIR\" ] && /bin/rm -rf -- \"$BINSDIR\"" 0 1 2 3 13 15
+ fi
+-
+
+ # list of executables
+-EXELIST=$TMPDIR/exelist.$PIDNO
++EXELIST=$BINSDIR/exelist.$PIDNO
+ # list of dynamic libraries
+-DLIBLIST=$TMPDIR/dliblist.$PIDNO
++DLIBLIST=$BINSDIR/dliblist.$PIDNO
+ # list of man pages
+-MANLIST=$TMPDIR/manlist.$PIDNO
++MANLIST=$BINSDIR/manlist.$PIDNO
+ # executable types
+-EXEFILE=$TMPDIR/exefile.$PIDNO
++EXEFILE=$BINSDIR/exefile.$PIDNO
+ # list of dependent (used) libraries
+-EXELIB=$TMPDIR/exelib.$PIDNO
++EXELIB=$BINSDIR/exelib.$PIDNO
+ # list of unused libraries
+-DLIBUN=$TMPDIR/dlibun.$PIDNO
++DLIBUN=$BINSDIR/dlibun.$PIDNO
++# list of unused libraries with packages
++DLIBUNP=$BINSDIR/dlibunp.$PIDNO
++
++# Unused library packages
++LIBPUN=$BINSDIR/libpun.$PIDNO
++# Package list
++PACKLIST=$BINSDIR/packlist.$PIDNO
+
+ # temporary storage
+-DTEMPA=$TMPDIR/dtempa.$PIDNO # all dynamic libs in $DLIBDIR
+-DTEMPB=$TMPDIR/dtempb.$PIDNO # missing dynamic libs in $EXELIB
+-DTEMPC=$TMPDIR/dtempc.$PIDNO # dereferenced list of $DTEMPA
+-
+-ETEMPA=$TMPDIR/etempa.$PIDNO # all files in $EXEDIR
+-ETEMPB=$TMPDIR/etempb.$PIDNO # output of ldd on files in $EXEFILE
+-ETEMPC=$TMPDIR/etempc.$PIDNO # statically linked binaries in $ETEMPB
+-ETEMPD=$TMPDIR/etempd.$PIDNO # duplicate executable names in $ETEMPA
+-ETEMPE=$TMPDIR/etempe.$PIDNO # 'not stripped' binaries in $EXEFILE
+-ETEMPF=$TMPDIR/etempf.$PIDNO # setuid binaries in $EXEFILE
++DTEMPA=$BINSDIR/dtempa.$PIDNO # all dynamic libs in $DLIBDIR
++DTEMPB=$BINSDIR/dtempb.$PIDNO # missing dynamic libs in $EXELIB
++DTEMPC=$BINSDIR/dtempc.$PIDNO # dereferenced list of $DTEMPA
++
++ETEMPA=$BINSDIR/etempa.$PIDNO # all files in $EXEDIR
++ETEMPB=$BINSDIR/etempb.$PIDNO # output of ldd on files in $EXEFILE
++ETEMPC=$BINSDIR/etempc.$PIDNO # statically linked binaries in $ETEMPB
++ETEMPD=$BINSDIR/etempd.$PIDNO # duplicate executable names in $ETEMPA
++ETEMPE=$BINSDIR/etempe.$PIDNO # 'not stripped' binaries in $EXEFILE
++ETEMPF=$BINSDIR/etempf.$PIDNO # setuid binaries in $EXEFILE
+
+-MTEMPA=$TMPDIR/mtempa.$PIDNO # all files in $MANDIR
+-MTEMPB=$TMPDIR/mtempb.$PIDNO # duplicate executable names in $MTEMPA
++MTEMPA=$BINSDIR/mtempa.$PIDNO # all files in $MANDIR
++MTEMPB=$BINSDIR/mtempb.$PIDNO # duplicate executable names in $MTEMPA
++
++# A wrapper around readlink(1).
++derefsymlink()
++{
++ while [ $# -gt 0 ]; do
++ if [ "$1" = -f ]; then
++ shift
++ while read f; do
++ readlink -f "$f" || echo "$f"
++ done < "$1"
++ elif [ "$1" = -s ]; then
++ while read f; do
++ readlink -f "$f" || echo "$f"
++ done
++ else
++ readlink -f "$1" || echo "$1"
++ fi
++ shift
++ done
++}
++
++isdebian()
++{
++ if [ -e /etc/debian_version ] && [ "$NODEBIAN" -eq 0 ] ; then
++ return 0
++ else
++ return 1
++ fi
++}
++
++# Abort gracefully if a file is missing
++check_aborted()
++{
++ file=$1
++ if [ ! -e "$file" ] ; then
++ echo "$0: Task aborted and missing temporary file ($file). Exiting. "
>&2
++ exit 1
++ fi
++ return 0
++}
+
+ #----------begin program---------------
+ if [ $FILEOPS -gt 0 ]; then
+
+ echo "Look in $EXEDIR for executables"
+-find $EXEDIR -perm +111 -maxdepth 1 -type f -follow -print | \
++find $EXEDIR -perm /111 -maxdepth 1 -type f -follow -print 2>/dev/null| \
+ derefsymlink -s | sort | uniq | \
+ awk -F '/' '{ printf "%s:%s\n", $NF, $0 }' > $ETEMPA
+
++check_aborted $ETEMPA
++
+ echo "Find duplicated executable names"
+ # use an awk script instead of whereis later (as suggested by Preston Crow)
+ # R=repetition, N=name, P=path
+@@ -247,27 +321,33 @@ sort -t ':' $ETEMPA | awk -F ':' \
+ END { if (R==1) {printf("%s\n",P)} }' \
+ > $ETEMPD
+
++check_aborted $ETEMPD
++
+ echo "Sort out list by alphabetical order"
+ sort -t ':' $ETEMPA | cut -d ':' -f 2- > $EXELIST
+
++check_aborted $EXELIST
++
+ echo "Find executable type (this will take a long time)"
+ cat $EXELIST | xargs file > $EXEFILE
+
++check_aborted $EXEFILE
++
+ echo "Look for dynamic library dependence (this will take an even longer
time)"
+ # hmm, ldd (1.7.14) seems to output some unprintable character when it
+ # encounters a static a.out image
+ # And ldd (1.9.2) prints some hex numbers after library name in parentheses
+ if [ $LDDBA -eq 0 ]; then
+ grep 'executable' $EXEFILE | cut -d ':' -f 1 | \
+- xargs ldd | col -b | cut -d '(' -f 1 >& $ETEMPB
++ xargs ldd 2>/dev/null | col -b | cut -d '(' -f 1 >& $ETEMPB
+ else
+ grep 'executable' $EXEFILE | cut -d ':' -f 1 | \
+- xargs ldd | awk cut -d '(' -f 1 >& $ETEMPB
++ xargs ldd 2>/dev/null | awk cut -d '(' -f 1 >& $ETEMPB
+ fi
+
+ echo "List the used dynamic libraries"
+ grep 'lib[^:]*\.so' $ETEMPB | sort -b | uniq -c > $EXELIB
+-grep 'statically linked' $ETEMPB > $ETEMPC
++grep 'statically linked' $EXEFILE > $ETEMPC
+
+ echo "Hunt down binaries that depend on missing libraries"
+ awk \
+@@ -275,18 +355,61 @@ awk \
+ /not found/ { if (NEW == 1) print CURPROG; NEW = 0 }' \
+ $ETEMPB > $DTEMPB
+
++check_aborted $DTEMPB
++
+ echo "Look in $DLIBDIR for dynamic libraries"
+ find $DLIBDIR -maxdepth 1 -type f -name 'lib*.so*' | \
+ derefsymlink -s | sort | uniq > $DLIBLIST
+
++check_aborted $DLIBLIST
++
+ echo "Search for unused dynamic libraries"
+ grep -v 'not found' $EXELIB | cut -d '/' -f 2- | cut -d ' ' -f 1 | \
+ sort | uniq | sed 's,^,/,g' > $DTEMPA
+
++check_aborted $DTEMPA
++
+ derefsymlink -f $DTEMPA | sort | uniq > $DTEMPC
+
++check_aborted $DTEMPC
++
+ diff -du $DLIBLIST $DTEMPC | grep '^-/' | cut -b 2- > $DLIBUN
+
++check_aborted $DLIBUN
++
++# If this is a Debian system, add the packages in too
++if isdebian ; then
++ echo "Search for packages holding unused dynamic libraries"
++ >$PACKLIST
++ >$DLIBUNP
++ cat $DLIBUN |
++ while read file; do
++ package=`dpkg -S $file 2>/dev/null | cut -f 1 -d :`
++ if [ -n "$package" ] ; then
++ echo $package >>$PACKLIST
++ echo "$file ($package)" >>$DLIBUNP
++ else
++ echo "$file" >>$DLIBUNP
++ fi
++ done
++ echo "Reviewing packages holding unused dynamic libraries"
++ cat $PACKLIST | sort -u |
++ while read package ; do
++ # TODO, could be done on packages that begin with 'lib'
++ unused=1
++ for library in `dpkg -L $package |grep lib/`; do
++ if [ -z "`grep ^$library\$ $DLIBUN`" ] ; then
++ unused=0
++ break
++ fi
++ done
++ if [ $unused -eq 1 ] ; then
++ echo "$package" >>$LIBPUN
++ fi
++ done
++fi
++
++
+ echo "Find un-stripped binaries"
+ grep 'not stripped' $EXEFILE | sort > $ETEMPE
+
+@@ -300,6 +423,8 @@ find $MANDIR -maxdepth 2 -type f -follow
+ derefsymlink -s | sort | uniq | \
+ awk -F '/' '{ printf "%s;%s\n", $NF, $0 }' > $MTEMPA
+
++check_aborted $MTEMPA
++
+ echo "Find duplicated man page names"
+ sort -t ';' $MTEMPA | awk -F ';' \
+ 'BEGIN { R=0;N="";P="" }
+@@ -311,6 +436,8 @@ sort -t ';' $MTEMPA | awk -F ';' \
+ END { if (R==1) {printf("%s\n",P)} }' \
+ > $MTEMPB
+
++check_aborted $MTEMPB
++
+
+ # finish messing around with files and lists of files
+ # now work out some numbers
+@@ -325,6 +452,7 @@ ECOFFC=`grep 'ECOFF.*executable' $EXEFIL
+ JAVAC=`grep 'Java bytecode' $EXEFILE | wc -l`
+ LIBC=`cat $EXELIB | wc -l`
+ UNLIBC=`cat $DLIBUN | wc -l`
++LIBPUNC=`cat $LIBPUN | wc -l`
+ DLLIBC=`grep 'DLL' $EXELIB | wc -l`
+ SELFC=`grep 'ELF' $ETEMPC | wc -l`
+ SECOFFC=`grep 'ECOFF' $ETEMPC | wc -l`
+@@ -405,6 +533,9 @@ fi
+ echo "Used libraries: $LIBC" >> $BSLOGTMP
+ echo " DLL: $DLLIBC" >> $BSLOGTMP
+ echo "Unused libs: $UNLIBC" >> $BSLOGTMP
++if isdebian ; then
++echo "Packages with unused libs: $LIBPUNC" >> $BSLOGTMP
++fi
+ echo "Man pages: $MANC" >> $BSLOGTMP
+ echo " Duplicate names: $MANDUPC" >> $BSLOGTMP
+
+@@ -470,8 +601,7 @@ fi
+ DOTLINE=0
+ if [ $SELFC -gt 0 ]; then
+ echo "statically linked (ELF):" >> $BSLOGTMP
+- grep -B 1 'statically linked (ELF)' $ETEMPB | grep '^/' | \
+- cut -d ':' -f 1 >> $BSLOGTMP
++ grep 'ELF' $ETEMPC | cut -d ':' -f 1 >> $BSLOGTMP
+ DOTLINE=1
+ fi
+ if [ $ELFUNSTR -gt 0 ]; then
+@@ -571,7 +701,18 @@ grep -v 'DLL' $EXELIB >> $BSLOGTMP
+ if [ $UNLIBC -gt 0 ]; then
+ echo "--------------------------------------------------------------" >>
$BSLOGTMP
+ echo "unused:" >> $BSLOGTMP
+- cat $DLIBUN >> $BSLOGTMP
++ if isdebian ; then
++ cat $DLIBUNP >> $BSLOGTMP
++ else
++ cat $DLIBUN >> $BSLOGTMP
++ fi
++fi
++echo "==============================================================" >>
$BSLOGTMP
++if isdebian && [ $LIBPUNC -gt 0 ]; then
++ echo "PACKAGES:" >> $BSLOGTMP
++ echo "--------------------------------------------------------------" >>
$BSLOGTMP
++ echo "with all libraries unused:" >> $BSLOGTMP
++ cat $LIBPUN >> $BSLOGTMP
+ fi
+ echo "==============================================================" >>
$BSLOGTMP
+ if [ $MANDUPC -gt 0 ]; then
+@@ -580,8 +721,6 @@ if [ $MANDUPC -gt 0 ]; then
+ echo "==============================================================" >>
$BSLOGTMP
+ fi
+
+-# backup old log file
+-if [ -f $BSLOG ]; then mv -f $BSLOG $BSLOG~; fi
+ # filter through sed to beautify (note the embedded TAB)
+ sed -e 's,^/\(.*[^:]\)$, /\1,g' $BSLOGTMP > $BSLOG
+ rm -f $BSLOGTMP
+@@ -638,10 +777,6 @@ echo "Unused libs: $UNLIBC"
+ echo "Man pages: $MANC"
+ echo " Duplicate names: $MANDUPC"
+
+-# tidy up
+-if [ $DEBUG -eq 0 ]; then
+- rm -rf $TMPDIR
+-fi
+
+ echo "=============================================================="
+ echo "More detailed information can be obtained in $BSLOG"
+--- binstats-1.08.orig/binstats.1
++++ binstats-1.08/binstats.1
+@@ -6,6 +6,7 @@ binstats \- display statistics about pro
+ .RB [ -b [ inaries ]\c
+ .RI = bindirs ]
+ .RB [ -d [ ebug ]]
++.RB [ -s [ kip-debian ]
+ .RB [ -f [ ile ]\c
+ .RI = logfile ]
+ .RB [ -l [ ibraries ]\c
+@@ -33,6 +34,10 @@ be searched for.
+ Store temporary files in the current directory and do not remove them when
+ finished.
+ .TP
++.B -skip-debian
++Skip Debian tests that analyse installed packages even if this is a
++Debian system.
++.TP
+ .BI -file " logfile"
+ Output report to
+ .I logfile
diff -Nru binstats-1.08/debian/patches/series
binstats-1.08/debian/patches/series
--- binstats-1.08/debian/patches/series 1970-01-01 00:00:00.000000000 +0000
+++ binstats-1.08/debian/patches/series 2024-02-18 16:19:50.000000000 +0000
@@ -0,0 +1 @@
+debian.patch
diff -Nru binstats-1.08/debian/source/format binstats-1.08/debian/source/format
--- binstats-1.08/debian/source/format 2024-02-18 16:23:57.000000000 +0000
+++ binstats-1.08/debian/source/format 2024-02-18 16:19:50.000000000 +0000
@@ -1 +1 @@
-1.0
+3.0 (quilt)