Initial commit

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
This commit is contained in:
Patrick McCarty
2016-02-16 11:57:55 -08:00
commit 285133f334
46 changed files with 25445 additions and 0 deletions
+67
View File
@@ -0,0 +1,67 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: true
AlignConsecutiveAssignments: false
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Linux
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IndentCaseLabels: false
IndentWidth: 8
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Always
...
+27
View File
@@ -0,0 +1,27 @@
*.o
.libs/
*.lo
*.pc
config.*
.deps/
aclocal.m4
autom4te.cache/
Makefile
Makefile.in
bsdiff
bsdump
bspatch
compile
configure
depcomp
install-sh
libbsdiff.la
libtool
ltmain.sh
m4/
missing
src/.dirstamp
stamp-h1
bsdiff-*.tar.xz
test/*.diff
test/*.out
+23
View File
@@ -0,0 +1,23 @@
Copyright 2003-2005 Colin Percival
All rights reserved
Redistribution and use in source and binary forms, with or without
modification, are permitted providing 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. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
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.
+111
View File
@@ -0,0 +1,111 @@
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = \
-fno-common \
-fstack-protector \
-std=gnu99 \
-Wall \
-Wformat \
-Wformat-security \
-Wimplicit-function-declaration \
-Wno-conversion \
-Wstrict-prototypes \
-Wundef \
-Wunreachable-code \
-Wunused-variable
AM_CPPFLAGS = \
$(AM_CFLAGS) \
-D_FORTIFY_SOURCE=2 \
-I$(top_srcdir)/include
EXTRA_DIST = \
COPYING \
findstatic.pl \
README.chromium \
src/bsdiff.sym
AUTOMAKE_OPTIONS = color-tests parallel-tests
if COVERAGE
coverage:
mkdir -p coverage
lcov --compat-libtool --directory . --capture --output-file coverage/report
genhtml -o coverage/ coverage/report
AM_CFLAGS += --coverage
endif
bin_PROGRAMS = \
bsdiff \
bsdump \
bspatch
bsdump_SOURCES = \
src/dump_main.c
bsdump_LDADD = \
libbsdiff.la
bsdiff_SOURCES = \
src/diff_main.c
bsdiff_LDADD = \
libbsdiff.la
bspatch_SOURCES = \
src/patch_main.c
bspatch_LDADD = \
libbsdiff.la
lib_LTLIBRARIES = \
libbsdiff.la
libbsdiff_la_SOURCES = \
src/diff.c \
src/patch.c
libbsdiff_la_LIBADD = \
$(zlib_LIBS)
if ENABLE_LZMA
libbsdiff_la_LIBADD += \
$(lzma_LIBS)
endif
pkgconfiglibdir=$(libdir)/pkgconfig
pkgconfiglib_DATA = \
data/bsdiff.pc
include_HEADERS = \
include/bsdiff.h
noinst_HEADERS = \
src/bsheader.h
# Library version changes according to the libtool convention:
# http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
LIBBSDIFF_CURRENT=1
LIBBSDIFF_REVISION=0
LIBBSDIFF_AGE=0
libbsdiff_la_LDFLAGS = \
-version-info $(LIBBSDIFF_CURRENT):$(LIBBSDIFF_REVISION):$(LIBBSDIFF_AGE) \
-Wl,--version-script=$(top_srcdir)/src/bsdiff.sym
distclean-local:
rm -rf aclocal.m4 ar-lib autom4te.cache config.guess config.h.in config.h.in~ config.sub configure depcomp install-sh ltmain.sh m4 Makefile.in missing compile
install-exec-hook:
perl findstatic.pl */*.o | grep -v Checking ||:
check_PROGRAMS =
release:
@git rev-parse v$(PACKAGE_VERSION) &> /dev/null; \
if [ "$$?" -eq 0 ]; then \
echo "Error: Release $(PACKAGE_VERSION) already exists."; \
echo "Bump version in configure.ac before releasing."; \
exit 1; \
fi
@git tag -a -m "$(PACKAGE_NAME) release $(PACKAGE_VERSION)" v$(PACKAGE_VERSION)
@printf "\nNew release $(PACKAGE_VERSION) tagged!\n\n"
+11
View File
@@ -0,0 +1,11 @@
This project is a forked version of BSDiff, as taken from the Chromium project
at SVN Revision 122769. See README.chromium for background on its origins.
Significant changes after the fork include:
- Changing the BSDiff file format to support file owner, group, and permission
information.
- Adding more robust error handling.
- Adding a new program, bsdump, that outputs BSDiff header information.
- Converting the core functionality into a library, libbsdiff, with public API
functions make_bsdiff_delta() and apply_bsdiff_delta().
+61
View File
@@ -0,0 +1,61 @@
The README below was taken from a snapshot of the Chromium project at:
svn - Revision 122769: /trunk/src/chrome/installer/mac/third_party/bsdiff
For information specific to the fork as implemented in this project, see the
main README file.
---
Name: BSDiff
URL: http://www.daemonology.net/bsdiff/
Source URL: http://www.daemonology.net/bsdiff/bsdiff-4.3.tar.gz
Version: 4.3
License: BSD
License File: LICENSE
Description:
Binary diff/patch utility. There are other copies of BSDiff in the Chromium
repository, but they're all different. The other copies are based on Mozilla's
fork of BSDiff, which serves a different set of needs. Relative to upstream
BSDiff, Mozilla's version removes all compression, adds a CRC-32 check of the
original file, replaces the custom off_t encoding with signed 32-bit
big-endian integers, and contains a total reorganization of the code. The
version in this directory contains no Mozilla code and builds directly on the
upstream version. It retains and enhances the compression, uses SHA1 to check
both the original file and the patched file, uses a different off_t encoding
more compatible with the original, and involves minimal changes to the
original code.
Theoretically, a hash of the original file should be enough to guarantee data
integrity, but in the event of algorithmic or programming bugs or other
unexpected conditions, a hash of the patched file provides a better guarantee.
This implementation now checks the integrity of both the original and the
patched files. SHA1, rather than CRC-32, is used to minimize the likelihood
that an original file that has been intentionally tampered with will produce
an altered patched file without being detected.
Local Modifications:
- Added LICENSE file by copying the license block from bsdiff.c and
bspatch.c.
- The following modifications are relative to the original unpatched version,
checked in to the Chromium repository at r49280.
- Created goobsdiff.gyp for GYP build system integration.
- Renamed bsdiff.c to goobsdiff.c and bspatch.c to goobspatch.c.
- Added sha1_adapter.cc, sha1_adapter.h, and empty.cc to facilitate hashing.
- Added #include <sys/types.h> to goobspatch.c so that it compiles. (Oops!)
- Changed the magic number in the header from BSDIFF40 to BSDIFF4G.
- Expanded the header to include SHA1 hashes of the original and new files,
and added hash checks to the patcher.
- Expanded the header to include the lengths of the control, diff, and extra
blocks in the patch file, and added patch file length validation to the
patcher.
- Replaced custom off_t encoding with signed 64-bit little-endian integers.
- The control, diff, and extra blocks can be compressed with bzip2, gzip, or
xz/lzma2, or left uncompressed, independently of one another, depending on
which is smallest. This often results in a net reduction in patch size of
about 3%-5%.
- Error messages in the patcher are slightly more descriptive.
- The patcher treats a few more unexpected read cases as errors than it did
previously. This will theoretically cause it to exit with an error instead
of sitting in a busy loop or crashing when certain malformatted patch files
are provided.
Executable
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
set -e
autoreconf --force --install --symlink --warnings=all
args="\
--prefix=/usr"
if test -z "${NOCONFIGURE}"; then
./configure $args "$@"
make clean
fi
+88
View File
@@ -0,0 +1,88 @@
#!/bin/bash
TMPDIR=$(mktemp -d)
PKG="bsdiff"
LIB="libbsdiff"
OLDVERSION=$(git tag -l 'v*' | sort -t . -k 1.2,1n -k 2,2n -k 3,3n | tail -1)
NEWVERSION="HEAD"
OLDCOMMIT=$(git rev-list -n 1 --abbrev-commit ${OLDVERSION})
NEWCOMMIT=$(git rev-list -n 1 --abbrev-commit ${NEWVERSION})
do_build() {
local commit=$1
echo "Building ${PKG} at commit ${commit}..."
git archive \
-o "${TMPDIR}/${PKG}-${commit}.tar.gz" \
--prefix="${PKG}-${commit}/" ${commit}
(
pushd "${TMPDIR}"
tar xf ${PKG}-${commit}.tar.gz
pushd ${PKG}-${commit}
./autogen.sh
make
popd
popd
) &> /dev/null
}
create_xml_desc() {
local commit=$1
cat > ${TMPDIR}/${PKG}-${commit}.xml << EOF
<version>
${commit}
</version>
<headers>
${TMPDIR}/${PKG}-${commit}/include/bsdiff.h
</headers>
<libs>
${TMPDIR}/${PKG}-${commit}/.libs
</libs>
EOF
}
bump_current() {
local current=$(grep '^LIBBSDIFF_CURRENT' Makefile.am | cut -d'=' -f2)
current=$(expr $current + 1)
sed -i "s/^\(LIBBSDIFF_CURRENT=\).*$/\1$current/" Makefile.am
# Note: the REVISION and AGE fields are not modified at all right now, but
# when logic is implemented in the future according to the libtool algorithm,
# they must be reset to zero, as below.
sed -i "s/^\(LIBBSDIFF_REVISION=\).*$/\10/" Makefile.am
sed -i "s/^\(LIBBSDIFF_AGE=\).*$/\10/" Makefile.am
git add Makefile.am
git commit -s -m "Bump $LIB major version to $current"
}
do_build ${OLDCOMMIT}
do_build ${NEWCOMMIT}
create_xml_desc ${OLDCOMMIT}
create_xml_desc ${NEWCOMMIT}
abi-compliance-checker \
-lib ${LIB} \
-report-path ${TMPDIR}/reports/${OLDCOMMIT}_to_${NEWCOMMIT}/report.xml \
-log1-path ${TMPDIR}/logs/${OLDCOMMIT}.log \
-log2-path ${TMPDIR}/logs/${NEWCOMMIT}.log \
-old ${TMPDIR}/${PKG}-${OLDCOMMIT}.xml \
-new ${TMPDIR}/${PKG}-${NEWCOMMIT}.xml \
-xml
ret=$?
if [ $ret -eq 0 ]; then
# TODO: should bump AGE and CURRENT for backward-compatible library changes,
# and REVISION for any library code changes.
echo "No compatibility errors found!"
elif [ $ret -eq 1 ]; then
echo "Incompatibilities found; bumping lib version."
bump_current
elif [ $ret -gt 1 ]; then
echo "Problem running the ABI check tool: error code ${ret}."
fi
exit $ret
# vi: ts=8 sw=2 sts=2 et tw=80
+71
View File
@@ -0,0 +1,71 @@
AC_PREREQ([2.66])
AC_INIT([bsdiff], [1.0.0], [patrick.mccarty@intel.com])
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC
AC_PROG_CC_STDC
AC_LANG(C)
AC_CONFIG_HEADERS([config.h])
AC_PREFIX_DEFAULT(/usr/local)
AC_CHECK_LIB([pthread], [pthread_create])
AM_INIT_AUTOMAKE([-Wall -Wno-portability no-dist-gzip dist-xz foreign subdir-objects])
AM_SILENT_RULES([yes])
LT_INIT
PKG_CHECK_MODULES([zlib], [zlib])
PKG_CHECK_MODULES([CHECK], [check >= 0.9])
AC_ARG_ENABLE([bzip2],
[AS_HELP_STRING([--disable-bzip2],[Do not use bzip2 compression (uses bzip2 by default)])])
AC_ARG_ENABLE([lzma],
[AS_HELP_STRING([--disable-lzma],[Do not use lzma compression (uses lzma by default)])])
AS_IF([test "$enable_bzip2" != "no"], [
AC_CHECK_LIB([bz2], [BZ2_bzBuffToBuffCompress], [], [AC_MSG_ERROR([the libbz2 library is missing])])
AC_DEFINE(BSDIFF_WITH_BZIP2,1,[Use bzip2 compression])
])
AS_IF([test "$enable_lzma" != "no"], [
PKG_CHECK_MODULES([lzma], [liblzma])
AC_DEFINE(BSDIFF_WITH_LZMA,1,[Use lzma compression])
])
AM_CONDITIONAL([ENABLE_LZMA], [test "$enable_lzma" != "no"])
have_coverage=no
AC_ARG_ENABLE(coverage, AS_HELP_STRING([--enable-coverage], [enable test coverage]))
if test "x$enable_coverage" = "xyes" ; then
AC_CHECK_PROG(lcov_found, [lcov], [yes], [no])
if test "x$lcov_found" = xno ; then
AC_MSG_ERROR([*** lcov support requested but the program was not found])
else
lcov_version_major="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 1`"
lcov_version_minor="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 2`"
if test "$lcov_version_major" -eq 1 -a "$lcov_version_minor" -lt 10; then
AC_MSG_ERROR([*** lcov version is too old. 1.10 required])
else
have_coverage=yes
AC_DEFINE([COVERAGE], [1], [Coverage enabled])
fi
fi
fi
AM_CONDITIONAL([COVERAGE], [test "$have_coverage" = "yes"])
AC_CONFIG_FILES([Makefile data/bsdiff.pc])
AC_OUTPUT
AC_MSG_RESULT([
bsdiff $VERSION
========
prefix: ${prefix}
libdir: ${libdir}
exec_prefix: ${exec_prefix}
bindir: ${bindir}
compiler: ${CC}
cflags: ${CFLAGS}
ldflags: ${LDFLAGS}
])
+10
View File
@@ -0,0 +1,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: bsdiff
Description: Library for bsdiff
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lbsdiff
Cflags: -I${includedir}
+75
View File
@@ -0,0 +1,75 @@
#!/usr/bin/perl -w
# find a list of fns and variables in the code that could be static
# usually called with something like this:
# findstatic.pl `find . -name "*.o"`
# Andrew Tridgell <tridge@samba.org>
use strict;
# use nm to find the symbols
my($saved_delim) = $/;
undef $/;
my($syms) = `nm -o @ARGV`;
$/ = $saved_delim;
my(@lines) = split(/\n/s, $syms);
my(%def);
my(%undef);
my(%stype);
my(%typemap) = (
"T" => "function",
"C" => "uninitialised variable",
"D" => "initialised variable"
);
# parse the symbols into defined and undefined
for (my($i)=0; $i <= $#lines; $i++) {
my($line) = $lines[$i];
if ($line =~ /(.*):[a-f0-9]* ([TCD]) (.*)/) {
my($fname) = $1;
my($symbol) = $3;
push(@{$def{$fname}}, $symbol);
$stype{$symbol} = $2;
}
if ($line =~ /(.*):\s* U (.*)/) {
my($fname) = $1;
my($symbol) = $2;
push(@{$undef{$fname}}, $symbol);
}
}
# look for defined symbols that are never referenced outside the place they
# are defined
foreach my $f (keys %def) {
print "Checking $f\n";
my($found_one) = 0;
foreach my $s (@{$def{$f}}) {
my($found) = 0;
foreach my $f2 (keys %undef) {
if ($f2 ne $f) {
foreach my $s2 (@{$undef{$f2}}) {
if ($s2 eq $s) {
$found = 1;
$found_one = 1;
}
}
}
}
if ($found == 0) {
my($t) = $typemap{$stype{$s}};
if ($s eq 'main') {
# special case: main program
$found_one = 1;
} else {
print " '$s' is unique to $f, should be static? ($t)\n";
}
}
}
if ($found_one == 0) {
print " all symbols in '$f' are unused (main program?)\n";
}
}
+19
View File
@@ -0,0 +1,19 @@
#ifndef __INCLUDE_GUARD_BSDIFF_H
#define __INCLUDE_GUARD_BSDIFF_H
/* encodings */
enum BSDIFF_ENCODINGS {
BSDIFF_ENC_ANY,
BSDIFF_ENC_NONE,
BSDIFF_ENC_BZIP2,
BSDIFF_ENC_GZIP,
BSDIFF_ENC_XZ,
BSDIFF_ENC_ZEROS,
BSDIFF_ENC_LAST
};
/* API definition */
int make_bsdiff_delta(char *old_filename, char *new_filename, char *delta_filename, int enc);
int apply_bsdiff_delta(char *oldfile, char *newfile, char *deltafile);
#endif
+7
View File
@@ -0,0 +1,7 @@
BSDIFF_1_0_0 {
global:
make_bsdiff_delta;
apply_bsdiff_delta;
local:
*;
};
+180
View File
@@ -0,0 +1,180 @@
#ifndef __INCLUDE_GUARD_BSHEADER_H
#define __INCLUDE_GUARD_BSHEADER_H
#include <stdint.h>
#include "bsdiff.h"
/* process no more than 512MB sized files */
#define BSDIFF_MAX_FILESZ 512 * 1024 * 1024
/* used for suffix sort in bsdiff */
#define QSUF_BUCKET_SIZE 256
enum BSDIFF_BLOCKS {
BSDIFF_BLOCK_CONTROL,
BSDIFF_BLOCK_DIFF,
BSDIFF_BLOCK_EXTRA,
};
/* encodings bitfield */
typedef union {
struct {
uint16_t cblk_none : 1; /* control block enc's*/
uint16_t cblk_bzip2 : 1;
uint16_t cblk_gzip : 1;
uint16_t cblk_xz : 1;
uint16_t : 1; /* unused */
uint16_t dblk_none : 1; /* diff block enc's */
uint16_t dblk_bzip2 : 1;
uint16_t dblk_gzip : 1;
uint16_t dblk_xz : 1;
uint16_t dblk_zeros : 1;
uint16_t eblk_none : 1; /* extra block enc's */
uint16_t eblk_bzip2 : 1;
uint16_t eblk_gzip : 1;
uint16_t eblk_xz : 1;
uint16_t eblk_zeros : 1;
uint16_t : 1; /* unused */
} ordered;
uint16_t raw;
} enc_flags_t;
/***************************************************************
* v2.x headers
***************************************************************/
/* cleaned up typing and optimized fields */
#define BSDIFF_HDR_MAGIC_V20 "BSDIFF4U"
/* directory header: uses only file_{mode|owner|group} */
#define BSDIFF_HDR_DIR_V20 "DIR_V20U"
/* do a full download instead of reading a bsdiff, only magic field used */
#define BSDIFF_HDR_FULLDL "FULLV20U"
struct header_v20 {
unsigned char magic[8];
uint8_t offset_to_first_block; /* ~= header length */
uint32_t control_length;
uint64_t diff_length;
uint64_t extra_length;
uint64_t old_file_length;
uint64_t new_file_length;
uint64_t mtime; /* unused */
uint32_t file_mode;
uint32_t file_owner;
uint32_t file_group;
/* Supported encodings: uncompressed, bzip2, gzip, xz, zeros */
enc_flags_t encoding;
} __attribute__((__packed__));
/* optimized for small files */
#define BSDIFF_HDR_MAGIC_V21 "BSDIFF4V"
struct header_v21 {
unsigned char magic[8];
uint8_t offset_to_first_block; /* ~= header length */
uint8_t control_length;
uint16_t diff_length;
uint16_t extra_length;
uint16_t old_file_length;
uint16_t new_file_length;
uint32_t file_mode;
uint32_t file_owner;
uint32_t file_group;
/* Supported encodings: uncompressed, bzip2, gzip, xz, zeros */
enc_flags_t encoding;
} __attribute__((__packed__));
static inline void cblock_set_enc(enc_flags_t *enc, int method)
{
if (method == BSDIFF_ENC_NONE) {
enc->ordered.cblk_none = 1;
} else if (method == BSDIFF_ENC_BZIP2) {
enc->ordered.cblk_bzip2 = 1;
} else if (method == BSDIFF_ENC_GZIP) {
enc->ordered.cblk_gzip = 1;
} else if (method == BSDIFF_ENC_XZ) {
enc->ordered.cblk_xz = 1;
}
}
static inline void dblock_set_enc(enc_flags_t *enc, int method)
{
if (method == BSDIFF_ENC_NONE) {
enc->ordered.dblk_none = 1;
} else if (method == BSDIFF_ENC_BZIP2) {
enc->ordered.dblk_bzip2 = 1;
} else if (method == BSDIFF_ENC_GZIP) {
enc->ordered.dblk_gzip = 1;
} else if (method == BSDIFF_ENC_XZ) {
enc->ordered.dblk_xz = 1;
} else if (method == BSDIFF_ENC_ZEROS) {
enc->ordered.dblk_zeros = 1;
}
}
static inline void eblock_set_enc(enc_flags_t *enc, int method)
{
if (method == BSDIFF_ENC_NONE) {
enc->ordered.eblk_none = 1;
} else if (method == BSDIFF_ENC_BZIP2) {
enc->ordered.eblk_bzip2 = 1;
} else if (method == BSDIFF_ENC_GZIP) {
enc->ordered.eblk_gzip = 1;
} else if (method == BSDIFF_ENC_XZ) {
enc->ordered.eblk_xz = 1;
} else if (method == BSDIFF_ENC_ZEROS) {
enc->ordered.eblk_zeros = 1;
}
}
static inline int cblock_get_enc(enc_flags_t enc)
{
if (enc.ordered.cblk_none) {
return BSDIFF_ENC_NONE;
} else if (enc.ordered.cblk_bzip2) {
return BSDIFF_ENC_BZIP2;
} else if (enc.ordered.cblk_gzip) {
return BSDIFF_ENC_GZIP;
} else if (enc.ordered.cblk_xz) {
return BSDIFF_ENC_XZ;
} else {
return BSDIFF_ENC_ANY;
}
}
static inline int dblock_get_enc(enc_flags_t enc)
{
if (enc.ordered.dblk_none) {
return BSDIFF_ENC_NONE;
} else if (enc.ordered.dblk_bzip2) {
return BSDIFF_ENC_BZIP2;
} else if (enc.ordered.dblk_gzip) {
return BSDIFF_ENC_GZIP;
} else if (enc.ordered.dblk_xz) {
return BSDIFF_ENC_XZ;
} else if (enc.ordered.dblk_zeros) {
return BSDIFF_ENC_ZEROS;
} else {
return BSDIFF_ENC_ANY;
}
}
static inline int eblock_get_enc(enc_flags_t enc)
{
if (enc.ordered.eblk_none) {
return BSDIFF_ENC_NONE;
} else if (enc.ordered.eblk_bzip2) {
return BSDIFF_ENC_BZIP2;
} else if (enc.ordered.eblk_gzip) {
return BSDIFF_ENC_GZIP;
} else if (enc.ordered.eblk_xz) {
return BSDIFF_ENC_XZ;
} else if (enc.ordered.eblk_zeros) {
return BSDIFF_ENC_ZEROS;
} else {
return BSDIFF_ENC_ANY;
}
}
#endif
+1050
View File
File diff suppressed because it is too large Load Diff
+89
View File
@@ -0,0 +1,89 @@
/*
* This file is part of bsdiff.
*
* Copyright © 2012-2016 Intel Corporation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted providing 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. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 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.
*
* Authors:
* Tim Pepper <timothy.c.pepper@linux.intel.com>
*
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "bsdiff.h"
/* parse encoding as string and return value as enum
*/
static int get_encoding(char *encoding)
{
if (strcmp(encoding, "raw") == 0) {
return BSDIFF_ENC_NONE;
} else if (strcmp(encoding, "bzip2") == 0) {
return BSDIFF_ENC_BZIP2;
} else if (strcmp(encoding, "gzip") == 0) {
return BSDIFF_ENC_GZIP;
} else if (strcmp(encoding, "xz") == 0) {
return BSDIFF_ENC_XZ;
} else if (strcmp(encoding, "zeros") == 0) {
return BSDIFF_ENC_ZEROS;
} else if (strcmp(encoding, "any") == 0) {
return BSDIFF_ENC_ANY;
} else {
return -1;
}
}
int main(int argc, char **argv)
{
int ret, enc = BSDIFF_ENC_ANY;
if (argc < 4) {
printf("Usage: %s oldfile newfile deltafile [encoding]\n\n", argv[0]);
printf("Creates a binary diff DELTAFILE from OLDFILE to NEWFILE.");
printf(" If ENCODING is specified, accepted values are 'raw', 'bzip2',");
printf(" 'gzip', 'xz', 'zeros', or 'any'. The 'raw' value will force");
printf(" no compression.\n");
return -EXIT_FAILURE;
}
if (argc > 4) {
if ((enc = get_encoding(argv[4])) < 0) {
printf("Unknown encoding algorithm\n");
return -EXIT_FAILURE;
}
}
ret = make_bsdiff_delta(argv[1], argv[2], argv[3], enc);
if (ret != 0) {
printf("Failed to create delta (%d)\n", ret);
return ret;
}
return EXIT_SUCCESS;
}
+276
View File
@@ -0,0 +1,276 @@
/*
* This file is part of bsdiff.
*
* Copyright © 2012-2016 Intel Corporation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted providing 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. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 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.
*
* Authors:
* Tim Pepper <timothy.c.pepper@linux.intel.com>
*
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <time.h>
#include "bsdiff.h"
#include "bsheader.h"
static char *algos[BSDIFF_ENC_LAST] = {"invalid", "none", "bzip2", "gzip", "xz", "zeros"};
static void banner(char **argv)
{
printf("Usage: %s FILE\n\n", argv[0]);
printf("Dumps header information from the bsdiff FILE.\n");
exit(-EXIT_FAILURE);
}
static int read_v20_header(struct header_v20 *h, FILE *f, char *filename)
{
rewind(f);
if (fread(h, sizeof(struct header_v20), 1, f) < 1) {
printf("v2 magic, but short header (%s)\n", filename);
return -1;
}
return 0;
}
static void print_v20_header(struct header_v20 *h, FILE *f)
{
int ret;
uint64_t *zeros;
printf("First block offset:\t%3u\n", h->offset_to_first_block);
printf("Cblock length: %10u\n", h->control_length);
printf(" encoding: %10s\n", algos[cblock_get_enc(h->encoding)]);
printf("Dblock length: %10llu\n", (long long unsigned int)(h->diff_length));
printf(" encoding: %10s\n", algos[dblock_get_enc(h->encoding)]);
if (dblock_get_enc(h->encoding) == BSDIFF_ENC_ZEROS) {
zeros = malloc(sizeof(uint64_t));
assert(zeros);
ret = fseek(f, h->offset_to_first_block + h->control_length, SEEK_SET);
if (ret != 0) {
printf(" numzeros: error seeking\n");
exit(-1);
}
if (fread(zeros, sizeof(uint64_t), 1, f) != 1) {
printf(" numzeros: error reading\n");
} else {
printf(" numzeros: %10llu\n", (long long unsigned int)(*zeros));
}
free(zeros);
}
printf("Eblock length: %10llu\n", (long long unsigned int)(h->extra_length));
printf(" encoding: %10s\n", algos[eblock_get_enc(h->encoding)]);
if (eblock_get_enc(h->encoding) == BSDIFF_ENC_ZEROS) {
zeros = malloc(sizeof(uint64_t));
assert(zeros);
ret = fseek(f, h->offset_to_first_block + h->control_length + h->diff_length, SEEK_SET);
if (ret != 0) {
printf(" numzeros: error seeking\n");
exit(-1);
}
if (fread(zeros, sizeof(uint64_t), 1, f) != 1) {
printf(" numzeros: error reading\n");
} else {
printf(" numzeros: %10llu\n", (long long unsigned int)(*zeros));
}
free(zeros);
}
printf("Old file length: %10llu\n", (long long unsigned int)(h->old_file_length));
printf("New file length: %10llu\n", (long long unsigned int)(h->new_file_length));
if (h->mtime == 0) {
printf("Mtime:\t(not set, as expected)\n");
} else {
printf("Mtime:\t%s (probably means there is a bug)\n", ctime((const time_t*)&h->mtime));
}
printf("Mode:\t%4o\n", h->file_mode);
printf("Uid:\t%d\n", h->file_owner);
printf("Gid:\t%d\n", h->file_group);
}
static int read_v21_header(struct header_v21 *h, FILE *f, char *filename)
{
rewind(f);
if (fread(h, sizeof(struct header_v21), 1, f) < 1) {
printf("v3 magic, but short header (%s)\n", filename);
return -1;
}
return 0;
}
static void print_v21_header(struct header_v21 *h, FILE *f)
{
int ret;
uint64_t *zeros;
printf("First block offset:\t%3u\n", h->offset_to_first_block);
printf("Cblock length: %10u\n", h->control_length);
printf(" encoding: %10s\n", algos[cblock_get_enc(h->encoding)]);
printf("Dblock length: %10u\n", h->diff_length);
printf(" encoding: %10s\n", algos[dblock_get_enc(h->encoding)]);
if (dblock_get_enc(h->encoding) == BSDIFF_ENC_ZEROS) {
zeros = malloc(sizeof(uint64_t));
assert(zeros);
ret = fseek(f, h->offset_to_first_block + h->control_length, SEEK_SET);
if (ret != 0) {
printf(" numzeros: error seeking\n");
exit(-1);
}
if (fread(zeros, sizeof(uint64_t), 1, f) != 1) {
printf(" numzeros: error reading\n");
} else {
printf(" numzeros: %10llu\n", (long long unsigned int)(*zeros));
}
free(zeros);
}
printf("Eblock length: %10u\n", h->extra_length);
printf(" encoding: %10s\n", algos[eblock_get_enc(h->encoding)]);
if (eblock_get_enc(h->encoding) == BSDIFF_ENC_ZEROS) {
zeros = malloc(sizeof(uint64_t));
assert(zeros);
ret = fseek(f, h->offset_to_first_block + h->control_length + h->diff_length, SEEK_SET);
if (ret != 0) {
printf(" numzeros: error seeking\n");
exit(-1);
}
if (fread(zeros, sizeof(uint64_t), 1, f) != 1) {
printf(" numzeros: error reading\n");
} else {
printf(" numzeros: %10llu\n", (long long unsigned int)(*zeros));
}
free(zeros);
}
printf("Old file length: %10u\n", h->old_file_length);
printf("New file length: %10u\n", h->new_file_length);
printf("Mode:\t%4o\n", h->file_mode);
printf("Uid:\t%d\n", h->file_owner);
printf("Gid:\t%d\n", h->file_group);
}
int main(int argc, char **argv)
{
FILE *infile;
unsigned char magic[8];
int ret = 0;
if (argc < 2) {
banner(argv);
}
infile = fopen(argv[1], "r");
if (infile == NULL) {
printf("Error opening file %s\n", argv[1]);
banner(argv);
}
if (fread(&magic, 8, 1, infile) < 1) {
printf("Magic: unknown (short)\n");
ret = -1;
goto out;
}
if (memcmp(&magic, BSDIFF_HDR_MAGIC_V20, 8) == 0) {
/* bsdiff v20: */
struct header_v20 h;
memset(&h, 0, sizeof(struct header_v20));
ret = read_v20_header(&h, infile, argv[1]);
if (ret != 0) {
goto out;
}
printf("Magic: %s (v2.0)\n", BSDIFF_HDR_MAGIC_V20);
print_v20_header(&h, infile);
} else if (memcmp(&magic, BSDIFF_HDR_MAGIC_V21, 8) == 0) {
/* bsdiff v21: */
struct header_v21 h;
memset(&h, 0, sizeof(struct header_v21));
ret = read_v21_header(&h, infile, argv[1]);
if (ret != 0) {
goto out;
}
printf("Magic: %s (v2.1)\n", BSDIFF_HDR_MAGIC_V21);
print_v21_header(&h, infile);
} else if (memcmp(&magic, BSDIFF_HDR_DIR_V20, 8) == 0) {
/* directory: anything interesting to print? */
struct header_v20 h;
memset(&h, 0, sizeof(struct header_v20));
ret = read_v20_header(&h, infile, argv[1]);
if (ret != 0) {
goto out;
}
printf("Magic:\t%s\n", BSDIFF_HDR_DIR_V20);
printf("Mode:\t%4o\n", h.file_mode);
printf("Uid:\t%d\n", h.file_owner);
printf("Gid:\t%d\n", h.file_group);
} else if (memcmp(&magic, BSDIFF_HDR_FULLDL, 8) == 0) {
/* full download req'd: possibly nothing more than the 8bytes
magic, or maybe interesting info still */
uint8_t len;
printf("Magic: %s\n", BSDIFF_HDR_FULLDL);
if (fread(&len, 1, 1, infile) == 1) {
if (len == sizeof(struct header_v20)) {
struct header_v20 h;
ret = read_v20_header(&h, infile, argv[1]);
if (ret != 0) {
goto out;
}
print_v20_header(&h, infile);
} else if (len == sizeof(struct header_v21)) {
struct header_v21 h;
ret = read_v21_header(&h, infile, argv[1]);
if (ret != 0) {
goto out;
}
print_v21_header(&h, infile);
}
}
} else { // unknown
printf("Magic: unknown\n");
ret = -1;
}
out:
fclose(infile);
return ret;
}
+787
View File
@@ -0,0 +1,787 @@
/*-
* Copyright 2003-2005 Colin Percival
* All rights reserved
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted providing 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. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 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.
*/
#if 0
__FBSDID
("$FreeBSD: src/usr.bin/bsdiff/bspatch/bspatch.c,v 1.1 2005/08/06 01:59:06 cperciva Exp $");
#endif
#define _GNU_SOURCE
#include "config.h"
#include <sys/types.h>
#ifdef BSDIFF_WITH_BZIP2
#include <bzlib.h>
#endif
#include <err.h>
#ifdef BSDIFF_WITH_LZMA
#include <lzma.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <zlib.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <pwd.h>
#include <grp.h>
#include <fcntl.h>
#include <limits.h>
#include <linux/fs.h>
#include <assert.h>
#include <endian.h>
#include <errno.h>
#include <sys/mman.h>
#include "bsheader.h"
static inline int64_t offtin(u_char *buf)
{
return le64toh(*((int64_t *)buf));
}
#ifdef BSDIFF_WITH_LZMA
/* xzfile is a provisional stdio-like interface to xz/lzma2-compressed data.
* liblzma does not currently include this functionality. The interface is
* read-only and only supports sequential access. */
typedef struct {
/* in and out are the underlying buffers to be used with lzma_stream. */
u_char in[BUFSIZ];
u_char out[BUFSIZ];
lzma_stream ls;
FILE *f;
/* read_out points to the first byte in out not yet consumed by an
* xzread call. read_out_len tracks the amount of data available in
* out beginning at read_out. */
u_char *read_out;
size_t read_out_len;
/* Error and end-of-file indicators. */
lzma_ret err;
int eof;
} xzfile;
/* Initializes and returns a new xzfile pointer that will read from f. On
* failure, returns NULL. If err is non-NULL, it will be set to indicate any
* error that may have occurred. */
static xzfile *xzdopen(FILE *f, lzma_ret *err)
{
xzfile *xzf;
lzma_stream ls = LZMA_STREAM_INIT;
uint64_t memlimit;
if (!(xzf = malloc(sizeof(xzfile)))) {
if (err) {
*err = LZMA_MEM_ERROR;
}
return NULL;
}
xzf->ls = ls;
xzf->f = f;
xzf->read_out = xzf->out;
xzf->read_out_len = 0;
xzf->err = LZMA_OK;
xzf->eof = 0;
/* Use the same memory limits used by xzdec and xz. Use 40% of
* physical memory if 80MB or more, otherwise use 80% of physical
* memory if 80MB or less, otherwise use 80MB. If physical memory
* can't be determined, use 128MB. These limits should be sufficient
* for any decompression on any general-purpose system. */
memlimit = 80 * 1024 * 1024;
xzf->err = lzma_stream_decoder(&xzf->ls, memlimit,
LZMA_TELL_NO_CHECK |
LZMA_TELL_UNSUPPORTED_CHECK);
if (xzf->err != LZMA_OK) {
if (err) {
*err = xzf->err;
}
free(xzf);
return NULL;
}
if (err) {
*err = xzf->err;
}
return xzf;
}
/* Closes an xzfile opened by xzopen, freeing all memory and closing all
* files. Returns LZMA_OK normally, or LZMA_STREAM_END if fclose fails. */
static lzma_ret xzclose(xzfile *xzf)
{
lzma_ret lzma_err = LZMA_OK;
lzma_end(&xzf->ls);
if (fclose(xzf->f) != 0) {
lzma_err = LZMA_STREAM_END;
}
free(xzf);
return lzma_err;
}
/* Reads len uncompressed bytes from xzf into buf. Returns the number of bytes
* read, which may be less than len at the end of the file. Upon error, if
* err is non-NULL, it will be set to an appropriate value, which will either
* be a return value from lzma_code (with the exception of LZMA_STREAM_END,
* which is remapped to LZMA_OK), or LZMA_STREAM_END to indicate an I/O error.
*/
static size_t xzread(xzfile *xzf, u_char *buf, size_t len, lzma_ret *err)
{
lzma_action action = LZMA_RUN;
size_t copylen;
size_t nread = 0;
*err = LZMA_OK;
while (xzf->err == LZMA_OK && len > 0) {
if (xzf->read_out_len == 0) {
/* No unconsumed data is available, need to run
* lzma_code to decompress. */
if (xzf->ls.avail_in == 0 && xzf->eof) {
return 0;
}
if (xzf->ls.avail_in == 0 && !xzf->eof) {
/* No input data available, need to read. */
xzf->ls.next_in = xzf->in;
xzf->ls.avail_in = fread(xzf->in, 1, BUFSIZ,
xzf->f);
if (ferror(xzf->f)) {
/* Map I/O errors to LZMA_STREAM_END. */
xzf->err = LZMA_STREAM_END;
*err = xzf->err;
return 0;
} else if (feof(xzf->f)) {
xzf->eof = 1;
}
}
/* Use the full output buffer. */
xzf->ls.next_out = xzf->out;
xzf->ls.avail_out = BUFSIZ;
/* There must be something to decode. */
if (xzf->ls.avail_in == 0) {
xzf->err = LZMA_BUF_ERROR;
*err = xzf->err;
return 0;
}
/* LZMA_FINISH is not critical because
* LZMA_CONCATENATED is not in use. */
if (xzf->eof) {
action = LZMA_FINISH;
}
/* Run the decoder. */
xzf->err = lzma_code(&xzf->ls, action);
if (xzf->err == LZMA_STREAM_END) {
xzf->eof = 1;
xzf->err = LZMA_OK;
/* if the stream ended, but no bytes were outputed.. we're at the end */
if (xzf->ls.avail_out == BUFSIZ) {
len = 0;
}
} else if (xzf->err != LZMA_OK) {
*err = xzf->err;
return 0;
}
/* Everything that was decoded is now available for
* reading into buf. */
xzf->read_out = xzf->out;
xzf->read_out_len = BUFSIZ - xzf->ls.avail_out;
}
/* Copy everything available up to len, and push some
* pointers. */
copylen = xzf->read_out_len;
if (copylen > len) {
copylen = len;
}
memcpy(buf, xzf->read_out, copylen);
nread += copylen;
buf += copylen;
len -= copylen;
xzf->read_out += copylen;
xzf->read_out_len -= copylen;
}
*err = xzf->err;
return nread;
}
#endif /* BSDIFF_WITH_LZMA */
/* cfile is a uniform interface to read from maybe-compressed files. */
typedef struct {
FILE *f; /* method = NONE, BZIP2, ZEROS */
int fd; /* method = BZIP2 */
union {
#ifdef BSDIFF_WITH_BZIP2
BZFILE *bz2; /* method = BZIP2 */
#endif
gzFile gz; /* method = GZIP */
#ifdef BSDIFF_WITH_LZMA
xzfile *xz; /* method = XZ */
#endif
} u;
const char *tag;
unsigned char method;
} cfile;
/* Opens a file at path, seeks to offset off, and prepares for reading using
* the specified method in enum BSDIFF_ENCODINGS. The tag is an identifier
* for error reporting. */
static int cfopen(cfile *cf, const char *path, int64_t off,
const char *tag, unsigned char method)
{
#ifdef BSDIFF_WITH_BZIP2
int bz2_err;
#endif
#ifdef BSDIFF_WITH_LZMA
lzma_ret lzma_err;
#endif
if (method == BSDIFF_ENC_NONE ||
method == BSDIFF_ENC_BZIP2 ||
method == BSDIFF_ENC_XZ ||
method == BSDIFF_ENC_ZEROS) {
/* Use stdio for uncompressed files. The bzip interface also
* sits on top of a stdio FILE* but does not take "ownership"
* of the FILE*. The xz/lzma2 interface sits on top of a FILE*
* and does take ownership of the FILE*. */
if ((cf->f = fopen(path, "rb")) == NULL) {
return -1;
}
if ((fseeko(cf->f, off, SEEK_SET)) != 0) {
fclose(cf->f);
return -1;
}
if (method == BSDIFF_ENC_BZIP2) {
#ifdef BSDIFF_WITH_BZIP2
if ((cf->u.bz2 = BZ2_bzReadOpen(&bz2_err, cf->f, 0, 0,
NULL, 0)) == NULL) {
fclose(cf->f);
return -1;
}
#else /*BSDIFF_WITHOUT_BZIP2*/
fclose(cf->f);
return -1;
#endif
} else if (method == BSDIFF_ENC_XZ) {
#ifdef BSDIFF_WITH_LZMA
if ((cf->u.xz = xzdopen(cf->f, &lzma_err)) == NULL) {
fclose(cf->f);
return -1;
}
/* cf->f belongs to the xzfile now, don't access it
* from here. */
cf->f = NULL;
#else /* BSDIFF_WITHOUT_LZMA */
fclose(cf->f);
return -1;
#endif
}
} else if (method == BSDIFF_ENC_GZIP) {
if ((cf->fd = open(path, O_RDONLY)) < 0) {
return -1;
}
if (lseek(cf->fd, off, SEEK_SET) != off) {
close(cf->fd);
return -1;
}
if ((cf->u.gz = gzdopen(cf->fd, "rb")) == NULL) {
close(cf->fd);
return -1;
}
} else {
return -1;
}
cf->tag = tag;
cf->method = method;
return 0;
}
static void cfclose(cfile *cf)
{
#ifdef BSDIFF_WITH_BZIP2
int bz2_err;
#endif
int gz_err;
#ifdef BSDIFF_WITH_LZMA
lzma_ret lzma_err;
#endif
if (cf->method == BSDIFF_ENC_NONE ||
cf->method == BSDIFF_ENC_BZIP2 ||
cf->method == BSDIFF_ENC_ZEROS) {
if (cf->method == BSDIFF_ENC_BZIP2) {
#ifdef BSDIFF_WITH_BZIP2
bz2_err = BZ_OK;
BZ2_bzReadClose(&bz2_err, cf->u.bz2);
#else /*BSDIFF_WITHOUT_BZIP2*/
return;
#endif
}
if (fclose(cf->f) != 0) {
return;
}
} else if (cf->method == BSDIFF_ENC_GZIP) {
if ((gz_err = gzclose(cf->u.gz)) != Z_OK) {
return;
}
} else if (cf->method == BSDIFF_ENC_XZ) {
#ifdef BSDIFF_WITH_LZMA
if ((lzma_err = xzclose(cf->u.xz)) != LZMA_OK) {
return;
}
#else /* BSDIFF_WITHOUT_LZMA */
return;
#endif
}
}
static int cfread(cfile *cf, u_char *buf, size_t len, int block, uint64_t *zeros)
{
size_t nread;
#ifdef BSDIFF_WITH_BZIP2
int bz2_err;
#endif
int gz_err;
#ifdef BSDIFF_WITH_LZMA
lzma_ret lzma_err;
#endif
if (len <= 0) {
return 0;
}
if (cf->method == BSDIFF_ENC_NONE) {
nread = fread(buf, 1, len, cf->f);
if (nread != len) {
return -1;
}
} else if (cf->method == BSDIFF_ENC_BZIP2) {
#ifdef BSDIFF_WITH_BZIP2
bz2_err = BZ_OK;
if ((nread = BZ2_bzRead(&bz2_err, cf->u.bz2, buf, len)) != len) {
return -1;
}
#else /*BSDIFF_WITHOUT_BZIP2*/
return -1;
#endif
} else if (cf->method == BSDIFF_ENC_GZIP) {
if ((nread = gzread(cf->u.gz, buf, len)) != len) {
gz_err = Z_OK;
gzerror(cf->u.gz, &gz_err);
return -1;
}
} else if (cf->method == BSDIFF_ENC_XZ) {
#ifdef BSDIFF_WITH_LZMA
if ((nread = xzread(cf->u.xz, buf, len, &lzma_err)) != len) {
return -1;
}
#else /* BSDIFF_WITH_LZMA */
return -1;
#endif
} else if ((cf->method == BSDIFF_ENC_ZEROS) &&
((block == BSDIFF_BLOCK_DIFF) || (block == BSDIFF_BLOCK_EXTRA))) {
if (*zeros == ULONG_MAX) {
uint64_t tmp;
nread = fread(&tmp, sizeof(uint64_t), 1, cf->f);
if (nread != 1) {
return -1;
}
*zeros = tmp;
}
if (*zeros < len) {
return -1;
}
if (*zeros >= len) {
memset(buf, 0, len);
*zeros -= len;
}
} else {
return -1;
}
return 0;
}
static int check_header(FILE *f, enc_flags_t encoding,
off_t control_length, off_t diff_length, off_t extra_length,
off_t old_file_length, off_t new_file_length, off_t offset_to_first_block)
{
off_t patchsize;
/* Read lengths from header */
if (control_length < 0 || diff_length < 0 || extra_length < 0) {
return -1;
}
if (old_file_length < 0 || new_file_length < 0) {
return -1;
}
if (fseeko(f, 0, SEEK_END) != 0 || (patchsize = ftello(f)) < 0) {
return -1;
}
if (patchsize != offset_to_first_block + control_length + diff_length + extra_length) {
return -1;
}
if (cblock_get_enc(encoding) == BSDIFF_ENC_ZEROS) {
return -1;
}
return 0;
}
static int open_bsdiff_blocks(cfile *cf, cfile *df, cfile *ef, char *deltafile,
off_t control_length, off_t diff_length,
off_t offset_to_first_block, enc_flags_t encoding)
{
int ret;
ret = cfopen(cf, deltafile, offset_to_first_block,
"control", cblock_get_enc(encoding));
if (ret < 0) {
return -1;
}
ret = cfopen(df, deltafile, offset_to_first_block + control_length,
"diff", dblock_get_enc(encoding));
if (ret < 0) {
cfclose(cf);
return -1;
}
ret = cfopen(ef, deltafile, offset_to_first_block + control_length + diff_length,
"extra", eblock_get_enc(encoding));
if (ret < 0) {
cfclose(cf);
cfclose(df);
return -1;
}
return 0;
}
static int read_file(char *filename, unsigned char **data, off_t len)
{
int fd;
struct stat sb;
fd = open(filename, O_RDONLY, 0);
if (fd < 0) {
return -1;
}
if (fstat(fd, &sb) != 0) {
close(fd);
return -1;
}
if (len != sb.st_size) {
close(fd);
return -1;
}
*data = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, fd, 0);
close(fd);
if (*data == MAP_FAILED) {
*data = NULL;
return -1;
}
return 0;
}
static int apply_delta_v2(int subver, FILE *f,
char *old_filename, char *new_filename, char *delta_filename)
{
cfile cf, df, ef;
unsigned char *old_data = NULL, *new_data;
unsigned char buf[8];
off_t oldpos, newpos;
int64_t ctrl[3];
int i, ret, fd;
off_t data_offset;
off_t ctrllen, difflen, extralen;
off_t oldsize, newsize;
mode_t mode;
uid_t uid;
gid_t gid;
enc_flags_t encoding;
uint64_t d_zeros = ULONG_MAX;
uint64_t e_zeros = ULONG_MAX;
if (subver == 0) {
struct header_v20 header;
if (fread(&header, sizeof(struct header_v20), 1, f) < 1) {
return -1;
}
data_offset = header.offset_to_first_block;
ctrllen = header.control_length;
difflen = header.diff_length;
extralen = header.extra_length;
oldsize = header.old_file_length;
newsize = header.new_file_length;
mode = header.file_mode;
uid = header.file_owner;
gid = header.file_group;
encoding = header.encoding;
} else if (subver == 1) {
struct header_v21 header;
if (fread(&header, sizeof(struct header_v21), 1, f) < 1) {
return -1;
}
data_offset = header.offset_to_first_block;
ctrllen = header.control_length;
difflen = header.diff_length;
extralen = header.extra_length;
oldsize = header.old_file_length;
newsize = header.new_file_length;
mode = header.file_mode;
uid = header.file_owner;
gid = header.file_group;
encoding = header.encoding;
} else {
return -1;
}
if ((ret = check_header(f, encoding,
ctrllen, difflen, extralen,
oldsize, newsize, data_offset)) < 0) {
return ret;
}
if ((ret = open_bsdiff_blocks(&cf, &df, &ef, delta_filename,
ctrllen, difflen, data_offset, encoding)) < 0) {
return ret;
}
ret = read_file(old_filename, &old_data, oldsize);
if (ret < 0) {
goto preperror;
}
if (newsize > BSDIFF_MAX_FILESZ) {
munmap(old_data, oldsize);
ret = -1;
goto preperror;
}
/* Allocate newsize+1 bytes instead of newsize bytes to ensure
that we never try to malloc(0) and get a NULL pointer */
if ((new_data = malloc(newsize + 1)) == NULL) {
munmap(old_data, oldsize);
ret = -1;
goto preperror;
}
memset(new_data, 0, newsize + 1);
oldpos = 0;
newpos = 0;
while (newpos < newsize) {
/* Read control data:
* ctrl[0] == offset into diff block
* ctrl[1] == offset into extra block
* ctrl[2] == adjustment factor for offset into old_data
*
* The three control block words manage reads of the diff,
* extra and old_data so that those three sources can be
* combined into new_data. ctrl[2] in particular may cause
* oldpos to jump forward AND backward in order to allow
* copies of the original file content rather than using
* diff or extra content.
*/
for (i = 0; i <= 2; i++) {
ret = cfread(&cf, buf, 8, BSDIFF_BLOCK_CONTROL, NULL);
if (ret < 0) {
goto readerror;
}
ctrl[i] = offtin(buf);
}
/* Sanity-check */
if (newpos + ctrl[0] > newsize || ctrl[0] < 0 || newpos + ctrl[0] < 0) {
ret = -1;
goto readerror;
}
/* Read diff string */
ret = cfread(&df, new_data + newpos, ctrl[0], BSDIFF_BLOCK_DIFF, &d_zeros);
if (ret < 0) {
goto readerror;
}
/* Add old data to diff string */
for (i = 0; i < ctrl[0]; i++) {
if ((oldpos + i >= 0) && (oldpos + i < oldsize)) {
new_data[newpos + i] += old_data[oldpos + i];
}
}
/* Adjust pointers */
newpos += ctrl[0];
oldpos += ctrl[0];
/* Sanity-check */
if (newpos + ctrl[1] > newsize || ctrl[1] < 0 || newpos + ctrl[1] < 0) {
ret = -1;
goto readerror;
}
if (oldpos + ctrl[2] > oldsize || oldpos + ctrl[2] < 0) {
ret = -1;
goto readerror;
}
/* Read extra string */
ret = cfread(&ef, new_data + newpos, ctrl[1], BSDIFF_BLOCK_EXTRA, &e_zeros);
if (ret < 0) {
goto readerror;
}
/* Adjust pointers */
newpos += ctrl[1];
oldpos += ctrl[2];
}
/* Clean up the readers */
cfclose(&cf);
cfclose(&df);
cfclose(&ef);
/* Write the new file */
fd = open(new_filename, O_CREAT | O_EXCL | O_WRONLY, 0600);
if (fd < 0) {
ret = -1;
goto writeerror;
}
if (write(fd, new_data, newsize) != newsize) {
unlink(new_filename);
close(fd);
ret = -1;
goto writeerror;
}
close(fd);
ret = chown(new_filename, uid, gid);
if (ret < 0) {
free(new_data);
return ret;
}
ret = chmod(new_filename, mode);
if (ret < 0) {
free(new_data);
return ret;
}
writeerror:
free(new_data);
munmap(old_data, oldsize);
return ret;
readerror:
free(new_data);
munmap(old_data, oldsize);
preperror:
cfclose(&cf);
cfclose(&df);
cfclose(&ef);
return ret;
}
int apply_bsdiff_delta(char *oldfile, char *newfile, char *deltafile)
{
FILE *f;
unsigned char magic[8];
struct stat sb;
int ret;
/* Open patch file */
f = fopen(deltafile, "rb");
if (!f) {
return -1;
}
if (stat(deltafile, &sb) == -1) {
ret = -1;
goto error;
}
/* Make sure delta file is at least big enough to have a header */
if (sb.st_size < 8) {
ret = -2;
goto error;
}
/* Read header magic */
if (fread(&magic, 8, 1, f) < 1) {
ret = -1;
goto error;
}
/* Deal with different header types */
if (memcmp(&magic, BSDIFF_HDR_MAGIC_V20, 8) == 0) {
rewind(f);
ret = apply_delta_v2(0, f, oldfile, newfile, deltafile);
if (ret != 0) {
goto error;
}
} else if (memcmp(&magic, BSDIFF_HDR_MAGIC_V21, 8) == 0) {
rewind(f);
ret = apply_delta_v2(1, f, oldfile, newfile, deltafile);
if (ret != 0) {
goto error;
}
} else if (memcmp(&magic, BSDIFF_HDR_DIR_V20, 8) == 0) {
ret = -1;
} else if (memcmp(&magic, BSDIFF_HDR_FULLDL, 8) == 0) {
ret = -2;
} else {
ret = -1;
}
error:
fclose(f);
return ret;
}
+57
View File
@@ -0,0 +1,57 @@
/*
* This file is part of bsdiff.
*
* Copyright © 2012-2016 Intel Corporation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted providing 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. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 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.
*
* Authors:
* Tim Pepper <timothy.c.pepper@linux.intel.com>
*
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include "bsdiff.h"
int main(int argc, char **argv)
{
int ret;
if (argc != 4) {
printf("Usage: %s oldfile newfile deltafile\n\n", argv[0]);
printf("Applies the binary diff DELTAFILE to OLDFILE.");
printf(" The resulting file will be named NEWFILE.\n");
return -EXIT_FAILURE;
}
ret = apply_bsdiff_delta(argv[1], argv[2], argv[3]);
if (ret != 0) {
printf("Failed to apply delta (%d)\n", ret);
return ret;
}
return EXIT_SUCCESS;
}
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
+40
View File
@@ -0,0 +1,40 @@
#!/bin/sh
# If using normal root, avoid changing anything.
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
cd $RPM_BUILD_ROOT
# Compress man pages
COMPRESS="gzip -9 -n"
COMPRESS_EXT=
for d in ./usr/man/man* ./usr/man/*/man* ./usr/info \
./usr/share/man/man* ./usr/share/man/*/man* ./usr/share/info \
./usr/kerberos/man ./usr/X11R6/man/man* ./usr/lib/perl5/man/man* \
./usr/share/doc/*/man/man* ./usr/lib/*/man/man*
do
[ -d $d ] || continue
for f in `find $d -type f`
do
[ -f "$f" ] || continue
[ "`basename $f`" = "dir" ] && continue
case "$f" in
*.Z) gunzip -f $f; b=`echo $f | sed -e 's/\.Z$//'`;;
*.gz) gunzip -f $f; b=`echo $f | sed -e 's/\.gz$//'`;;
*.bz2) bunzip2 -f $f; b=`echo $f | sed -e 's/\.bz2$//'`;;
*) b=$f;;
esac
done
for f in `find $d -type l`
do
l=`ls -l $f | sed -e 's/.* -> //' -e 's/\.gz$//' -e 's/\.bz2$//' -e 's/\.Z$//'`
rm -f $f
b=`echo $f | sed -e 's/\.gz$//' -e 's/\.bz2$//' -e 's/\.Z$//'`
ln -sf $l$COMPRESS_EXT $b$COMPRESS_EXT
done
done
+56
View File
@@ -0,0 +1,56 @@
#!/bin/sh
# If using normal root, avoid changing anything.
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
cd $RPM_BUILD_ROOT
# Compress man pages
COMPRESS="gzip -9 -n"
COMPRESS_EXT=.gz
for d in ./usr/man/man* ./usr/man/*/man* ./usr/info \
./usr/share/man/man* ./usr/share/man/*/man* ./usr/share/info \
./usr/kerberos/man ./usr/X11R6/man/man* ./usr/lib/perl5/man/man* \
./usr/share/doc/*/man/man* ./usr/lib/*/man/man*
do
[ -d $d ] || continue
for f in `find $d -type f`
do
[ -f "$f" ] || continue
[ "`basename $f`" = "dir" ] && continue
case "$f" in
*.Z) gunzip -f $f; b=`echo $f | sed -e 's/\.Z$//'`;;
*.gz) gunzip -f $f; b=`echo $f | sed -e 's/\.gz$//'`;;
*.bz2) bunzip2 -f $f; b=`echo $f | sed -e 's/\.bz2$//'`;;
*) b=$f;;
esac
$COMPRESS $b </dev/null 2>/dev/null || {
inode=`ls -i $b | awk '{ print $1 }'`
others=`find $d -type f -inum $inode`
if [ -n "$others" ]; then
for afile in $others ; do
[ "$afile" != "$b" ] && rm -f $afile
done
$COMPRESS -f $b
for afile in $others ; do
[ "$afile" != "$b" ] && ln $b$COMPRESS_EXT $afile$COMPRESS_EXT
done
else
$COMPRESS -f $b
fi
}
done
for f in `find $d -type l`
do
l=`ls -l $f | sed -e 's/.* -> //' -e 's/\.gz$//' -e 's/\.bz2$//' -e 's/\.Z$//'`
rm -f $f
b=`echo $f | sed -e 's/\.gz$//' -e 's/\.bz2$//' -e 's/\.Z$//'`
ln -sf $l$COMPRESS_EXT $b$COMPRESS_EXT
done
done
+36
View File
@@ -0,0 +1,36 @@
<HTML><HEAD>
<TITLE>Network Error</TITLE>
</HEAD>
<BODY>
<FONT face="Helvetica">
<big><strong></strong></big><BR>
</FONT>
<blockquote>
<TABLE border=0 cellPadding=1 width="80%">
<TR><TD>
<FONT face="Helvetica">
<big>Network Error (tcp_error)</big>
<BR>
<BR>
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica">
A communication error occurred: ""
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica">
The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time.
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica" SIZE=2>
<BR>
For assistance, contact your network support team.
</FONT>
</TD></TR>
</TABLE>
</blockquote>
</FONT>
</BODY></HTML>
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
adm:!!::
wheel:!!::
systemd-journal:!!::
systemd-resolve:!!::
systemd-network:!!::
systemd-bus-proxy:!!::
audio:!!::
systemd-timesync:!!::
nobody:!!::
lp:!!::
log:!!::
systemd-journal-gateway:!!::
input:!!::
+13
View File
@@ -0,0 +1,13 @@
wheel:!!::
input:!!::
systemd-journal-gateway:!!::
systemd-network:!!::
lp:!!::
systemd-bus-proxy:!!::
systemd-journal:!!::
systemd-timesync:!!::
log:!!::
systemd-resolve:!!::
adm:!!::
nobody:!!::
audio:!!::
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
................................................................................................................................................................................................................................................................
Binary file not shown.
+67
View File
@@ -0,0 +1,67 @@
<!-- proposed DTD for new glade format -->
<!ELEMENT glade-interface (requires*, widget*) >
<!ATTLIST glade-interface
xmlns CDATA #FIXED 'http://glade.gnome.org/glade-2.0.dtd' >
<!ELEMENT requires EMPTY >
<!ATTLIST requires
lib CDATA #REQUIRED >
<!ELEMENT widget (property*, accessibility?, signal*, accelerator*, child*) >
<!ATTLIST widget
class CDATA #REQUIRED
id ID #REQUIRED >
<!ELEMENT property (#PCDATA) >
<!-- type is an optional tag, and should be the string name of the
GType for the property -->
<!-- translatable specifies whether the property should be translated
before use. -->
<!ATTLIST property
name CDATA #REQUIRED
type CDATA #IMPLIED
translatable (yes|no) 'no'
agent CDATA #IMPLIED >
<!ELEMENT atkproperty (#PCDATA | accessibility)* >
<!ATTLIST atkproperty
name CDATA #REQUIRED
type CDATA #IMPLIED >
<!ELEMENT atkrelation EMPTY >
<!ATTLIST atkrelation
target CDATA #REQUIRED
type CDATA #REQUIRED >
<!ELEMENT atkaction EMPTY >
<!ATTLIST atkaction
action_name CDATA #REQUIRED
description CDATA #IMPLIED >
<!ELEMENT accessibility (atkrelation | atkaction | atkproperty)* >
<!ELEMENT signal EMPTY >
<!ATTLIST signal
name CDATA #REQUIRED
handler CDATA #REQUIRED
after (yes|no) 'no'
object IDREF #IMPLIED
last_modification_time CDATA #IMPLIED >
<!ELEMENT accelerator EMPTY >
<!ATTLIST accelerator
key CDATA #REQUIRED
modifiers CDATA #REQUIRED
signal CDATA #REQUIRED >
<!ELEMENT child ((widget|placeholder), packing?) >
<!-- internal children should not have any properties set on them.
(Internal children are things like the scrollbars in a
GtkScrolledWindow, or the vbox in a GtkDialog). -->
<!ATTLIST child
internal-child CDATA #IMPLIED >
<!ELEMENT packing (property+) >
<!ELEMENT placeholder EMPTY >
Binary file not shown.
+14
View File
@@ -0,0 +1,14 @@
prefix=/usr
exec_prefix=/usr
libdir=/usr/lib64
includedir=/usr/include
target=x11
gtk_binary_version=2.10.0
gtk_host=x86_64-pc-linux-gnu
Name: GTK+
Description: GTK+ Unix print support
Version: 2.24.10
Requires: gtk+-${target}-2.0 atk cairo gdk-pixbuf-2.0 gio-2.0 pangoft2
Cflags: -I${includedir}/gtk-unix-print-2.0
Binary file not shown.
+188
View File
@@ -0,0 +1,188 @@
# Tcl autoload index file, version 2.0
# This file is generated by the "auto_mkindex" command
# and sourced to set up indexing information for one or
# more commands. Typically each line is a command that
# sets an element in the auto_index array, where the
# element name is the name of a command and the value is
# a script that loads the command.
set auto_index(_delete_indexlock) [list source [file join $dir index.tcl]]
set auto_index(_close_updateindex) [list source [file join $dir index.tcl]]
set auto_index(update_indexinfo) [list source [file join $dir index.tcl]]
set auto_index(write_update_indexinfo) [list source [file join $dir index.tcl]]
set auto_index(update_index) [list source [file join $dir index.tcl]]
set auto_index(write_update_index) [list source [file join $dir index.tcl]]
set auto_index(checkout_index) [list source [file join $dir index.tcl]]
set auto_index(write_checkout_index) [list source [file join $dir index.tcl]]
set auto_index(unstage_helper) [list source [file join $dir index.tcl]]
set auto_index(do_unstage_selection) [list source [file join $dir index.tcl]]
set auto_index(add_helper) [list source [file join $dir index.tcl]]
set auto_index(do_add_selection) [list source [file join $dir index.tcl]]
set auto_index(do_add_all) [list source [file join $dir index.tcl]]
set auto_index(revert_helper) [list source [file join $dir index.tcl]]
set auto_index(do_revert_selection) [list source [file join $dir index.tcl]]
set auto_index(do_select_commit_type) [list source [file join $dir index.tcl]]
set auto_index(merge_resolve_one) [list source [file join $dir mergetool.tcl]]
set auto_index(merge_stage_workdir) [list source [file join $dir mergetool.tcl]]
set auto_index(do_merge_stage_workdir) [list source [file join $dir mergetool.tcl]]
set auto_index(merge_add_resolution) [list source [file join $dir mergetool.tcl]]
set auto_index(merge_force_stage) [list source [file join $dir mergetool.tcl]]
set auto_index(merge_load_stages) [list source [file join $dir mergetool.tcl]]
set auto_index(read_merge_stages) [list source [file join $dir mergetool.tcl]]
set auto_index(merge_resolve_tool) [list source [file join $dir mergetool.tcl]]
set auto_index(merge_resolve_tool2) [list source [file join $dir mergetool.tcl]]
set auto_index(delete_temp_files) [list source [file join $dir mergetool.tcl]]
set auto_index(merge_tool_get_stages) [list source [file join $dir mergetool.tcl]]
set auto_index(merge_tool_start) [list source [file join $dir mergetool.tcl]]
set auto_index(read_mtool_output) [list source [file join $dir mergetool.tcl]]
set auto_index(merge_tool_finish) [list source [file join $dir mergetool.tcl]]
set auto_index(::choose_font::pick) [list source [file join $dir choose_font.tcl]]
set auto_index(::searchbar::new) [list source [file join $dir search.tcl]]
set auto_index(::branch_create::dialog) [list source [file join $dir branch_create.tcl]]
set auto_index(::branch_checkout::dialog) [list source [file join $dir branch_checkout.tcl]]
set auto_index(_error_parent) [list source [file join $dir error.tcl]]
set auto_index(error_popup) [list source [file join $dir error.tcl]]
set auto_index(warn_popup) [list source [file join $dir error.tcl]]
set auto_index(info_popup) [list source [file join $dir error.tcl]]
set auto_index(ask_popup) [list source [file join $dir error.tcl]]
set auto_index(hook_failed_popup) [list source [file join $dir error.tcl]]
set auto_index(win32_read_lnk) [list source [file join $dir win32.tcl]]
set auto_index(win32_create_lnk) [list source [file join $dir win32.tcl]]
set auto_index(::linebar::new) [list source [file join $dir line.tcl]]
set auto_index(::browser::new) [list source [file join $dir browser.tcl]]
set auto_index(::browser_open::dialog) [list source [file join $dir browser.tcl]]
set auto_index(do_about) [list source [file join $dir about.tcl]]
set auto_index(InitTheme) [list source [file join $dir themed.tcl]]
set auto_index(gold_frame) [list source [file join $dir themed.tcl]]
set auto_index(tlabel) [list source [file join $dir themed.tcl]]
set auto_index(paddedlabel) [list source [file join $dir themed.tcl]]
set auto_index(Dialog) [list source [file join $dir themed.tcl]]
set auto_index(pave_toplevel) [list source [file join $dir themed.tcl]]
set auto_index(slistbox) [list source [file join $dir themed.tcl]]
set auto_index(get_bg_color) [list source [file join $dir themed.tcl]]
set auto_index(tspinbox) [list source [file join $dir themed.tcl]]
set auto_index(tentry) [list source [file join $dir themed.tcl]]
set auto_index(tentry_widgetproc) [list source [file join $dir themed.tcl]]
set auto_index(tchoosefont) [list source [file join $dir themed.tcl]]
set auto_index(on_choosefont) [list source [file join $dir themed.tcl]]
set auto_index(::console::new) [list source [file join $dir console.tcl]]
set auto_index(::console::embed) [list source [file join $dir console.tcl]]
set auto_index(git_logo) [list source [file join $dir logo.tcl]]
set auto_index(do_windows_shortcut) [list source [file join $dir shortcut.tcl]]
set auto_index(do_cygwin_shortcut) [list source [file join $dir shortcut.tcl]]
set auto_index(do_macosx_app) [list source [file join $dir shortcut.tcl]]
set auto_index(::spellcheck::init) [list source [file join $dir spellcheck.tcl]]
set auto_index(::spellcheck::_match_length) [list source [file join $dir spellcheck.tcl]]
set auto_index(::spellcheck::available_langs) [list source [file join $dir spellcheck.tcl]]
set auto_index(find_ssh_key) [list source [file join $dir sshkey.tcl]]
set auto_index(do_ssh_key) [list source [file join $dir sshkey.tcl]]
set auto_index(make_ssh_key) [list source [file join $dir sshkey.tcl]]
set auto_index(kill_sshkey) [list source [file join $dir sshkey.tcl]]
set auto_index(read_sshkey_output) [list source [file join $dir sshkey.tcl]]
set auto_index(do_stats) [list source [file join $dir database.tcl]]
set auto_index(do_gc) [list source [file join $dir database.tcl]]
set auto_index(do_fsck_objects) [list source [file join $dir database.tcl]]
set auto_index(hint_gc) [list source [file join $dir database.tcl]]
set auto_index(::remote_branch_delete::dialog) [list source [file join $dir remote_branch_delete.tcl]]
set auto_index(::remote_add::dialog) [list source [file join $dir remote_add.tcl]]
set auto_index(load_last_commit) [list source [file join $dir commit.tcl]]
set auto_index(committer_ident) [list source [file join $dir commit.tcl]]
set auto_index(do_signoff) [list source [file join $dir commit.tcl]]
set auto_index(create_new_commit) [list source [file join $dir commit.tcl]]
set auto_index(setup_commit_encoding) [list source [file join $dir commit.tcl]]
set auto_index(commit_tree) [list source [file join $dir commit.tcl]]
set auto_index(commit_prehook_wait) [list source [file join $dir commit.tcl]]
set auto_index(commit_commitmsg) [list source [file join $dir commit.tcl]]
set auto_index(commit_commitmsg_wait) [list source [file join $dir commit.tcl]]
set auto_index(commit_writetree) [list source [file join $dir commit.tcl]]
set auto_index(commit_committree) [list source [file join $dir commit.tcl]]
set auto_index(commit_postcommit_wait) [list source [file join $dir commit.tcl]]
set auto_index(load_all_heads) [list source [file join $dir branch.tcl]]
set auto_index(load_all_tags) [list source [file join $dir branch.tcl]]
set auto_index(radio_selector) [list source [file join $dir branch.tcl]]
set auto_index(::blame::new) [list source [file join $dir blame.tcl]]
set auto_index(::tools_add::dialog) [list source [file join $dir tools_dlg.tcl]]
set auto_index(::tools_remove::dialog) [list source [file join $dir tools_dlg.tcl]]
set auto_index(::tools_askdlg::dialog) [list source [file join $dir tools_dlg.tcl]]
set auto_index(class) [list source [file join $dir class.tcl]]
set auto_index(field) [list source [file join $dir class.tcl]]
set auto_index(constructor) [list source [file join $dir class.tcl]]
set auto_index(method) [list source [file join $dir class.tcl]]
set auto_index(create_this) [list source [file join $dir class.tcl]]
set auto_index(delete_this) [list source [file join $dir class.tcl]]
set auto_index(make_dialog) [list source [file join $dir class.tcl]]
set auto_index(make_toplevel) [list source [file join $dir class.tcl]]
set auto_index(tools_list) [list source [file join $dir tools.tcl]]
set auto_index(tools_populate_all) [list source [file join $dir tools.tcl]]
set auto_index(tools_create_item) [list source [file join $dir tools.tcl]]
set auto_index(tools_populate_one) [list source [file join $dir tools.tcl]]
set auto_index(tools_exec) [list source [file join $dir tools.tcl]]
set auto_index(tools_run_silent) [list source [file join $dir tools.tcl]]
set auto_index(tools_consume_input) [list source [file join $dir tools.tcl]]
set auto_index(tools_complete) [list source [file join $dir tools.tcl]]
set auto_index(clear_diff) [list source [file join $dir diff.tcl]]
set auto_index(reshow_diff) [list source [file join $dir diff.tcl]]
set auto_index(force_diff_encoding) [list source [file join $dir diff.tcl]]
set auto_index(handle_empty_diff) [list source [file join $dir diff.tcl]]
set auto_index(show_diff) [list source [file join $dir diff.tcl]]
set auto_index(show_unmerged_diff) [list source [file join $dir diff.tcl]]
set auto_index(advance_diff_queue) [list source [file join $dir diff.tcl]]
set auto_index(show_other_diff) [list source [file join $dir diff.tcl]]
set auto_index(get_conflict_marker_size) [list source [file join $dir diff.tcl]]
set auto_index(start_show_diff) [list source [file join $dir diff.tcl]]
set auto_index(parse_color_line) [list source [file join $dir diff.tcl]]
set auto_index(read_diff) [list source [file join $dir diff.tcl]]
set auto_index(apply_hunk) [list source [file join $dir diff.tcl]]
set auto_index(apply_range_or_line) [list source [file join $dir diff.tcl]]
set auto_index(::branch_rename::dialog) [list source [file join $dir branch_rename.tcl]]
set auto_index(parse_git_date) [list source [file join $dir date.tcl]]
set auto_index(format_date) [list source [file join $dir date.tcl]]
set auto_index(reformat_date) [list source [file join $dir date.tcl]]
set auto_index(build_encoding_table) [list source [file join $dir encoding.tcl]]
set auto_index(tcl_encoding) [list source [file join $dir encoding.tcl]]
set auto_index(force_path_encoding) [list source [file join $dir encoding.tcl]]
set auto_index(get_path_encoding) [list source [file join $dir encoding.tcl]]
set auto_index(build_encoding_submenu) [list source [file join $dir encoding.tcl]]
set auto_index(popup_btn_menu) [list source [file join $dir encoding.tcl]]
set auto_index(build_encoding_menu) [list source [file join $dir encoding.tcl]]
set auto_index(do_build_encoding_menu) [list source [file join $dir encoding.tcl]]
set auto_index(::choose_repository::pick) [list source [file join $dir choose_repository.tcl]]
set auto_index(::choose_repository::_get_recentrepos) [list source [file join $dir choose_repository.tcl]]
set auto_index(::choose_repository::_unset_recentrepo) [list source [file join $dir choose_repository.tcl]]
set auto_index(::choose_repository::_append_recentrepos) [list source [file join $dir choose_repository.tcl]]
set auto_index(::choose_repository::_is_git) [list source [file join $dir choose_repository.tcl]]
set auto_index(::choose_repository::_objdir) [list source [file join $dir choose_repository.tcl]]
set auto_index(::choose_repository::_new_ok) [list source [file join $dir choose_repository.tcl]]
set auto_index(is_tracking_branch) [list source [file join $dir remote.tcl]]
set auto_index(all_tracking_branches) [list source [file join $dir remote.tcl]]
set auto_index(load_all_remotes) [list source [file join $dir remote.tcl]]
set auto_index(add_fetch_entry) [list source [file join $dir remote.tcl]]
set auto_index(add_push_entry) [list source [file join $dir remote.tcl]]
set auto_index(make_sure_remote_submenues_exist) [list source [file join $dir remote.tcl]]
set auto_index(update_all_remotes_menu_entry) [list source [file join $dir remote.tcl]]
set auto_index(populate_remotes_menu) [list source [file join $dir remote.tcl]]
set auto_index(add_single_remote) [list source [file join $dir remote.tcl]]
set auto_index(delete_from_menu) [list source [file join $dir remote.tcl]]
set auto_index(remove_remote) [list source [file join $dir remote.tcl]]
set auto_index(::choose_rev::new) [list source [file join $dir choose_rev.tcl]]
set auto_index(::choose_rev::new_unmerged) [list source [file join $dir choose_rev.tcl]]
set auto_index(::choose_rev::_new) [list source [file join $dir choose_rev.tcl]]
set auto_index(::status_bar::new) [list source [file join $dir status_bar.tcl]]
set auto_index(::status_bar::two_line) [list source [file join $dir status_bar.tcl]]
set auto_index(::branch_delete::dialog) [list source [file join $dir branch_delete.tcl]]
set auto_index(fetch_from) [list source [file join $dir transport.tcl]]
set auto_index(prune_from) [list source [file join $dir transport.tcl]]
set auto_index(fetch_from_all) [list source [file join $dir transport.tcl]]
set auto_index(prune_from_all) [list source [file join $dir transport.tcl]]
set auto_index(push_to) [list source [file join $dir transport.tcl]]
set auto_index(start_push_anywhere_action) [list source [file join $dir transport.tcl]]
set auto_index(do_push_anywhere) [list source [file join $dir transport.tcl]]
set auto_index(config_check_encodings) [list source [file join $dir option.tcl]]
set auto_index(save_config) [list source [file join $dir option.tcl]]
set auto_index(do_options) [list source [file join $dir option.tcl]]
set auto_index(do_restore_defaults) [list source [file join $dir option.tcl]]
set auto_index(do_save_config) [list source [file join $dir option.tcl]]
set auto_index(::merge::dialog) [list source [file join $dir merge.tcl]]
set auto_index(::merge::reset_hard) [list source [file join $dir merge.tcl]]
set auto_index(::merge::_reset_wait) [list source [file join $dir merge.tcl]]
set auto_index(::checkout_op::new) [list source [file join $dir checkout_op.tcl]]
Binary file not shown.
Binary file not shown.
Binary file not shown.
+179
View File
@@ -0,0 +1,179 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<vendor>The systemd Project</vendor>
<vendor_url>http://www.freedesktop.org/wiki/Software/systemd</vendor_url>
<action id="org.freedesktop.login1.inhibit-block">
<description>Allow applications to inhibit system shutdown and suspend</description>
<message>Authentication is required to allow an application to inhibit system shutdown or suspend.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.inhibit-delay">
<description>Allow applications to delay system shutdown and suspend</description>
<message>Authentication is required to allow an application to delay system shutdown or suspend.</message>
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.set-user-linger">
<description>Allow non-logged-in users to run programs</description>
<message>Authentication is required to allow a non-logged-in user to run programs.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.attach-device">
<description>Allow attaching devices to seats</description>
<message>Authentication is required for attaching a device to a seat.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.flush-devices">
<description>Flush device to seat attachments</description>
<message>Authentication is required for resetting how devices are attached to seats.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.power-off">
<description>Power off the system</description>
<message>Authentication is required for powering off the system.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.power-off-multiple-sessions">
<description>Power off the system while other users are logged in</description>
<message>Authentication is required for powering off the system while other users are logged in.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.power-off-ignore-inhibit">
<description>Power off the system while an application asked to inhibit it</description>
<message>Authentication is required for powering off the system while an application asked to inhibit it.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.reboot">
<description>Reboot the system</description>
<message>Authentication is required for rebooting the system.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.reboot-multiple-sessions">
<description>Reboot the system while other users are logged in</description>
<message>Authentication is required for rebooting the system while other users are logged in.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.reboot-ignore-inhibit">
<description>Reboot the system while an application asked to inhibit it</description>
<message>Authentication is required for rebooting the system while an application asked to inhibit it.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.suspend">
<description>Suspend the system</description>
<message>Authentication is required for suspending the system.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.suspend-multiple-sessions">
<description>Suspend the system while other users are logged in</description>
<message>Authentication is required for suspending the system while other users are logged in.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.suspend-ignore-inhibit">
<description>Suspend the system while an application asked to inhibit it</description>
<message>Authentication is required for suspending the system while an application asked to inhibit it.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.hibernate">
<description>Hibernate the system</description>
<message>Authentication is required for hibernating the system.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.hibernate-multiple-sessions">
<description>Hibernate the system while other users are logged in</description>
<message>Authentication is required for hibernating the system while other users are logged in.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.hibernate-ignore-inhibit">
<description>Hibernate the system while an application asked to inhibit it</description>
<message>Authentication is required for hibernating the system while an application asked to inhibit it.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
</policyconfig>
+179
View File
@@ -0,0 +1,179 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<vendor>The systemd Project</vendor>
<vendor_url>http://www.freedesktop.org/wiki/Software/systemd</vendor_url>
<action id="org.freedesktop.login1.inhibit-block">
<description>Allow applications to inhibit system shutdown and suspend</description>
<message>Authentication is required to allow an application to inhibit system shutdown or suspend.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.inhibit-delay">
<description>Allow applications to delay system shutdown and suspend</description>
<message>Authentication is required to allow an application to delay system shutdown or suspend.</message>
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.set-user-linger">
<description>Allow non-logged-in users to run programs</description>
<message>Authentication is required to allow a non-logged-in user to run programs.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.attach-device">
<description>Allow attaching devices to seats</description>
<message>Authentication is required for attaching a device to a seat.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.flush-devices">
<description>Flush device to seat attachments</description>
<message>Authentication is required for resetting how devices are attached to seats.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.power-off">
<description>Power off the system</description>
<message>Authentication is required for powering off the system.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.power-off-multiple-sessions">
<description>Power off the system while other users are logged in</description>
<message>Authentication is required for powering off the system while other users are logged in.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.power-off-ignore-inhibit">
<description>Power off the system while an application asked to inhibit it</description>
<message>Authentication is required for powering off the system while an application asked to inhibit it.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.reboot">
<description>Reboot the system</description>
<message>Authentication is required for rebooting the system.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.reboot-multiple-sessions">
<description>Reboot the system while other users are logged in</description>
<message>Authentication is required for rebooting the system while other users are logged in.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.reboot-ignore-inhibit">
<description>Reboot the system while an application asked to inhibit it</description>
<message>Authentication is required for rebooting the system while an application asked to inhibit it.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.suspend">
<description>Suspend the system</description>
<message>Authentication is required for suspending the system.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.suspend-multiple-sessions">
<description>Suspend the system while other users are logged in</description>
<message>Authentication is required for suspending the system while other users are logged in.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.suspend-ignore-inhibit">
<description>Suspend the system while an application asked to inhibit it</description>
<message>Authentication is required for suspending the system while an application asked to inhibit it.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.hibernate">
<description>Hibernate the system</description>
<message>Authentication is required for hibernating the system.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.hibernate-multiple-sessions">
<description>Hibernate the system while other users are logged in</description>
<message>Authentication is required for hibernating the system while other users are logged in.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.login1.hibernate-ignore-inhibit">
<description>Hibernate the system while an application asked to inhibit it</description>
<message>Authentication is required for hibernating the system while an application asked to inhibit it.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
</policyconfig>
Executable
+87
View File
@@ -0,0 +1,87 @@
#!/bin/bash
sudo rm -f *.diff *.out
libdir="$(realpath "../.libs")"
ldpath="LD_LIBRARY_PATH=$libdir"
BSDIFF="sudo $ldpath valgrind -q $libdir/bsdiff"
BSPATCH="sudo $ldpath valgrind -q $libdir/bspatch"
echo -n "5.."
$BSPATCH data/5.bspatch.original 5.out data/5.bspatch.diff
echo -n "6.."
$BSPATCH data/6.bspatch.original 6.out data/6.bspatch.diff
echo -n "7.."
$BSPATCH data/7.bspatch.original 7.out data/7.bspatch.diff
echo -n "8.."
$BSPATCH data/8.bspatch.original 8.out data/8.bspatch.diff
echo -n "9.."
$BSPATCH data/9.bspatch.original 9.out data/9.bspatch.diff
diff data/9.bspatch.modified 9.out
if [ $? -ne 0 ]
then
echo "bspatch 9 output does not match expected!!"
fi
echo -n "10.."
$BSPATCH data/10.bspatch.original 10.out data/10.bspatch.diff
diff data/10.bspatch.modified 10.out
if [ $? -ne 0 ]
then
echo "bspatch 10 output does not match expected!!"
fi
#same as 9 but with zeros encoding
echo -n "11.."
$BSPATCH data/9.bspatch.original 11.out data/11.bspatch.diff
diff data/9.bspatch.modified 11.out
if [ $? -ne 0 ]
then
echo "bspatch 11 output does not match expected!!"
fi
echo -n "12.."
$BSPATCH data/12.bspatch.original 12.out data/12.bspatch.diff
diff data/12.bspatch.modified 12.out
if [ $? -ne 0 ]
then
echo "bspatch 12 output does not match expected!!"
fi
echo -n "13.."
$BSDIFF data/13.bspatch.original data/13.bspatch.modified 13.diff any
$BSPATCH data/13.bspatch.original 13.out 13.diff
diff data/13.bspatch.modified 13.out
if [ $? -ne 0 ]
then
echo "bspatch 13 output does not match expected!!"
fi
# Next a very loooong running test, but one which successfully condenses the 2MB
# original file pair into a 26kB bsdiff. The bsdiff computation alone (ie:
# non-valgrind'd) takes ~20minutes on a decent build machine. Running it
# through valgrind takes many many hours to run to completion. Therefore leave
# filepair #14 as one for only occasional use in long-running regression
# testing. The other file pairs can be check quickly enough that they can be
# used in a regression test run at every check-in of code changes to the bsdiff
# implementation.
#
#echo -n "14.."
#$BSDIFF data/14.bspatch.original data/14.bspatch.modified 14.diff any
#$BSPATCH data/14.bspatch.original 14.out 14.diff
#diff data/14.bspatch.modified 14.out
#if [ $? -ne 0 ]
#then
# echo "bspatch 14 output does not match expected!!"
#fi
echo -n "15.."
$BSDIFF data/15.bspatch.original data/15.bspatch.modified 15.diff any
# expected output: "Failed to create delta (-1)"
if [ $? -ne 255 ]
then
echo "bspatch 15 creation has memory management issue!"
fi
echo -n "16.."
# any valgrind errors may indicate a buffer overflow
$BSPATCH data/16.bspatch.original 16.out data/16.bspatch.diff
# add final newline
echo ""