From 271a4077651d0f9a66afb1c5273658e67e7616e2 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Thu, 15 Sep 2011 13:29:09 +1000 Subject: [PATCH 1/5] Make lzma back end message maxverbose to minimise spamming. --- stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stream.c b/stream.c index 5c3aab7..f321890 100644 --- a/stream.c +++ b/stream.c @@ -365,7 +365,7 @@ static int lzma_compress_buf(rzip_control *control, struct compress_thread *cthr /* only 7 levels with lzma, scale them */ lzma_level = control->compression_level * 7 / 9 ? : 1; - print_verbose("Starting lzma back end compression thread...\n"); + print_maxverbose("Starting lzma back end compression thread...\n"); retry: dlen = cthread->s_len; c_buf = malloc(dlen); From d5e048dccf283f92c130db0c02a6a07422e8580a Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Thu, 15 Sep 2011 13:53:50 +1000 Subject: [PATCH 2/5] Add a bash completion script courtest of Fernando Auil and install it if possible. --- AUTHORS | 1 + Makefile.am | 4 ++ lrzip.completion | 119 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 lrzip.completion diff --git a/AUTHORS b/AUTHORS index 12b923c..07fe41a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -20,3 +20,4 @@ Michael Blumenkrantz for updated autotools Serge Belyshev for encryption help and code Ulrich Drepper for MD5 implementation PolarSSL authors for sha512 + aes128 implementation +Fernando Auil for lrzip completion diff --git a/Makefile.am b/Makefile.am index 122ee05..89a9518 100644 --- a/Makefile.am +++ b/Makefile.am @@ -72,8 +72,12 @@ EXTRA_DIST = \ description-pak \ autogen.sh \ INSTALL \ + lrzip.completion \ $(dist_doc_DATA) +install-data-hook: + test -d /etc/bash_completion.d && @INSTALL_DATA@ lrzip.completion /etc/bash_completion.d/lrzip + install-exec-hook: $(LN_S) -f lrzip$(EXEEXT) $(DESTDIR)@bindir@/lrunzip$(EXEEXT) $(LN_S) -f lrzip$(EXEEXT) $(DESTDIR)@bindir@/lrzcat$(EXEEXT) diff --git a/lrzip.completion b/lrzip.completion new file mode 100644 index 0000000..129c9ee --- /dev/null +++ b/lrzip.completion @@ -0,0 +1,119 @@ +#-*- mode: shell-script;-*- +# Inputs: +# $1 -- name of the command whose arguments are being completed +# $2 -- word being completed +# $3 -- word preceding the word being completed +# $COMP_LINE -- current command line +# $COMP_PONT -- cursor position +# $COMP_WORDS -- array containing individual words in the current +# command line +# $COMP_CWORD -- index into ${COMP_WORDS} of the word containing the +# current cursor position +# Output: +# COMPREPLY array variable contains possible completions +# +# Copyright (C) 2011 Fernando Auil +# Author: Fernando Auil +# Last revision: 25Jun2011 + +have lrzip && +_lrzip() +{ +local cpu_count win_size +local general_opts output_opts compress_opts level_opts options special special2 + +# Get the CPU count. +cpu_count=$(grep -c ^processor /proc/cpuinfo) + +# This is aproximately the heuristical window size (in MB) for the +# non-STDIN case (which is more conservative?). +win_size=$(awk '/MemTotal/{print$2}' /proc/meminfo) +win_size=$((win_size >> 17)) + +general_opts='-c -d -e -h -? -H -i -q -t -v -vv -V' +output_opts='-D -f -k -o -O -S' +compress_opts='-b -g -l -n -z' +level_opts='-L -N -p -T -U -w' + +COMPREPLY=() +cur=${COMP_WORDS[COMP_CWORD]} +prev=${COMP_WORDS[COMP_CWORD-1]} + + for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do + if [[ ${COMP_WORDS[i]} == @(-b|-g|-l|-n|-z) ]]; then + special=${COMP_WORDS[i]} + elif [[ ${COMP_WORDS[i]} == @(-U) ]]; then + special2=${COMP_WORDS[i]} + fi + done + + if [ -n "$special" ]; then + unset compress_opts + fi + + if [ -n "$special2" ]; then + level_opts='-L -N -p -T -U' + fi + +options="$general_opts $output_opts $level_opts $compress_opts" + +case "$prev" in + +-L) +COMPREPLY=( $(compgen -W "$(seq 9)" -- $cur) ) +return 0 +;; + +-N) +COMPREPLY=( $(compgen -W "$(seq -20 19)" -- $cur) ) +return 0 +;; + +-S) +COMPREPLY=( $(compgen -W ".lrz" -- $cur) ) +return 0 +;; + +-p) +COMPREPLY=( $(compgen -W "$cpu_count" -- $cur) ) +return 0 +;; + +-w) +COMPREPLY=( $(compgen -W "$win_size" -- $cur) ) +return 0 +;; + +# Dirnames options. +-O) +_filedir -d +return 0 +;; + +# Filenames options. +-o) +#_longopt $filenames +_filedir +return 0 +;; + +# Exit options. +-h|-\?|-V) +COMPREPLY=() +return 0 +;; + +esac + +if [[ "$cur" = -* ]]; then + COMPREPLY=( $(compgen -W "$options" -- $cur) ) + return 0 +else + _filedir + return 0 +fi +} + +[ "$have" ] && complete -F _lrzip $filenames lrzip + +: From 00700c1d42c704b846f71ec2412988cca94f958d Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 16 Sep 2011 21:14:21 +1000 Subject: [PATCH 3/5] Change permission and owner warning to verbose logging only instead of error. --- lrzip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lrzip.c b/lrzip.c index b1d5a4b..675b937 100644 --- a/lrzip.c +++ b/lrzip.c @@ -204,11 +204,11 @@ void preserve_perms(rzip_control *control, int fd_in, int fd_out) if (unlikely(fstat(fd_in, &st))) fatal("Failed to fstat input file\n"); if (unlikely(fchmod(fd_out, (st.st_mode & 0666)))) - print_err("Warning, unable to set permissions on %s\n", control->outfile); + print_verbose("Warning, unable to set permissions on %s\n", control->outfile); /* chown fail is not fatal */ if (unlikely(fchown(fd_out, st.st_uid, st.st_gid))) - print_err("Warning, unable to set owner on %s\n", control->outfile); + print_verbose("Warning, unable to set owner on %s\n", control->outfile); } /* Open a temporary outputfile to emulate stdout */ From a62044d16678616893d0c3be4e258acf5cd064c0 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 16 Sep 2011 22:13:31 +1000 Subject: [PATCH 4/5] Update docs. --- ChangeLog | 9 +++++++++ WHATS-NEW | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0738500..2bc2056 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,13 @@ lrzip ChangeLog +SEPTEMBER 2011, version 0.607 Con Kolivas +* Updated lzma library to version 920. +* Fixed a rare unable-to-decompress corner case. +* Added lrzip completion script. +* Updated makefile to more portable posix version. +* Hopefully fixed compilation on FreeBSD not supporting memopen. +* Added lots more debugging information about offsets in max verbose mode. +* Removed error and warning messages that are spammy or harmless. + MAY 2011, version 0.606 Con Kolivas * lrzuntar broke as lrzip doesn't automatically use stdout now, so use lrzcat in the lrztar script instead. diff --git a/WHATS-NEW b/WHATS-NEW index cb3e22d..b09c30d 100644 --- a/WHATS-NEW +++ b/WHATS-NEW @@ -1,3 +1,12 @@ +lrzip-0.607 + +A rare case of not being able to decompress archives was fixed. +The lzma library was updated to version 920. +A bash completion script for lrzip was added. +More debugging info was added in maximum verbose mode. +Less messages occur without verbose mode. +FreeBSD and posix compilation fixes were committed. + lrzip-0.606 lrzuntar, which broke last version leaving behind an untarred .tar file, is From 761298bae60cb6d6fb53ac6b422a3c16d1986772 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 16 Sep 2011 22:13:57 +1000 Subject: [PATCH 5/5] Bump version to 0.607 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 723c428..b6ff495 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--## m4_define([v_maj], [0]) m4_define([v_min], [6]) -m4_define([v_mic], [06]) +m4_define([v_mic], [07]) ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--## m4_define([v_v], m4_join([], v_min, v_mic)) m4_define([v_ver], [v_maj.v_v])