Skip to content

Commit

Permalink
fixes to build portable on a clean VM
Browse files Browse the repository at this point in the history
  • Loading branch information
glenda committed Sep 14, 2024
1 parent dce8d09 commit 257d76d
Show file tree
Hide file tree
Showing 78 changed files with 40,492 additions and 4,453 deletions.
411 changes: 138 additions & 273 deletions sys/include/ape/bzlib.h

Large diffs are not rendered by default.

32 changes: 12 additions & 20 deletions sys/src/ape/lib/bz2/mkfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,23 @@ APE=$APEXPROOT/sys/src/ape

LIB=$APEXPROOT/$objtype/lib/ape/libbz2.a

OFILES=\
blocksort.$O\
bzassert.$O\
bzcompress.$O\
bzdecompress.$O\
bzfeof.$O\
bzlib.$O\
bzread.$O\
bzversion.$O\
bzwrite.$O\
bzzlib.$O\
compress.$O\
crctable.$O\
decompress.$O\
huffman.$O\
randtable.$O\
OFILES=blocksort.$O\
huffman.$O\
crctable.$O\
randtable.$O\
compress.$O\
decompress.$O\
bzlib.$O

HFILES=\
/sys/include/ape/bzlib.h\
$APEXPROOT/sys/include/ape/bzlib.h\

<$APEXPROOT/sys/src/cmd/mksyslib

BZSOURCE=../../../external/bzip2

CFLAGS=-FV -p -I$BZSOURCE/lib -DPLAN9
CC=pcc
CFLAGS=-c -I$BZSOURCE -D_POSIX_SOURCE

%.$O: $BZSOURCE/lib/%.c
$CC $CFLAGS $BZSOURCE/lib/$stem.c
%.$O: $BZSOURCE/%.c
$CC $CFLAGS $BZSOURCE/$stem.c
191 changes: 190 additions & 1 deletion sys/src/external/bzip2/CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
------------------------------------------------------------------
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.

bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <[email protected]>

Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.

This program is released under the terms of the license contained
in the file LICENSE.
------------------------------------------------------------------


0.9.0
Expand Down Expand Up @@ -134,7 +147,7 @@ Several minor bugfixes and enhancements:

* Advance the version number to 1.0, so as to counteract the
(false-in-this-case) impression some people have that programs
with version numbers less than 1.0 are in someway, experimental,
with version numbers less than 1.0 are in some way, experimental,
pre-release versions.

* Create an initial Makefile-libbz2_so to build a shared library.
Expand Down Expand Up @@ -165,3 +178,179 @@ There are no functionality changes or bug fixes relative to version
1.0.0. This is just a documentation update + a fix for minor Win32
build problems. For almost everyone, upgrading from 1.0.0 to 1.0.1 is
utterly pointless. Don't bother.


1.0.2
~~~~~
A bug fix release, addressing various minor issues which have appeared
in the 18 or so months since 1.0.1 was released. Most of the fixes
are to do with file-handling or documentation bugs. To the best of my
knowledge, there have been no data-loss-causing bugs reported in the
compression/decompression engine of 1.0.0 or 1.0.1.

Note that this release does not improve the rather crude build system
for Unix platforms. The general plan here is to autoconfiscate/
libtoolise 1.0.2 soon after release, and release the result as 1.1.0
or perhaps 1.2.0. That, however, is still just a plan at this point.

Here are the changes in 1.0.2. Bug-reporters and/or patch-senders in
parentheses.

* Fix an infinite segfault loop in 1.0.1 when a directory is
encountered in -f (force) mode.
(Trond Eivind Glomsrod, Nicholas Nethercote, Volker Schmidt)

* Avoid double fclose() of output file on certain I/O error paths.
(Solar Designer)

* Don't fail with internal error 1007 when fed a long stream (> 48MB)
of byte 251. Also print useful message suggesting that 1007s may be
caused by bad memory.
(noticed by Juan Pedro Vallejo, fixed by me)

* Fix uninitialised variable silly bug in demo prog dlltest.c.
(Jorj Bauer)

* Remove 512-MB limitation on recovered file size for bzip2recover
on selected platforms which support 64-bit ints. At the moment
all GCC supported platforms, and Win32.
(me, Alson van der Meulen)

* Hard-code header byte values, to give correct operation on platforms
using EBCDIC as their native character set (IBM's OS/390).
(Leland Lucius)

* Copy file access times correctly.
(Marty Leisner)

* Add distclean and check targets to Makefile.
(Michael Carmack)

* Parameterise use of ar and ranlib in Makefile. Also add $(LDFLAGS).
(Rich Ireland, Bo Thorsen)

* Pass -p (create parent dirs as needed) to mkdir during make install.
(Jeremy Fusco)

* Dereference symlinks when copying file permissions in -f mode.
(Volker Schmidt)

* Majorly simplify implementation of uInt64_qrm10.
(Bo Lindbergh)

* Check the input file still exists before deleting the output one,
when aborting in cleanUpAndFail().
(Joerg Prante, Robert Linden, Matthias Krings)

Also a bunch of patches courtesy of Philippe Troin, the Debian maintainer
of bzip2:

* Wrapper scripts (with manpages): bzdiff, bzgrep, bzmore.

* Spelling changes and minor enhancements in bzip2.1.

* Avoid race condition between creating the output file and setting its
interim permissions safely, by using fopen_output_safely().
No changes to bzip2recover since there is no issue with file
permissions there.

* do not print senseless report with -v when compressing an empty
file.

* bzcat -f works on non-bzip2 files.

* do not try to escape shell meta-characters on unix (the shell takes
care of these).

* added --fast and --best aliases for -1 -9 for gzip compatibility.


1.0.3 (15 Feb 05)
~~~~~~~~~~~~~~~~~
Fixes some minor bugs since the last version, 1.0.2.

* Further robustification against corrupted compressed data.
There are currently no known bitstreams which can cause the
decompressor to crash, loop or access memory which does not
belong to it. If you are using bzip2 or the library to
decompress bitstreams from untrusted sources, an upgrade
to 1.0.3 is recommended. This fixes CAN-2005-1260.

* The documentation has been converted to XML, from which html
and pdf can be derived.

* Various minor bugs in the documentation have been fixed.

* Fixes for various compilation warnings with newer versions of
gcc, and on 64-bit platforms.

* The BZ_NO_STDIO cpp symbol was not properly observed in 1.0.2.
This has been fixed.


1.0.4 (20 Dec 06)
~~~~~~~~~~~~~~~~~
Fixes some minor bugs since the last version, 1.0.3.

* Fix file permissions race problem (CAN-2005-0953).

* Avoid possible segfault in BZ2_bzclose. From Coverity's NetBSD
scan.

* 'const'/prototype cleanups in the C code.

* Change default install location to /usr/local, and handle multiple
'make install's without error.

* Sanitise file names more carefully in bzgrep. Fixes CAN-2005-0758
to the extent that applies to bzgrep.

* Use 'mktemp' rather than 'tempfile' in bzdiff.

* Tighten up a couple of assertions in blocksort.c following automated
analysis.

* Fix minor doc/comment bugs.


1.0.5 (10 Dec 07)
~~~~~~~~~~~~~~~~~
Security fix only. Fixes CERT-FI 20469 as it applies to bzip2.


1.0.6 (6 Sept 10)
~~~~~~~~~~~~~~~~~

* Security fix for CVE-2010-0405. This was reported by Mikolaj
Izdebski.

* Make the documentation build on Ubuntu 10.04

1.0.7 (27 Jun 19)
~~~~~~~~~~~~~~~~~

* Fix undefined behavior in the macros SET_BH, CLEAR_BH, & ISSET_BH

* bzip2: Fix return value when combining --test,-t and -q.

* bzip2recover: Fix buffer overflow for large argv[0]

* bzip2recover: Fix use after free issue with outFile (CVE-2016-3189)

* Make sure nSelectors is not out of range (CVE-2019-12900)

1.0.8 (13 Jul 19)
~~~~~~~~~~~~~~~~~

* Accept as many selectors as the file format allows.
This relaxes the fix for CVE-2019-12900 from 1.0.7
so that bzip2 allows decompression of bz2 files that
use (too) many selectors again.

* Fix handling of large (> 4GB) files on Windows.

* Cleanup of bzdiff and bzgrep scripts so they don't use
any bash extensions and handle multiple archives correctly.

* There is now a bz2-files testsuite at
https://sourceware.org/git/bzip2-tests.git
13 changes: 8 additions & 5 deletions sys/src/external/bzip2/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

This program, "bzip2" and associated library "libbzip2", are
copyright (C) 1996-2000 Julian R Seward. All rights reserved.
--------------------------------------------------------------------------

This program, "bzip2", the associated library "libbzip2", and all
documentation, are copyright (C) 1996-2019 Julian R Seward. All
rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -33,7 +36,7 @@ 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.

Julian Seward, Cambridge, UK.
[email protected]
bzip2/libbzip2 version 1.0 of 21 March 2000
Julian Seward, [email protected]
bzip2/libbzip2 version 1.0.8 of 13 July 2019

--------------------------------------------------------------------------
Loading

0 comments on commit 257d76d

Please sign in to comment.