diff --git a/debian/bzexe b/debian/bzexe new file mode 100755 index 0000000..7dd8514 --- /dev/null +++ b/debian/bzexe @@ -0,0 +1,182 @@ +#!/bin/sh +# gzexe: compressor for Unix executables. +# Use this only for binaries that you do not use frequently. +# +# The compressed version is a shell script which decompresses itself after +# skipping $skip lines of shell commands. We try invoking the compressed +# executable with the original name (for programs looking at their name). +# We also try to retain the original file permissions on the compressed file. +# For safety reasons, gzexe will not create setuid or setgid shell scripts. + +# WARNING: the first line of this file must be either : or #!/bin/sh +# The : is required for some old versions of csh. +# On Ultrix, /bin/sh is too buggy, change the first line to: #!/bin/sh5 + + +# Copyright (C) 1998, 2002 Free Software Foundation +# Copyright (C) 1993 Jean-loup Gailly + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + + +PATH="/usr/bin:$PATH" +x=`basename $0` +if test $# = 0; then + echo compress executables. original file foo is renamed to foo~ + echo usage: ${x} [-d] files... + echo " -d decompress the executables" + exit 1 +fi + +set -C +tmp=gz$$ +trap "rm -f $tmp; exit 1" HUP INT QUIT TRAP USR1 PIPE TERM +: > $tmp || exit 1 + +decomp=0 +res=0 +test "$x" = "ungzexe" && decomp=1 +if test "x$1" = "x-d"; then + decomp=1 + shift +fi + +echo hi > zfoo1$$ || exit 1 +echo hi > zfoo2$$ || exit 1 +if test -z "`(${CPMOD-cpmod} zfoo1$$ zfoo2$$) 2>&1`"; then + cpmod=${CPMOD-cpmod} +fi +rm -f zfoo[12]$$ + +tail="" +IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:" +for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/tail; then + tail="$dir/tail" + break + fi +done +IFS="$saveifs" +if test -z "$tail"; then + echo cannot find tail + exit 1 +fi +case `echo foo | $tail -n +1 2>/dev/null` in +foo) tail="$tail -n";; +esac + +for i do + if test ! -f "$i" ; then + echo ${x}: $i not a file + res=1 + continue + fi + if test $decomp -eq 0; then + if sed -e 1d -e 2q "$i" | grep "^skip=[0-9]*$" >/dev/null; then + echo "${x}: $i is already gzexe'd" + continue + fi + fi + if ls -l "$i" | grep '^...[sS]' > /dev/null; then + echo "${x}: $i has setuid permission, unchanged" + continue + fi + if ls -l "$i" | grep '^......[sS]' > /dev/null; then + echo "${x}: $i has setgid permission, unchanged" + continue + fi + case "`basename $i`" in + bzip2 | tail | sed | chmod | ln | sleep | rm) + echo "${x}: $i would depend on itself"; continue ;; + esac + if test -z "$cpmod"; then + cp -p "$i" $tmp 2>/dev/null || cp "$i" $tmp + if test -w $tmp 2>/dev/null; then + writable=1 + else + writable=0 + chmod u+w $tmp 2>/dev/null + fi + : >| $tmp # truncate the file, ignoring set -C + fi + if test $decomp -eq 0; then + sed 1q $0 >> $tmp + sed "s|^if tail|if $tail|" >> $tmp <<'EOF' +skip=23 +set -C +umask=`umask` +umask 77 +tmpfile=`tempfile -p gztmp -d /tmp` || exit 1 +if tail +$skip "$0" | /bin/bzip2 -cd >> $tmpfile; then + umask $umask + /bin/chmod 700 $tmpfile + prog="`echo $0 | /bin/sed 's|^.*/||'`" + if /bin/ln -T $tmpfile "/tmp/$prog" 2>/dev/null; then + trap '/bin/rm -f $tmpfile "/tmp/$prog"; exit $res' 0 + (/bin/sleep 5; /bin/rm -f $tmpfile "/tmp/$prog") 2>/dev/null & + /tmp/"$prog" ${1+"$@"}; res=$? + else + trap '/bin/rm -f $tmpfile; exit $res' 0 + (/bin/sleep 5; /bin/rm -f $tmpfile) 2>/dev/null & + $tmpfile ${1+"$@"}; res=$? + fi +else + echo Cannot decompress $0; exit 1 +fi; exit $res +EOF + bzip2 -cv9 "$i" >> $tmp || { + /bin/rm -f $tmp + echo ${x}: compression not possible for $i, file unchanged. + res=1 + continue + } + + else + # decompression + skip=23 + if sed -e 1d -e 2q "$i" | grep "^skip=[0-9]*$" >/dev/null; then + eval `sed -e 1d -e 2q "$i"` + fi + if tail +$skip "$i" | bzip2 -cd > $tmp; then + : + else + echo ${x}: $i probably not in gzexe format, file unchanged. + res=1 + continue + fi + fi + rm -f "$i~" + mv "$i" "$i~" || { + echo ${x}: cannot backup $i as $i~ + rm -f $tmp + res=1 + continue + } + mv $tmp "$i" || cp -p $tmp "$i" 2>/dev/null || cp $tmp "$i" || { + echo ${x}: cannot create $i + rm -f $tmp + res=1 + continue + } + rm -f $tmp + if test -n "$cpmod"; then + $cpmod "$i~" "$i" 2>/dev/null + elif test $writable -eq 0; then + chmod u-w $i 2>/dev/null + fi +done +exit $res diff --git a/debian/bzexe.1 b/debian/bzexe.1 new file mode 100644 index 0000000..07a0489 --- /dev/null +++ b/debian/bzexe.1 @@ -0,0 +1,43 @@ +.TH BZEXE 1 +.SH NAME +bzexe \- compress executable files in place +.SH SYNOPSIS +.B bzexe +[ name ... ] +.SH DESCRIPTION +The +.I bzexe +utility allows you to compress executables in place and have them +automatically uncompress and execute when you run them (at a penalty +in performance). For example if you execute ``bzexe /bin/cat'' it +will create the following two files: +.nf +.br + -r-xr-xr-x 1 root bin 9644 Feb 11 11:16 /bin/cat + -r-xr-xr-x 1 bin bin 24576 Nov 23 13:21 /bin/cat~ +.fi +/bin/cat~ is the original file and /bin/cat is the self-uncompressing +executable file. You can remove /bin/cat~ once you are sure that +/bin/cat works properly. +.PP +This utility is most useful on systems with very small disks. +.SH OPTIONS +.TP +.B \-d +Decompress the given executables instead of compressing them. +.SH "SEE ALSO" +bzip2(1), znew(1), zmore(1), zcmp(1), zforce(1) +.SH CAVEATS +The compressed executable is a shell script. This may create some +security holes. In particular, the compressed executable relies +on the PATH environment variable to find +.I gzip +and some other utilities +.I (tail, chmod, ln, sleep). +.SH "BUGS" +.I bzexe +attempts to retain the original file attributes on the compressed executable, +but you may have to fix them manually in some cases, using +.I chmod +or +.I chown. diff --git a/debian/bzip2-doc.doc-base b/debian/bzip2-doc.doc-base new file mode 100644 index 0000000..ca93d4a --- /dev/null +++ b/debian/bzip2-doc.doc-base @@ -0,0 +1,23 @@ +Document: bzip2 +Title: bzip2 and libbzip2: a program and library for data compression +Author: Julian Seward +Abstract: bzip2 compresses files using the Burrows-Wheeler block-sorting + text compression algorithm, and Huffman coding. Compression is generally + considerably better than that achieved by more conventional + LZ77/LZ78-based compressors, and approaches the performance of the PPM + family of statistical compressors. +Section: File Management + +Format: HTML +Index: /usr/share/doc/bzip2/manual.html +Files: /usr/share/doc/bzip2/manual.html + +Format: PDF +Files: /usr/share/doc/bzip2/manual.pdf.gz + +Format: PostScript +Files: /usr/share/doc/bzip2/manual.ps.gz + +Format: Info +Index: /usr/share/doc/bzip2/manual.texi.gz +Files: /usr/share/doc/bzip2/manual.texi.gz diff --git a/debian/bzip2-doc.docs b/debian/bzip2-doc.docs new file mode 100644 index 0000000..aa8bec5 --- /dev/null +++ b/debian/bzip2-doc.docs @@ -0,0 +1,4 @@ +*.pdf +*.ps +*.html +*.texi diff --git a/debian/bzip2-doc.info b/debian/bzip2-doc.info new file mode 100644 index 0000000..99c33e8 --- /dev/null +++ b/debian/bzip2-doc.info @@ -0,0 +1 @@ +bzip2.info* diff --git a/debian/bzip2.install b/debian/bzip2.install new file mode 100644 index 0000000..4c5123a --- /dev/null +++ b/debian/bzip2.install @@ -0,0 +1,2 @@ +bin +debian/bzexe bin diff --git a/debian/bzip2.links b/debian/bzip2.links new file mode 100644 index 0000000..a0cc25a --- /dev/null +++ b/debian/bzip2.links @@ -0,0 +1,8 @@ +bin/bzdiff bin/bzcmp +bin/bzgrep bin/bzegrep +bin/bzgrep bin/bzfgrep +bin/bzmore bin/bzless + +usr/share/man/man1/bzip2.1.gz usr/share/man/man1/bunzip2.1.gz +usr/share/man/man1/bzip2.1.gz usr/share/man/man1/bzcat.1.gz +usr/share/man/man1/bzip2.1.gz usr/share/man/man1/bzip2recover.1.gz diff --git a/debian/bzip2.manpages b/debian/bzip2.manpages new file mode 100644 index 0000000..48c3867 --- /dev/null +++ b/debian/bzip2.manpages @@ -0,0 +1,2 @@ +man/man1/* +debian/bzexe.1 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..350efb2 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +bzip2 (1.0.8-ok1) yangtze; urgency=medium + + * Sync kylin-desktop + + -- Luo Yaoming Sun, 14 Aug 2022 13:53:59 +0800 diff --git a/debian/clean b/debian/clean new file mode 100644 index 0000000..51220d1 --- /dev/null +++ b/debian/clean @@ -0,0 +1,5 @@ +*.sho +libbz2.so* +bzip2.info* +manual.fmt +manual.texi diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..b4de394 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +11 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..c6edb6a --- /dev/null +++ b/debian/control @@ -0,0 +1,95 @@ +Source: bzip2 +Section: utils +Priority: important +Maintainer: Anibal Monsalve Salazar +Uploaders: Santiago Ruano Rincón , + Anthony Fok +Standards-Version: 4.2.0 +Build-Depends: dpkg-dev (>= 1.16.0), debhelper (>= 11) +Build-Depends-Indep: texinfo, docbook-xml, docbook2x, xsltproc +Homepage: https://sourceware.org/bzip2/ +Vcs-Git: https://salsa.debian.org/debian/bzip2.git +Vcs-Browser: https://salsa.debian.org/debian/bzip2 + +Package: libbz2-1.0 +Section: libs +Multi-Arch: same +Architecture: any +Depends: ${misc:Depends}, ${shlibs:Depends} +Pre-Depends: ${misc:Pre-Depends} +Description: high-quality block-sorting file compressor library - runtime + This package contains libbzip2 which is used by the bzip2 compressor. + . + bzip2 is a freely available, patent free, data compressor. + . + bzip2 compresses files using the Burrows-Wheeler block-sorting text + compression algorithm, and Huffman coding. Compression is generally + considerably better than that achieved by more conventional + LZ77/LZ78-based compressors, and approaches the performance of the PPM + family of statistical compressors. + . + The archive file format of bzip2 (.bz2) is incompatible with that of its + predecessor, bzip (.bz). + +Package: libbz2-dev +Priority: optional +Section: libdevel +Multi-Arch: same +Architecture: any +Depends: ${misc:Depends}, libbz2-1.0 (=${binary:Version}), libc6-dev | libc-dev +Replaces: bzip2 (<<0.9.5d-3) +Recommends: bzip2-doc +Description: high-quality block-sorting file compressor library - development + Static libraries and include files for the bzip2 compressor library. + . + bzip2 is a freely available, patent free, data compressor. + . + bzip2 compresses files using the Burrows-Wheeler block-sorting text + compression algorithm, and Huffman coding. Compression is generally + considerably better than that achieved by more conventional + LZ77/LZ78-based compressors, and approaches the performance of the PPM + family of statistical compressors. + . + The archive file format of bzip2 (.bz2) is incompatible with that of its + predecessor, bzip (.bz). + +Package: bzip2 +Priority: standard +Architecture: any +Multi-Arch: foreign +Depends: ${misc:Depends}, ${shlibs:Depends}, libbz2-1.0 (=${binary:Version}) +Suggests: bzip2-doc +Replaces: libbz2 (<<0.9.5d-3) +Description: high-quality block-sorting file compressor - utilities + bzip2 is a freely available, patent free, data compressor. + . + bzip2 compresses files using the Burrows-Wheeler block-sorting text + compression algorithm, and Huffman coding. Compression is generally + considerably better than that achieved by more conventional + LZ77/LZ78-based compressors, and approaches the performance of the PPM + family of statistical compressors. + . + The archive file format of bzip2 (.bz2) is incompatible with that of its + predecessor, bzip (.bz). + +Package: bzip2-doc +Priority: optional +Section: doc +Architecture: all +Multi-Arch: foreign +Depends: ${misc:Depends}, dpkg (>= 1.15.4) | install-info +Replaces: bzip2 (<< 1.0.4-0ubuntu2) +Description: high-quality block-sorting file compressor - documentation + This package contains the bzip2 user manual in HTML, PDF, PS and Texinfo + formats. + . + bzip2 is a freely available, patent free, data compressor. + . + bzip2 compresses files using the Burrows-Wheeler block-sorting text + compression algorithm, and Huffman coding. Compression is generally + considerably better than that achieved by more conventional + LZ77/LZ78-based compressors, and approaches the performance of the PPM + family of statistical compressors. + . + The archive file format of bzip2 (.bz2) is incompatible with that of its + predecessor, bzip (.bz). diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..6c5e0a9 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,48 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: bzip2 +Source: http://www.bzip.org/ + +Files: * +Copyright: 1996-2010 Julian R Seward +License: BSD-variant + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + 2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + . + 3. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + . + 4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Files: debian/* +Copyright: 2018 Nicolas Boulenguez + 2012-2015 Santiago Ruano Rincón + 2014 Canonical Ltd. + 2004-2011 Anibal Monsalve Salazar + 1999-2002 Philippe Troin + 1997-1999 Anthony Fok +License: GPL-2 + The full text of the GNU General Public License version 2 + can be found in /usr/share/common-licenses/GPL-2. diff --git a/debian/libbz2-1.0.shlibs b/debian/libbz2-1.0.shlibs new file mode 100644 index 0000000..888387b --- /dev/null +++ b/debian/libbz2-1.0.shlibs @@ -0,0 +1 @@ +libbz2 1.0 libbz2-1.0 diff --git a/debian/libbz2-dev.install b/debian/libbz2-dev.install new file mode 100644 index 0000000..99d321c --- /dev/null +++ b/debian/libbz2-dev.install @@ -0,0 +1 @@ +include /usr diff --git a/debian/not-installed b/debian/not-installed new file mode 100644 index 0000000..5a858ae --- /dev/null +++ b/debian/not-installed @@ -0,0 +1,2 @@ +# Replaced with a symbolick link conforming to policy in usr/lib. +lib/libbz2.so diff --git a/debian/patches/10-bzip2.1.patch b/debian/patches/10-bzip2.1.patch new file mode 100644 index 0000000..93d9dc9 --- /dev/null +++ b/debian/patches/10-bzip2.1.patch @@ -0,0 +1,373 @@ +Description: remove blank spaces in man page and drop the .PU macro. + The man page was once generated from manual.xml. + It would be nice to fix the generation process and build from source. +Author: Bjarni Ingi Gislason +Bug-Debian: https://bugs.debian.org/675380 + +Index: bzip2/bzip2.1 +=================================================================== +--- bzip2.orig/bzip2.1 ++++ bzip2/bzip2.1 +@@ -1,4 +1,3 @@ +-.PU + .TH bzip2 1 + .SH NAME + bzip2, bunzip2 \- a block-sorting file compressor, v1.0.8 +@@ -18,13 +17,13 @@ bzip2recover \- recovers data from damag + .br + .B bunzip2 + .RB [ " \-fkvsVL " ] +-[ ++[ + .I "filenames \&..." + ] + .br + .B bzcat + .RB [ " \-s " ] +-[ ++[ + .I "filenames \&..." + ] + .br +@@ -39,15 +38,15 @@ generally considerably better than that + LZ77/LZ78-based compressors, and approaches the performance of the PPM + family of statistical compressors. + +-The command-line options are deliberately very similar to +-those of +-.I GNU gzip, ++The command-line options are deliberately very similar to ++those of ++.I GNU gzip, + but they are not identical. + + .I bzip2 + expects a list of file names to accompany the + command-line flags. Each file is replaced by a compressed version of +-itself, with the name "original_name.bz2". ++itself, with the name "original_name.bz2". + Each compressed file + has the same modification date, permissions, and, when possible, + ownership as the corresponding original, so that these properties can +@@ -74,13 +73,13 @@ incomprehensible and therefore pointless + + .I bunzip2 + (or +-.I bzip2 \-d) ++.I bzip2 \-d) + decompresses all +-specified files. Files which were not created by ++specified files. Files which were not created by + .I bzip2 +-will be detected and ignored, and a warning issued. ++will be detected and ignored, and a warning issued. + .I bzip2 +-attempts to guess the filename for the decompressed file ++attempts to guess the filename for the decompressed file + from that of the compressed file as follows: + + filename.bz2 becomes filename +@@ -89,13 +88,13 @@ from that of the compressed file as foll + filename.tbz becomes filename.tar + anyothername becomes anyothername.out + +-If the file does not end in one of the recognised endings, +-.I .bz2, +-.I .bz, ++If the file does not end in one of the recognised endings, ++.I .bz2, ++.I .bz, + .I .tbz2 + or +-.I .tbz, +-.I bzip2 ++.I .tbz, ++.I bzip2 + complains that it cannot + guess the name of the original file, and uses the original name + with +@@ -103,25 +102,25 @@ with + appended. + + As with compression, supplying no +-filenames causes decompression from ++filenames causes decompression from + standard input to standard output. + +-.I bunzip2 ++.I bunzip2 + will correctly decompress a file which is the + concatenation of two or more compressed files. The result is the + concatenation of the corresponding uncompressed files. Integrity +-testing (\-t) +-of concatenated ++testing (\-t) ++of concatenated + compressed files is also supported. + + You can also compress or decompress files to the standard output by + giving the \-c flag. Multiple files may be compressed and + decompressed like this. The resulting outputs are fed sequentially to +-stdout. Compression of multiple files ++stdout. Compression of multiple files + in this manner generates a stream + containing multiple compressed file representations. Such a stream + can be decompressed correctly only by +-.I bzip2 ++.I bzip2 + version 0.9.0 or + later. Earlier versions of + .I bzip2 +@@ -130,7 +129,7 @@ the first file in the stream. + + .I bzcat + (or +-.I bzip2 -dc) ++.I bzip2 -dc) + decompresses all specified files to + the standard output. + +@@ -140,10 +139,10 @@ will read arguments from the environment + and + .I BZIP, + in that order, and will process them +-before any arguments read from the command line. This gives a ++before any arguments read from the command line. This gives a + convenient way to supply default arguments. + +-Compression is always performed, even if the compressed ++Compression is always performed, even if the compressed + file is slightly + larger than the original. Files of less than about one hundred bytes + tend to get larger, since the compression mechanism has a constant +@@ -151,9 +150,8 @@ overhead in the region of 50 bytes. Ran + of most file compressors) is coded at about 8.05 bits per byte, giving + an expansion of around 0.5%. + +-As a self-check for your protection, +-.I +-bzip2 ++As a self-check for your protection, ++.I bzip2 + uses 32-bit CRCs to + make sure that the decompressed version of a file is identical to the + original. This guards against corruption of the compressed data, and +@@ -163,9 +161,9 @@ against undetected bugs in + chances of data corruption going undetected is microscopic, about one + chance in four billion for each file processed. Be aware, though, that + the check occurs upon decompression, so it can only tell you that +-something is wrong. It can't help you ++something is wrong. It can't help you + recover the original uncompressed +-data. You can use ++data. You can use + .I bzip2recover + to try to recover data from + damaged files. +@@ -183,15 +181,15 @@ to panic. + Compress or decompress to standard output. + .TP + .B \-d --decompress +-Force decompression. +-.I bzip2, +-.I bunzip2 ++Force decompression. ++.I bzip2, ++.I bunzip2 + and +-.I bzcat ++.I bzcat + are + really the same program, and the decision about what actions to take is + done on the basis of which name is used. This flag overrides that +-mechanism, and forces ++mechanism, and forces + .I bzip2 + to decompress. + .TP +@@ -205,10 +203,10 @@ This really performs a trial decompressi + .TP + .B \-f --force + Force overwrite of output files. Normally, +-.I bzip2 ++.I bzip2 + will not overwrite +-existing output files. Also forces +-.I bzip2 ++existing output files. Also forces ++.I bzip2 + to break hard links + to files, which it otherwise wouldn't do. + +@@ -224,9 +222,9 @@ or decompression. + Reduce memory usage, for compression, decompression and testing. Files + are decompressed and tested using a modified algorithm which only + requires 2.5 bytes per block byte. This means any file can be +-decompressed in 2300k of memory, albeit at about half the normal speed. ++decompressed in 2300\ k of memory, albeit at about half the normal speed. + +-During compression, \-s selects a block size of 200k, which limits ++During compression, \-s selects a block size of 200\ k, which limits + memory use to around the same figure, at the expense of your compression + ratio. In short, if your machine is low on memory (8 megabytes or + less), use \-s for everything. See MEMORY MANAGEMENT below. +@@ -244,11 +242,11 @@ information which is primarily of intere + Display the software version, license terms and conditions. + .TP + .B \-1 (or \-\-fast) to \-9 (or \-\-best) +-Set the block size to 100 k, 200 k .. 900 k when compressing. Has no ++Set the block size to 100 k, 200 k ... 900 k when compressing. Has no + effect when decompressing. See MEMORY MANAGEMENT below. +-The \-\-fast and \-\-best aliases are primarily for GNU gzip ++The \-\-fast and \-\-best aliases are primarily for GNU gzip + compatibility. In particular, \-\-fast doesn't make things +-significantly faster. ++significantly faster. + And \-\-best merely selects the default behaviour. + .TP + .B \-- +@@ -263,7 +261,7 @@ earlier versions, which was sometimes us + improved algorithm which renders these flags irrelevant. + + .SH MEMORY MANAGEMENT +-.I bzip2 ++.I bzip2 + compresses large files in blocks. The block size affects + both the compression ratio achieved, and the amount of memory needed for + compression and decompression. The flags \-1 through \-9 +@@ -276,13 +274,13 @@ the file. Since block sizes are stored + that the flags \-1 to \-9 are irrelevant to and so ignored + during decompression. + +-Compression and decompression requirements, ++Compression and decompression requirements, + in bytes, can be estimated as: + +- Compression: 400k + ( 8 x block size ) ++ Compression: 400\ k + ( 8 x block size ) + +- Decompression: 100k + ( 4 x block size ), or +- 100k + ( 2.5 x block size ) ++ Decompression: 100\ k + ( 4 x block size ), or ++ 100\ k + ( 2.5 x block size ) + + Larger block sizes give rapidly diminishing marginal returns. Most of + the compression comes from the first two or three hundred k of block +@@ -292,10 +290,10 @@ on small machines. + It is also important to appreciate that the decompression memory + requirement is set at compression time by the choice of block size. + +-For files compressed with the default 900k block size, ++For files compressed with the default 900\ k block size, + .I bunzip2 + will require about 3700 kbytes to decompress. To support decompression +-of any file on a 4 megabyte machine, ++of any file on a 4 megabyte machine, + .I bunzip2 + has an option to + decompress using approximately half this amount of memory, about 2300 +@@ -311,9 +309,9 @@ Another significant point applies to fil + amount of real memory touched is proportional to the size of the file, + since the file is smaller than a block. For example, compressing a file + 20,000 bytes long with the flag -9 will cause the compressor to +-allocate around 7600k of memory, but only touch 400k + 20000 * 8 = 560 +-kbytes of it. Similarly, the decompressor will allocate 3700k but only +-touch 100k + 20000 * 4 = 180 kbytes. ++allocate around 7600\ k of memory, but only touch 400\ k + 20000 * 8 = 560 ++kbytes of it. Similarly, the decompressor will allocate 3700\ k but only ++touch 100\ k + 20000 * 4 = 180 kbytes. + + Here is a table which summarises the maximum memory usage for different + block sizes. Also recorded is the total compressed size for 14 files of +@@ -337,7 +335,7 @@ larger files, since the Corpus is domina + + .SH RECOVERING DATA FROM DAMAGED FILES + .I bzip2 +-compresses files in blocks, usually 900kbytes long. Each ++compresses files in blocks, usually 900\ kbytes long. Each + block is handled independently. If a media or transmission error causes + a multi-block .bz2 + file to become damaged, it may be possible to +@@ -350,36 +348,36 @@ damaged blocks can be distinguished from + + .I bzip2recover + is a simple program whose purpose is to search for +-blocks in .bz2 files, and write each block out into its own .bz2 ++blocks in .bz2 files, and write each block out into its own .bz2 + file. You can then use +-.I bzip2 ++.I bzip2 + \-t + to test the + integrity of the resulting files, and decompress those which are + undamaged. + + .I bzip2recover +-takes a single argument, the name of the damaged file, ++takes a single argument, the name of the damaged file, + and writes a number of files "rec00001file.bz2", +-"rec00002file.bz2", etc, containing the extracted blocks. +-The output filenames are designed so that the use of +-wildcards in subsequent processing -- for example, +-"bzip2 -dc rec*file.bz2 > recovered_data" -- processes the files in ++"rec00002file.bz2", etc., containing the extracted blocks. ++The output filenames are designed so that the use of ++wildcards in subsequent processing -- for example, ++"bzip2 -dc rec*file.bz2 > recovered_data" -- processes the files in + the correct order. + + .I bzip2recover + should be of most use dealing with large .bz2 +-files, as these will contain many blocks. It is clearly +-futile to use it on damaged single-block files, since a +-damaged block cannot be recovered. If you wish to minimise +-any potential data loss through media or transmission errors, ++files, as these will contain many blocks. It is clearly ++futile to use it on damaged single-block files, since a ++damaged block cannot be recovered. If you wish to minimise ++any potential data loss through media or transmission errors, + you might consider compressing with a smaller + block size. + + .SH PERFORMANCE NOTES + The sorting phase of compression gathers together similar strings in the + file. Because of this, files containing very long runs of repeated +-symbols, like "aabaabaabaab ..." (repeated several hundred times) may ++symbols, like "aabaabaabaab ...\&" (repeated several hundred times) may + compress more slowly than normal. Versions 0.9.5 and above fare much + better than previous versions in this respect. The ratio between + worst-case and average-case compression time is in the region of 10:1. +@@ -395,7 +393,7 @@ that performance, both for compressing a + determined by the speed at which your machine can service cache misses. + Because of this, small changes to the code to reduce the miss rate have + been observed to give disproportionately large performance improvements. +-I imagine ++I imagine + .I bzip2 + will perform best on machines with very large caches. + +@@ -406,7 +404,7 @@ tries hard to detect I/O errors and exit + what the problem is sometimes seem rather misleading. + + This manual page pertains to version 1.0.8 of +-.I bzip2. ++.I bzip2. + Compressed data created by this version is entirely forwards and + backwards compatible with the previous public releases, versions + 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1, 1.0.2 and above, but with the following +@@ -440,13 +438,13 @@ Fenwick (for the structured coding model + .I bzip, + and many refinements), and Alistair Moffat, Radford Neal and Ian Witten + (for the arithmetic coder in the original +-.I bzip). ++.I bzip). + I am much + indebted for their help, support and advice. See the manual in the + source distribution for pointers to sources of documentation. Christian + von Roques encouraged me to look for faster sorting algorithms, so as to + speed up compression. Bela Lubkin encouraged me to improve the +-worst-case compression performance. ++worst-case compression performance. + Donna Robinson XMLised the documentation. + The bz* scripts are derived from those of GNU gzip. + Many people sent patches, helped diff --git a/debian/patches/20-legacy.patch b/debian/patches/20-legacy.patch new file mode 100644 index 0000000..a972f97 --- /dev/null +++ b/debian/patches/20-legacy.patch @@ -0,0 +1,232 @@ +Description: various changes specific to Debian. + This patch gathers all changes before source format 3.0. + Most of its history is lost. + Some parts should probably be forwarded upstream. + +Index: bzip2/bzgrep +=================================================================== +--- bzip2.orig/bzgrep ++++ bzip2/bzgrep +@@ -1,27 +1,75 @@ + #!/bin/sh + +-# Bzgrep wrapped for bzip2, +-# adapted from zgrep by Philippe Troin for Debian GNU/Linux. +-## zgrep notice: +-## zgrep -- a wrapper around a grep program that decompresses files as needed +-## Adapted from a version sent by Charles Levert ++# bzgrep -- a wrapper around a grep program that decompresses files as needed ++# Adapted from zgrep of the Debian gzip package by Anibal Monsalve Salazar. ++# Adapted from a version sent by Charles Levert ++ ++# Copyright (C) 1998, 2001, 2002 Free Software Foundation ++# Copyright (C) 1993 Jean-loup Gailly ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2, or (at your option) ++# any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ++# 02111-1307, USA. + + PATH="/usr/bin:$PATH"; export PATH + +-prog=`echo $0 | sed 's|.*/||'` ++prog=`echo "$0" | sed 's|.*/||'` + case "$prog" in + *egrep) grep=${EGREP-egrep} ;; + *fgrep) grep=${FGREP-fgrep} ;; + *) grep=${GREP-grep} ;; + esac ++ + pat="" ++after_dash_dash="" ++files_with_matches=0 ++files_without_matches=0 ++no_filename=0 ++with_filename=0 ++ + while test $# -ne 0; do +- case "$1" in +- -e | -f) opt="$opt $1"; shift; pat="$1" ++ case "$after_dash_dash$1" in ++ --d* | --rec*) echo >&2 "$0: $1: option not supported"; exit 2;; ++ --files-with-*) files_with_matches=1;; ++ --files-witho*) files_without_matches=1;; ++ --no-f*) no_filename=1;; ++ --wi*) with_filename=1;; ++ --*) ;; ++ -*) ++ case "$1" in ++ -*[dr]*) echo >&2 "$0: $1: option not supported"; exit 2;; ++ esac ++ case "$1" in ++ -*H*) with_filename=1;; ++ esac ++ case "$1" in ++ -*h*) no_filename=1;; ++ esac ++ case "$1" in ++ -*L*) files_without_matches=1;; ++ esac ++ case "$1" in ++ -*l*) files_with_matches=1;; ++ esac;; ++ esac ++ case "$after_dash_dash$1" in ++ -[ef]) opt="$opt $1"; shift; pat="$1" + if test "$grep" = grep; then # grep is buggy with -e on SVR4 + grep=egrep + fi;; +- -A | -B) opt="$opt $1 $2"; shift;; ++ -[ABCdm])opt="$opt $1 $2"; shift;; ++ --) opt="$opt $1"; after_dash_dash=1;; + -*) opt="$opt $1";; + *) if test -z "$pat"; then + pat="$1" +@@ -35,19 +83,9 @@ done + if test -z "$pat"; then + echo "grep through bzip2 files" + echo "usage: $prog [grep_options] pattern [files]" +- exit 1 ++ exit 2 + fi + +-list=0 +-silent=0 +-op=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'` +-case "$op" in +- *l*) list=1 +-esac +-case "$op" in +- *h*) silent=1 +-esac +- + if test $# -eq 0; then + bzip2 -cdfq | $grep $opt "$pat" + exit $? +@@ -56,30 +94,40 @@ fi + res=0 + for i do + if test -f "$i"; then :; else if test -f "$i.bz2"; then i="$i.bz2"; fi; fi +- if test $list -eq 1; then +- bzip2 -cdfq "$i" | $grep $opt "$pat" 2>&1 > /dev/null && echo $i +- r=$? +- elif test $# -eq 1 -o $silent -eq 1; then +- bzip2 -cdfq "$i" | $grep $opt "$pat" +- r=$? +- else +- j=$(echo "$i" | sed 's/\\/&&/g;s/|/\\&/g;s/&/\\&/g') +- j=`printf "%s" "$j" | tr '\n' ' '` +- # A trick adapted from +- # https://groups.google.com/forum/#!original/comp.unix.shell/x1345iu10eg/Nn1n-1r1uU0J +- # that has the same effect as the following bash code: +- # bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|" +- # r=${PIPESTATUS[1]} +- exec 3>&1 +- eval ` ++ bzip2 -cdfq -- "$i" | ++ if test $files_with_matches -eq 1; then ++ $grep $opt "$pat" > /dev/null && printf "%s\n" "$i" ++ elif test $files_without_matches -eq 1; then ++ $grep $opt "$pat" > /dev/null || printf "%s\n" "$i" ++ elif test $with_filename -eq 0 && { test $# -eq 1 || test $no_filename -eq 1; }; then ++ $grep $opt "$pat" ++ else ++ i=$(echo "$i" | sed -e 's/[\\|&]/\\&/g') ++ if test $with_filename -eq 1; then ++ sed_script="s|^[^:]*:|${i}:|" ++ else ++ sed_script="s|^|${i}:|" ++ fi ++ # Hack adapted from GPLed code at ++ # https://groups.google.com/forum/#!original/comp.unix.shell/x1345iu10eg/Nn1n-1r1uU0J ++ # Has the same effect as the following two lines of bash: ++ # ++ # $grep $opt "$pat" | sed "$sed_script" ++ # exit ${PIPESTATUS[0]} ++ # ++ # Inside the `...`, fd4 goes to the pipe whose other end is read ++ # and passed to eval; fd1 is the normal standard output ++ # preserved the line before with exec 3>&1 ++ exec 3>&1 ++ eval ` + exec 4>&1 >&3 3>&- + { +- bzip2 -cdfq "$i" 4>&- +- } | { +- $grep $opt "$pat" 4>&-; echo "r=$?;" >&4 +- } | sed "s|^|${j}:|" +- ` +- fi +- test "$r" -ne 0 && res="$r" ++ $grep $opt "$pat" 4>&-; echo "r=$?;" >&4 ++ } | sed "$sed_script" ++ ` ++ exit $r ++ fi ++ r=$? ++ test $res -lt $r && res=$r + done + exit $res +Index: bzip2/bzmore +=================================================================== +--- bzip2.orig/bzmore ++++ bzip2/bzmore +@@ -24,10 +24,10 @@ else + # 'stty min 1' resets eof to ^a on both SunOS and SysV! + cb='min 1 -icanon'; ncb='icanon eof ^d' + fi +-if test $? -eq 0 -a -n "$oldtty"; then +- trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15 ++if test $? -eq 0 && test -n "$oldtty"; then ++ trap 'stty $oldtty 2>/dev/null; exit' 0 INT QUIT TRAP USR1 PIPE TERM + else +- trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15 ++ trap 'stty $ncb echo 2>/dev/null; exit' 0 INT QUIT TRAP USR1 PIPE TERM + fi + + if test $# = 0; then +@@ -46,7 +46,7 @@ else + ANS=`dd bs=1 count=1 2>/dev/null` + stty $ncb echo 2>/dev/null + echo " " +- if test "$ANS" = 'e' -o "$ANS" = 'q'; then ++ if test "$ANS" = 'e' || test "$ANS" = 'q'; then + exit + fi + fi +Index: bzip2/bzip2.c +=================================================================== +--- bzip2.orig/bzip2.c ++++ bzip2/bzip2.c +@@ -1890,7 +1890,9 @@ IntNative main ( IntNative argc, Char *a + case '8': blockSize100k = 8; break; + case '9': blockSize100k = 9; break; + case 'V': +- case 'L': license(); break; ++ case 'L': license(); ++ exit ( 0 ); ++ break; + case 'v': verbosity++; break; + case 'h': usage ( progName ); + exit ( 0 ); +@@ -1916,8 +1918,8 @@ IntNative main ( IntNative argc, Char *a + if (ISFLAG("--keep")) keepInputFiles = True; else + if (ISFLAG("--small")) smallMode = True; else + if (ISFLAG("--quiet")) noisy = False; else +- if (ISFLAG("--version")) license(); else +- if (ISFLAG("--license")) license(); else ++ if (ISFLAG("--version")) { license(); exit ( 0 ); } else ++ if (ISFLAG("--license")) { license(); exit ( 0 ); } else + if (ISFLAG("--exponential")) workFactor = 1; else + if (ISFLAG("--repetitive-best")) redundant(aa->name); else + if (ISFLAG("--repetitive-fast")) redundant(aa->name); else diff --git a/debian/patches/40-bzdiff-l.patch b/debian/patches/40-bzdiff-l.patch new file mode 100644 index 0000000..8ef5133 --- /dev/null +++ b/debian/patches/40-bzdiff-l.patch @@ -0,0 +1,29 @@ +Description: bzdiff: properly pass -I (ignore regex) option to diff + This patch is far from sufficient. See the bug log for details. +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/bzip2/+bug/735675 +Origin: ubuntu, https://bugs.launchpad.net/ubuntu/+source/bzip2/+bug/735675 + +--- a/bzdiff ++++ b/bzdiff +@@ -24,7 +24,11 @@ + for ARG + do + case "$ARG" in +- -*) OPTIONS="$OPTIONS $ARG";; ++ -*) if test -z "$OPTIONS"; then ++ OPTIONS="$ARG" ++ else ++ OPTIONS="$OPTIONS $ARG" ++ fi ;; + *) if test -f "$ARG"; then + FILES="$FILES $ARG" + else +@@ -54,7 +58,7 @@ + exit 1 + } + bzip2 -cdfq "$2" > "$tmp" +- bzip2 -cdfq "$1" | $comp $OPTIONS - "$tmp" ++ bzip2 -cdfq "$1" | $comp "$OPTIONS" - "$tmp" + STAT="$?" + /bin/rm -f "$tmp";; + diff --git a/debian/patches/bzip2recover-race-open-output.diff b/debian/patches/bzip2recover-race-open-output.diff new file mode 100644 index 0000000..c65c656 --- /dev/null +++ b/debian/patches/bzip2recover-race-open-output.diff @@ -0,0 +1,46 @@ +Description: fix unsafe race condition in opening output files. +Author: Colin Phipps +Bug-Debian: https://bugs.debian.org/56386 + +Index: bzip2/bzip2recover.c +=================================================================== +--- bzip2.orig/bzip2recover.c ++++ bzip2/bzip2recover.c +@@ -24,6 +24,8 @@ + #include + #include + #include ++#include ++#include + + + /* This program records bit locations in the file to be recovered. +@@ -269,6 +271,19 @@ static Bool endsInBz2 ( Char* name ) + name[n-1] == '2'); + } + ++/*---------------------------------------------*/ ++/* Open an output file safely with O_EXCL and good permissions */ ++FILE* fopen_output( Char* name, const char* mode ) ++{ ++ FILE *fp; ++ int fh; ++ ++ fh = open(name, O_WRONLY|O_CREAT|O_EXCL, 0600); ++ if (fh == -1) return NULL; ++ fp = fdopen(fh, mode); ++ if (fp == NULL) close(fh); ++ return fp; ++} + + /*---------------------------------------------------*/ + /*--- ---*/ +@@ -488,7 +503,7 @@ Int32 main ( Int32 argc, Char** argv ) + fprintf ( stderr, " writing block %d to `%s' ...\n", + wrBlock+1, outFileName ); + +- outFile = fopen ( outFileName, "wb" ); ++ outFile = fopen_output ( outFileName, "wb" ); + if (outFile == NULL) { + fprintf ( stderr, "%s: can't write `%s'\n", + progName, outFileName ); diff --git a/debian/patches/help-option.diff b/debian/patches/help-option.diff new file mode 100644 index 0000000..cad313d --- /dev/null +++ b/debian/patches/help-option.diff @@ -0,0 +1,79 @@ +Description: mention the --help command line option in the documentation +Bug-Debian: https://bugs.debian.org/517257 + +--- a/manual.xml ++++ b/manual.xml +@@ -160,12 +160,21 @@ + bzip2 [ + -cdfkqstvzVL123456789 ] [ filenames ... ] + ++ bzip2 [ ++ -h | --help ] ++ + bunzip2 [ + -fkvsVL ] [ filenames ... ] + ++ bunzip2 [ ++ -h | --help ] ++ + bzcat [ -s ] [ + filenames ... ] + ++ bzcat [ ++ -h | --help ] ++ + bzip2recover + filename + +@@ -397,6 +406,10 @@ + will not be suppressed. + + ++ -h --help ++ Print a help message and exit. ++ ++ + + -v --verbose + Verbose mode -- show the compression ratio for +--- a/bzip2.1 ++++ b/bzip2.1 +@@ -13,6 +13,9 @@ + [ + .I "filenames \&..." + ] ++.br ++.B bzip2 ++.RB [ " \-h|\-\-help " ] + .ll -8 + .br + .B bunzip2 +@@ -21,12 +24,18 @@ + .I "filenames \&..." + ] + .br ++.B bunzip2 ++.RB [ " \-h|\-\-help " ] ++.br + .B bzcat + .RB [ " \-s " ] + [ + .I "filenames \&..." + ] + .br ++.B bzcat ++.RB [ " \-h|\-\-help " ] ++.br + .B bzip2recover + .I "filename" + +@@ -238,6 +247,9 @@ + Further \-v's increase the verbosity level, spewing out lots of + information which is primarily of interest for diagnostic purposes. + .TP ++.B \-h \-\-help ++Print a help message and exit. ++.TP + .B \-L --license -V --version + Display the software version, license terms and conditions. + .TP diff --git a/debian/patches/makefile.diff b/debian/patches/makefile.diff new file mode 100644 index 0000000..ba16cd3 --- /dev/null +++ b/debian/patches/makefile.diff @@ -0,0 +1,133 @@ +Description: handle build flags and build a shared library. + These are two distinct problems, but a single patch avoid + merging changes. + . + The part handling CFLAGS should be forwarded. + +--- a/Makefile ++++ b/Makefile +@@ -12,6 +12,8 @@ + # in the file LICENSE. + # ------------------------------------------------------------------ + ++somajor=1.0 ++sominor=$(somajor).4 + SHELL=/bin/sh + + # To assist in cross-compiling +@@ -37,29 +39,50 @@ + + all: libbz2.a bzip2 bzip2recover test + +-bzip2: libbz2.a bzip2.o +- $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2 ++bzip2: libbz2.so bzip2.o ++ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2 + + bzip2recover: bzip2recover.o +- $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2recover bzip2recover.o ++ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o bzip2recover bzip2recover.o + + libbz2.a: $(OBJS) + rm -f libbz2.a + $(AR) cq libbz2.a $(OBJS) +- @if ( test -f $(RANLIB) -o -f /usr/bin/ranlib -o \ +- -f /bin/ranlib -o -f /usr/ccs/bin/ranlib ) ; then \ ++ @if ( test -f $(RANLIB) || test -f /usr/bin/ranlib || \ ++ test -f /bin/ranlib || test -f /usr/ccs/bin/ranlib ) ; then \ + echo $(RANLIB) libbz2.a ; \ + $(RANLIB) libbz2.a ; \ + fi + ++libbz2.so: libbz2.so.$(somajor) ++ ln -sf $^ $@ ++ ++libbz2.so.$(somajor): libbz2.so.$(sominor) ++ ln -sf $^ $@ ++ ++libbz2.so.$(sominor): $(OBJS:%.o=%.sho) ++ $(CC) -o libbz2.so.$(sominor) -shared $(LDFLAGS) \ ++ -Wl,-soname,libbz2.so.$(somajor) $^ -lc ++ ++$(OBJS:%.o=%.sho) bzip2.sho bzip2recover.sho: %.sho: %.c ++ $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -o $@ -c $< ++$(OBJS) bzip2.o bzip2recover.o: %.o: %.c ++ $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< ++ + check: test + test: bzip2 + @cat words1 ++ LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH \ + ./bzip2 -1 < sample1.ref > sample1.rb2 ++ LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH \ + ./bzip2 -2 < sample2.ref > sample2.rb2 ++ LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH \ + ./bzip2 -3 < sample3.ref > sample3.rb2 ++ LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH \ + ./bzip2 -d < sample1.bz2 > sample1.tst ++ LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH \ + ./bzip2 -d < sample2.bz2 > sample2.tst ++ LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH \ + ./bzip2 -ds < sample3.bz2 > sample3.tst + cmp sample1.bz2 sample1.rb2 + cmp sample2.bz2 sample2.rb2 +@@ -69,15 +92,15 @@ + cmp sample3.tst sample3.ref + @cat words3 + +-install: bzip2 bzip2recover ++install: bzip2 bzip2recover libbz2.a + if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi + if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi + if ( test ! -d $(PREFIX)/man ) ; then mkdir -p $(PREFIX)/man ; fi + if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir -p $(PREFIX)/man/man1 ; fi + if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi + cp -f bzip2 $(PREFIX)/bin/bzip2 +- cp -f bzip2 $(PREFIX)/bin/bunzip2 +- cp -f bzip2 $(PREFIX)/bin/bzcat ++ ln $(PREFIX)/bin/bzip2 $(PREFIX)/bin/bunzip2 ++ ln $(PREFIX)/bin/bzip2 $(PREFIX)/bin/bzcat + cp -f bzip2recover $(PREFIX)/bin/bzip2recover + chmod a+x $(PREFIX)/bin/bzip2 + chmod a+x $(PREFIX)/bin/bunzip2 +@@ -87,7 +110,7 @@ + chmod a+r $(PREFIX)/man/man1/bzip2.1 + cp -f bzlib.h $(PREFIX)/include + chmod a+r $(PREFIX)/include/bzlib.h +- cp -f libbz2.a $(PREFIX)/lib ++ cp -fa libbz2.a libbz2.so* $(PREFIX)/lib + chmod a+r $(PREFIX)/lib/libbz2.a + cp -f bzgrep $(PREFIX)/bin/bzgrep + ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep +@@ -109,30 +132,10 @@ + echo ".so man1/bzdiff.1" > $(PREFIX)/man/man1/bzcmp.1 + + clean: +- rm -f *.o libbz2.a bzip2 bzip2recover \ ++ rm -f *.o *.sho libbz2.a libbz2.so* bzip2 bzip2recover \ + sample1.rb2 sample2.rb2 sample3.rb2 \ + sample1.tst sample2.tst sample3.tst + +-blocksort.o: blocksort.c +- @cat words0 +- $(CC) $(CFLAGS) -c blocksort.c +-huffman.o: huffman.c +- $(CC) $(CFLAGS) -c huffman.c +-crctable.o: crctable.c +- $(CC) $(CFLAGS) -c crctable.c +-randtable.o: randtable.c +- $(CC) $(CFLAGS) -c randtable.c +-compress.o: compress.c +- $(CC) $(CFLAGS) -c compress.c +-decompress.o: decompress.c +- $(CC) $(CFLAGS) -c decompress.c +-bzlib.o: bzlib.c +- $(CC) $(CFLAGS) -c bzlib.c +-bzip2.o: bzip2.c +- $(CC) $(CFLAGS) -c bzip2.c +-bzip2recover.o: bzip2recover.c +- $(CC) $(CFLAGS) -c bzip2recover.c +- + + distclean: clean + rm -f manual.ps manual.html manual.pdf diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..4f71d19 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,7 @@ +10-bzip2.1.patch +20-legacy.patch +xml-manual-escape.diff +help-option.diff +makefile.diff +bzip2recover-race-open-output.diff +40-bzdiff-l.patch diff --git a/debian/patches/xml-manual-escape.diff b/debian/patches/xml-manual-escape.diff new file mode 100644 index 0000000..cf0b293 --- /dev/null +++ b/debian/patches/xml-manual-escape.diff @@ -0,0 +1,157 @@ +Description: escape special characters in XML source of the manual. + +--- a/manual.xml ++++ b/manual.xml +@@ -1162,9 +1162,9 @@ + if the library has been mis-compiled + BZ_PARAM_ERROR + if strm is NULL +- or blockSize < 1 or blockSize > 9 +- or verbosity < 0 or verbosity > 4 +- or workFactor < 0 or workFactor > 250 ++ or blockSize < 1 or blockSize > 9 ++ or verbosity < 0 or verbosity > 4 ++ or workFactor < 0 or workFactor > 250 + BZ_MEM_ERROR + if not enough memory is available + BZ_OK +@@ -1474,8 +1474,8 @@ + BZ_CONFIG_ERROR + if the library has been mis-compiled + BZ_PARAM_ERROR +- if ( small != 0 && small != 1 ) +- or (verbosity <; 0 || verbosity > 4) ++ if ( small != 0 && small != 1 ) ++ or (verbosity < 0 || verbosity > 4) + BZ_MEM_ERROR + if insufficient memory is available + +@@ -1560,7 +1560,7 @@ + + BZ_PARAM_ERROR + if strm is NULL or strm->s is NULL +- or strm->avail_out < 1 ++ or strm->avail_out < 1 + BZ_DATA_ERROR + if a data integrity error is detected in the compressed stream + BZ_DATA_ERROR_MAGIC +@@ -1733,8 +1733,8 @@ + BZ_PARAM_ERROR + if f is NULL + or small is neither 0 nor 1 +- or ( unused == NULL && nUnused != 0 ) +- or ( unused != NULL && !(0 <= nUnused <= BZ_MAX_UNUSED) ) ++ or ( unused == NULL && nUnused != 0 ) ++ or ( unused != NULL && !(0 <= nUnused <= BZ_MAX_UNUSED) ) + BZ_IO_ERROR + if ferror(f) is nonzero + BZ_MEM_ERROR +@@ -1813,7 +1813,7 @@ + + + BZ_PARAM_ERROR +- if b is NULL or buf is NULL or len < 0 ++ if b is NULL or buf is NULL or len < 0 + BZ_SEQUENCE_ERROR + if b was opened with BZ2_bzWriteOpen + BZ_IO_ERROR +@@ -1971,7 +1971,7 @@ + if the library has been mis-compiled + BZ_PARAM_ERROR + if f is NULL +- or blockSize100k < 1 or blockSize100k > 9 ++ or blockSize100k < 1 or blockSize100k > 9 + BZ_IO_ERROR + if ferror(f) is nonzero + BZ_MEM_ERROR +@@ -2018,7 +2018,7 @@ + + + BZ_PARAM_ERROR +- if b is NULL or buf is NULL or len < 0 ++ if b is NULL or buf is NULL or len < 0 + BZ_SEQUENCE_ERROR + if b was opened with BZ2_bzReadOpen + BZ_IO_ERROR +@@ -2169,7 +2169,7 @@ + if ( !f ) { + /* handle error */ + } +-b = BZ2_bzWriteOpen( &bzerror, f, 9 ); ++b = BZ2_bzWriteOpen( &bzerror, f, 9 ); + if (bzerror != BZ_OK) { + BZ2_bzWriteClose ( b ); + /* handle error */ +@@ -2177,14 +2177,14 @@ + + while ( /* condition */ ) { + /* get data to write into buf, and set nBuf appropriately */ +- nWritten = BZ2_bzWrite ( &bzerror, b, buf, nBuf ); ++ nWritten = BZ2_bzWrite ( &bzerror, b, buf, nBuf ); + if (bzerror == BZ_IO_ERROR) { +- BZ2_bzWriteClose ( &bzerror, b ); ++ BZ2_bzWriteClose ( &bzerror, b ); + /* handle error */ + } + } + +-BZ2_bzWriteClose( &bzerror, b ); ++BZ2_bzWriteClose( &bzerror, b ); + if (bzerror == BZ_IO_ERROR) { + /* handle error */ + } +@@ -2204,24 +2204,24 @@ + if ( !f ) { + /* handle error */ + } +-b = BZ2_bzReadOpen ( &bzerror, f, 0, NULL, 0 ); ++b = BZ2_bzReadOpen ( &bzerror, f, 0, NULL, 0 ); + if ( bzerror != BZ_OK ) { +- BZ2_bzReadClose ( &bzerror, b ); ++ BZ2_bzReadClose ( &bzerror, b ); + /* handle error */ + } + + bzerror = BZ_OK; +-while ( bzerror == BZ_OK && /* arbitrary other conditions */) { +- nBuf = BZ2_bzRead ( &bzerror, b, buf, /* size of buf */ ); ++while ( bzerror == BZ_OK && /* arbitrary other conditions */) { ++ nBuf = BZ2_bzRead ( &bzerror, b, buf, /* size of buf */ ); + if ( bzerror == BZ_OK ) { + /* do something with buf[0 .. nBuf-1] */ + } + } + if ( bzerror != BZ_STREAM_END ) { +- BZ2_bzReadClose ( &bzerror, b ); ++ BZ2_bzReadClose ( &bzerror, b ); + /* handle error */ + } else { +- BZ2_bzReadClose ( &bzerror, b ); ++ BZ2_bzReadClose ( &bzerror, b ); + } + + +@@ -2287,9 +2287,9 @@ + if the library has been mis-compiled + BZ_PARAM_ERROR + if dest is NULL or destLen is NULL +- or blockSize100k < 1 or blockSize100k > 9 +- or verbosity < 0 or verbosity > 4 +- or workFactor < 0 or workFactor > 250 ++ or blockSize100k < 1 or blockSize100k > 9 ++ or verbosity < 0 or verbosity > 4 ++ or workFactor < 0 or workFactor > 250 + BZ_MEM_ERROR + if insufficient memory is available + BZ_OUTBUFF_FULL +@@ -2355,8 +2355,8 @@ + if the library has been mis-compiled + BZ_PARAM_ERROR + if dest is NULL or destLen is NULL +- or small != 0 && small != 1 +- or verbosity < 0 or verbosity > 4 ++ or small != 0 && small != 1 ++ or verbosity < 0 or verbosity > 4 + BZ_MEM_ERROR + if insufficient memory is available + BZ_OUTBUFF_FULL diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..49c08ee --- /dev/null +++ b/debian/rules @@ -0,0 +1,94 @@ +#!/usr/bin/make -f +# debian/rules file for building the Debian GNU/Linux package bzip2. +# Copyright (C) 1999, 2000, 2001, 2002 Philippe Troin +# Copyright (C) 2004-2007 Anibal Monsalve Salazar +# Copyright 2014 Canonical Ltd. + +include /usr/share/dpkg/architecture.mk +ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) + CC=$(DEB_HOST_GNU_TYPE)-gcc +else + CC=gcc +endif + +DEB_BUILD_MAINT_OPTIONS := hardening=+all +DEB_CFLAGS_MAINT_APPEND := -Wall -Winline +DEB_CPPFLAGS_MAINT_APPEND := -D_REENTRANT +include /usr/share/dpkg/buildflags.mk + +include /usr/share/dpkg/pkg-info.mk + +lib_pkg := libbz2-1.0 +dev_pkg := libbz2-dev + +%: + dh $@ + +.PHONY: override_dh_auto_build-arch +override_dh_auto_build-arch: + dh_auto_build -- libbz2.a bzip2 bzip2recover \ + $(foreach v,CC CFLAGS CPPFLAGS LDFLAGS,'$(v)=$($(v))') + +.PHONY: override_dh_auto_build-indep +ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))) + override_dh_auto_build-indep: bzip2.info +endif + +bzip2.info: manual.texi + makeinfo -o bzip2.info manual.texi + +.PHONY: override_dh_auto_test-arch +ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) + override_dh_auto_test-arch: + dh_auto_test -- \ + $(foreach v,CC CFLAGS CPPFLAGS LDFLAGS,'$(v)=$($(v))') +endif + +# Documentation is not tested. +.PHONY: override_dh_auto_test-indep + +# requires: docbook-xml docbook2x +manual.texi: manual.xml + docbook2x-texi \ + --string-param directory-category=Development \ + --string-param directory-description='A program and library for data compression' \ + --string-param output-file=manual \ + --to-stdout $< > $@ + +.PHONY: override_dh_auto_clean +override_dh_auto_clean: + # dh_auto_clean calls `make distclean' which removes manual.{html,ps,pdf}, + # so we'd need to rebuild them. Call `make clean' instead. + [ -f Makefile ] && $(MAKE) clean + +.PHONY: override_dh_auto_install-arch +override_dh_auto_install-arch: + dh_auto_install -- PREFIX=$(CURDIR)/debian/tmp + +# Documentation is installed directly, not in debian/tmp. +.PHONY: override_dh_auto_install-indep + +.PHONY: override_dh_link +override_dh_link: + # This isn't the soname, and nothing should be looking for this file, + # but leave it alone for now + dh_link -p$(lib_pkg) lib/$(DEB_HOST_MULTIARCH)/libbz2.so.1.0.4 \ + lib/$(DEB_HOST_MULTIARCH)/libbz2.so.1 + dh_link -p$(dev_pkg) lib/$(DEB_HOST_MULTIARCH)/libbz2.so.1.0 \ + usr/lib/$(DEB_HOST_MULTIARCH)/libbz2.so + dh_link --remaining-packages + +override_dh_install: + dh_install -p$(lib_pkg) lib/libbz2.so.* lib/$(DEB_HOST_MULTIARCH) + dh_install -p$(dev_pkg) lib/libbz2.a usr/lib/$(DEB_HOST_MULTIARCH) + dh_install --remaining-packages + +# --fail-missing becomes the default with debhelper 12. +.PHONY: override_dh_missing +override_dh_missing: + dh_missing --fail-missing + +.PHONY: override_dh_installdocs +override_dh_installdocs: + dh_installdocs -plibbz2-dev --link-doc=libbz2-1.0 + dh_installdocs --remaining-packages diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml new file mode 100644 index 0000000..0c22dc4 --- /dev/null +++ b/debian/salsa-ci.yml @@ -0,0 +1,3 @@ +include: + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source/options b/debian/source/options new file mode 100644 index 0000000..779dbfd --- /dev/null +++ b/debian/source/options @@ -0,0 +1,2 @@ +compression = "bzip2" +compression-level = 9 diff --git a/debian/tests/compress b/debian/tests/compress new file mode 100644 index 0000000..b2a7b97 --- /dev/null +++ b/debian/tests/compress @@ -0,0 +1,6 @@ +#!/bin/sh +set -C -e -f -u +cd "$AUTOPKGTEST_TMP" +echo Hello > hello +bzip2 -c hello > hello.bz2 +bzip2 -cd hello.bz2 | diff hello - diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..9930a0e --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,2 @@ +Tests: compress grep link-with-shared +Depends: @, @builddeps@ diff --git a/debian/tests/grep b/debian/tests/grep new file mode 100644 index 0000000..9f07b60 --- /dev/null +++ b/debian/tests/grep @@ -0,0 +1,6 @@ +#!/bin/sh +set -C -e -f -u +cd "$AUTOPKGTEST_TMP" +echo Hello > hello +bzip2 -c hello > hello.bz2 +bzgrep ell hello.bz2 diff --git a/debian/tests/link-with-shared b/debian/tests/link-with-shared new file mode 100644 index 0000000..3a7e28a --- /dev/null +++ b/debian/tests/link-with-shared @@ -0,0 +1,18 @@ +#!/bin/sh +set -C -e -f -u +cd "$AUTOPKGTEST_TMP" +cat > hello.c < +#include +int main () { + char dst [500]; + char src [10]; + unsigned int dstLen = sizeof (dst); + if (BZ2_bzBuffToBuffCompress (dst, &dstLen, src, sizeof (src), 1, 0, 0) == BZ_OK) + exit (EXIT_SUCCESS); + else + exit (EXIT_FAILURE); +} +EOF +cc hello.c -lbz2 -o hello +./hello diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..9fe7363 --- /dev/null +++ b/debian/watch @@ -0,0 +1,8 @@ +version=4 + +opts=\ + uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha|b|a)[\-\.]?\d*)$/$1~$2/,\ + dversionmangle=s/\+(debian|dfsg|ds|deb)\d*$// \ + \ + https://sourceware.org/pub/bzip2/ \ + (?:.*/)?@PACKAGE@@ANY_VERSION@@ARCHIVE_EXT@