Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package avfs for openSUSE:Factory checked in at 2023-03-08 14:54:12 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/avfs (Old) and /work/SRC/openSUSE:Factory/.avfs.new.31432 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "avfs" Wed Mar 8 14:54:12 2023 rev:10 rq:1070163 version:1.1.5 Changes: -------- --- /work/SRC/openSUSE:Factory/avfs/avfs.changes 2021-06-01 10:37:58.468865422 +0200 +++ /work/SRC/openSUSE:Factory/.avfs.new.31432/avfs.changes 2023-03-08 14:54:12.883212569 +0100 @@ -1,0 +2,10 @@ +Tue Mar 7 19:57:08 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 1.1.5: + * added support for ls output with SElinux attributes. + * improved handling of xz memory limit to allow detecting + when the limit is reached and to increase it on demand. + * added basic decoding of tar's extended headers to support + longer file names. + +------------------------------------------------------------------- Old: ---- avfs-1.1.4.tar.bz2 avfs-1.1.4.tar.bz2.asc New: ---- avfs-1.1.5.tar.bz2 avfs-1.1.5.tar.bz2.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ avfs.spec ++++++ --- /var/tmp/diff_new_pack.2WElyz/_old 2023-03-08 14:54:13.395215357 +0100 +++ /var/tmp/diff_new_pack.2WElyz/_new 2023-03-08 14:54:13.399215379 +0100 @@ -1,7 +1,7 @@ # # spec file for package avfs # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: avfs -Version: 1.1.4 +Version: 1.1.5 Release: 0 Summary: AVFS - an archive look-inside filesystem License: GPL-2.0-or-later AND LGPL-2.1-or-later ++++++ avfs-1.1.4.tar.bz2 -> avfs-1.1.5.tar.bz2 ++++++ ++++ 17332 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/avfs-1.1.4/ChangeLog new/avfs-1.1.5/ChangeLog --- old/avfs-1.1.4/ChangeLog 2021-04-04 15:41:21.000000000 +0200 +++ new/avfs-1.1.5/ChangeLog 2023-02-18 19:03:03.000000000 +0100 @@ -1,3 +1,23 @@ +2023-02-18 Ralf Hoffmann <r...@boomerangsworld.de> + + * bump version to 1.1.5 + +2023-01-29 Ralf Hoffmann <r...@boomerangsworld.de> + + * utar: add basic decoding of extended headers to support longer + file names + +2022-08-24 Ralf Hoffmann <r...@boomerangsworld.de> + + * xz: improve handling of xz memory limit. The error code + indicates when the limit has been reached, special file + xz_memlimit in #avfsstat/ allows to get/set current limit + +2021-04-17 Ralf Hoffmann <r...@boomerangsworld.de> + + * add support for ls output with SElinux attributes + (patch from Bert Cosemans) + 2021-04-04 Ralf Hoffmann <r...@boomerangsworld.de> * add support for lzip (ulzip module for .lz files) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/avfs-1.1.4/INSTALL new/avfs-1.1.5/INSTALL --- old/avfs-1.1.4/INSTALL 2021-04-04 15:41:31.000000000 +0200 +++ new/avfs-1.1.5/INSTALL 2023-02-18 19:03:11.000000000 +0100 @@ -1,8 +1,8 @@ Installation Instructions ************************* - Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software -Foundation, Inc. + Copyright (C) 1994-1996, 1999-2002, 2004-2017, 2020-2021 Free +Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright @@ -225,7 +225,7 @@ and if that doesn't work, install pre-built binaries of GCC for HP-UX. - HP-UX 'make' updates targets which have the same time stamps as their + HP-UX 'make' updates targets which have the same timestamps as their prerequisites, which makes it generally unusable when shipped generated files such as 'configure' are involved. Use GNU 'make' instead. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/avfs-1.1.4/NEWS new/avfs-1.1.5/NEWS --- old/avfs-1.1.4/NEWS 2021-04-04 15:41:21.000000000 +0200 +++ new/avfs-1.1.5/NEWS 2023-02-18 19:03:03.000000000 +0100 @@ -1,3 +1,10 @@ +Changes from 1.1.4 to 1.1.5 (2023-02-18) + - added support for ls output with SElinux attributes. + - improved handling of xz memory limit to allow detecting when the + limit is reached and to increase it on demand. + - added basic decoding of tar's extended headers to support longer + file names. + Changes from 1.1.3 to 1.1.4 (2021-04-04) - add support for lzip diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/avfs-1.1.4/README new/avfs-1.1.5/README --- old/avfs-1.1.4/README 2021-04-04 15:41:21.000000000 +0200 +++ new/avfs-1.1.5/README 2023-02-18 19:03:03.000000000 +0100 @@ -197,6 +197,16 @@ #uzoo zoo archives +Special #avfsstat files +----------------------- + +symlink_rewrite: write '1' to it to let it change absolute + symlinks to relative ones +xz_memlimit: the amount of bytes used for xz decoder +xz_memlimit_hit: the number of occurrences the xz decoder hit + its memory limit + + Writing new modules ------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/avfs-1.1.4/compile new/avfs-1.1.5/compile --- old/avfs-1.1.4/compile 2021-04-04 15:41:31.000000000 +0200 +++ new/avfs-1.1.5/compile 2023-02-18 19:03:11.000000000 +0100 @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey <tro...@cygnus.com>. # # This program is free software; you can redistribute it and/or modify diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/avfs-1.1.4/config.h.in new/avfs-1.1.5/config.h.in --- old/avfs-1.1.4/config.h.in 2021-04-04 15:41:30.000000000 +0200 +++ new/avfs-1.1.5/config.h.in 2023-02-18 19:03:11.000000000 +0100 @@ -24,9 +24,18 @@ /* Define to 1 if you have the `getpwuid_r' function. */ #undef HAVE_GETPWUID_R +/* Define to 1 if you have the `iconv' function. */ +#undef HAVE_ICONV + +/* Define to 1 if you have the <iconv.h> header file. */ +#undef HAVE_ICONV_H + /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the <langinfo.h> header file. */ +#undef HAVE_LANGINFO_H + /* Define to 1 if you have the `dl' library (-ldl). */ #undef HAVE_LIBDL @@ -51,15 +60,18 @@ /* Define to 1 if you have the <lzlib.h> header file. */ #undef HAVE_LZLIB_H -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - /* Define to 1 if you have the `mkdtemp' function. */ #undef HAVE_MKDTEMP +/* Define to 1 if you have the `nl_langinfo' function. */ +#undef HAVE_NL_LANGINFO + /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H +/* Define to 1 if you have the <stdio.h> header file. */ +#undef HAVE_STDIO_H + /* Define to 1 if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H @@ -122,7 +134,9 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* Define to 1 if you have the ANSI C header files. */ +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Define if you want to use system bzlib library */ @@ -134,11 +148,6 @@ /* Version number of package */ #undef VERSION -/* Enable large inode numbers on Mac OS X 10.5. */ -#ifndef _DARWIN_USE_64_BIT_INODE -# define _DARWIN_USE_64_BIT_INODE 1 -#endif - /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/avfs-1.1.4/configure.ac new/avfs-1.1.5/configure.ac --- old/avfs-1.1.4/configure.ac 2021-04-04 15:41:21.000000000 +0200 +++ new/avfs-1.1.5/configure.ac 2023-02-18 19:03:03.000000000 +0100 @@ -2,7 +2,7 @@ define(AVFS_MAJOR,[1]) define(AVFS_MINOR,[1]) -define(AVFS_PATCH,[4]) +define(AVFS_PATCH,[5]) define(AVFS_COMMENT,[]) define(AVFS_VERSION,AVFS_MAJOR[.]AVFS_MINOR[.]AVFS_PATCH[]AVFS_COMMENT) @@ -247,6 +247,11 @@ LIBDAV= fi +AC_CHECK_HEADERS(iconv.h) +AC_CHECK_HEADERS(langinfo.h) +AC_CHECK_FUNCS(iconv) +AC_CHECK_FUNCS(nl_langinfo) + AM_CONDITIONAL(BUILD_DAVSUPPORT, test x$neon_found = xyes) AC_SUBST(DAV) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/avfs-1.1.4/include/xzfile.h new/avfs-1.1.5/include/xzfile.h --- old/avfs-1.1.4/include/xzfile.h 2021-04-04 15:41:21.000000000 +0200 +++ new/avfs-1.1.5/include/xzfile.h 2023-02-18 19:03:03.000000000 +0100 @@ -1,6 +1,6 @@ /* AVFS: A Virtual File System Library - Copyright (C) 2010 Ralf Hoffmann <r...@boomerangsworld.de> + Copyright (C) 2010-2022 Ralf Hoffmann <r...@boomerangsworld.de> This program can be distributed under the terms of the GNU GPL. See the file COPYING. @@ -10,6 +10,7 @@ #include "avfs.h" +#include <inttypes.h> struct xzfile; struct xzcache; @@ -20,3 +21,6 @@ struct xzfile *av_xzfile_new(vfile *vf); int av_xzfile_size(struct xzfile *fil, struct xzcache *zc, avoff_t *sizep); struct xzcache *av_xzcache_new(); +int av_xzfile_set_memlimit(uint64_t new_limit); +uint64_t av_xzfile_get_memlimit(); +uint64_t av_xzfile_get_memlimit_hit(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/avfs-1.1.4/missing new/avfs-1.1.5/missing --- old/avfs-1.1.4/missing 2021-04-04 15:41:31.000000000 +0200 +++ new/avfs-1.1.5/missing 2023-02-18 19:03:11.000000000 +0100 @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard <pin...@iro.umontreal.ca>, 1996. # This program is free software; you can redistribute it and/or modify diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/avfs-1.1.4/modules/utar.c new/avfs-1.1.5/modules/utar.c --- old/avfs-1.1.4/modules/utar.c 2021-04-04 15:41:21.000000000 +0200 +++ new/avfs-1.1.5/modules/utar.c 2023-02-18 19:03:03.000000000 +0100 @@ -1,7 +1,7 @@ /* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi <mik...@szeredi.hu> - Copyright (C) 2007,2013 Ralf Hoffmann (r...@boomerangsworld.de) + Copyright (C) 2007,2013,2023 Ralf Hoffmann (r...@boomerangsworld.de) Based on the GNU tar sources (C) Free Software Foundation @@ -11,12 +11,21 @@ TAR module */ +#include "config.h" #include "gtar.h" #include "archive.h" #include "oper.h" #include "ugid.h" #include "version.h" #include <limits.h> +#include <inttypes.h> + +#ifdef HAVE_ICONV_H +# include <iconv.h> +#endif +#ifdef HAVE_LANGINFO_H +# include <langinfo.h> +#endif #define COPYBUFSIZE 16384 #define BIGBLOCKSIZE (20 * BLOCKSIZE) @@ -29,6 +38,15 @@ /* FIXME: Not any more: inode udata is used for saving filenames temporarily at archive creation */ +struct xheader_data { + char *path; + char *linkname; + + avoff_t size; + + unsigned short size_set:1; +}; + struct tar_entinfo { char *name; char *linkname; @@ -36,6 +54,8 @@ avoff_t datastart; union block header; + + struct xheader_data xhdr; }; struct sp_array @@ -59,6 +79,52 @@ #define ISSPACE(x) isspace(x) #define ISODIGIT(x) ((x) >= '0' && (x) < '8') +static struct { +#if defined(HAVE_NL_LANGINFO) && defined(HAVE_ICONV) + iconv_t iconv_handle; +#endif + pthread_mutex_t iconv_lock; +} utf8_convert; + +static char *convert_from_utf8(const char *str) +{ + char *res = NULL; + + if (!str) return NULL; + + pthread_mutex_lock(&utf8_convert.iconv_lock); + +#if defined(HAVE_NL_LANGINFO) && defined(HAVE_ICONV) + if (utf8_convert.iconv_handle == (iconv_t)-1) { + res = av_strdup(str); + } else { + avoff_t maxlength = strlen(str) * MB_LEN_MAX + 1; + res = av_malloc(maxlength); + + if (res) { + char *in_str = (char *)str; + char *out_str = res; + size_t in_len = strlen(str); + size_t out_len = maxlength - 1; + if (iconv(utf8_convert.iconv_handle, + &in_str, &in_len, + &out_str, &out_len) != 0) { + av_free(res); + res = NULL; + } else { + res[maxlength - 1 - out_len] = '\0'; + } + } + } +#else + res = av_strdup(str); +#endif + + pthread_mutex_unlock(&utf8_convert.iconv_lock); + + return res; +} + /*------------------------------------------------------------------------. | Quick and dirty octal conversion. Result is -1 if the field is invalid | | (all blank, or nonoctal). | @@ -277,6 +343,164 @@ return f; } +struct xheader +{ + avoff_t size; + char *buffer; +}; + +static int xheader_read(vfile *vf, + struct xheader *xhdr, + union block *header, + avoff_t size) +{ + size_t j = 0; + union block data_block = *header; + + if (size < 0) { + size = 0; + } + + size += BLOCKSIZE; + xhdr->size = size; + xhdr->buffer = av_malloc(size + 1); + xhdr->buffer[size] = '\0'; + + do { + size_t len = size; + + if (len > BLOCKSIZE) { + len = BLOCKSIZE; + } + + memcpy(&xhdr->buffer[j], data_block.buffer, len); + + j += len; + size -= len; + + if (size > 0) { + int res = get_next_block(vf, &data_block); + if (res < 0) { + return res; + } + } + } while (size > 0); + + return 0; +} + +static void record_handler(struct xheader_data *xdata, + char const *keyword, + char const *value, + size_t value_size) +{ + if (strcmp(keyword, "path") == 0) { + char *path = convert_from_utf8(value); + + if (path) { + if (xdata->path) { + av_free(xdata->path); + } + xdata->path = path; + } + } else if (strcmp(keyword, "size") == 0) { + uintmax_t v = strtoumax(value, NULL, 10); + + if (v != UINTMAX_MAX) { + xdata->size_set = 1; + xdata->size = v; + } + } else if (strcmp(keyword, "linkpath") == 0) { + char *path = convert_from_utf8(value); + + if (path) { + if (xdata->linkname) { + av_free(xdata->linkname); + } + xdata->linkname = path; + } + } else { + //av_log(AVLOG_WARNING, "Unhandled tar extended header field %s", keyword); + } +} + +static int decode_record(struct xheader *xhdr, + char **ptr, + struct xheader_data *xdata) +{ + char *record_start = *ptr; + char *cur = record_start; + avoff_t len; + char *endptr; + const char *keyword; + char *next_record; + const avoff_t remaining_length = xhdr->buffer + xhdr->size - record_start; + + /* record is text based, first length, separated by whitespace + from keyword string, equal sign, value string, must end with + newline */ + + for (; isblank(*cur); cur++) {} + + if (!isdigit(*cur)) { + // check for regular end + if (*cur != '\0') { + av_log(AVLOG_WARNING, "Malformed extended header: missing length"); + } + return -EINVAL; + } + + len = strtoumax(cur, &endptr, 10); + + if (len < 3 || len > remaining_length) { + av_log(AVLOG_WARNING, "Extended header length is out of range"); + return -EINVAL; + } + + next_record = record_start + len; + + cur = endptr; + for (; isblank(*cur); cur++) {} + + if (cur == endptr) { + av_log(AVLOG_WARNING, "Malformed extended header: missing blank after length"); + return -EINVAL; + } + + keyword = cur; + cur = memchr(cur, '=', next_record - cur); + if (!cur) { + av_log(AVLOG_WARNING, "Malformed extended header: missing equal sign"); + return -EINVAL; + } + + if (next_record[-1] != '\n') { + av_log(AVLOG_WARNING, "Malformed extended header: missing newline"); + return -EINVAL; + } + + *cur = '\0'; + next_record[-1] = '\0'; + + record_handler(xdata, keyword, cur + 1, next_record - cur - 2); + + *cur = '='; + next_record[-1] = '\n'; + + *ptr = next_record; + return 0; +} + +static void xheader_decode(struct xheader *xhdr, + struct xheader_data *xdata) +{ + char *data = xhdr->buffer + BLOCKSIZE; + + while (decode_record(xhdr, &data, xdata) == 0) { + continue; + } +} + /* return values: < 0: fatal, 0 eof, 1 bad header, 2 OK */ static int read_entry(vfile *vf, struct tar_entinfo *tinf) { @@ -294,6 +518,10 @@ char *next_long_name = NULL, *next_long_link = NULL; union block *header = &tinf->header; + // clear xhdr field as such a header may or may not appear so we + // can detect occurance of additional info + memset(&tinf->xhdr, 0, sizeof(tinf->xhdr)); + while (1) { res = find_next_block(vf, header); @@ -375,8 +603,17 @@ } if(res < 0) break; } else if (header->header.typeflag == XHDTYPE) { - /* just ignore/skip for the moment - * look for details in GNU tar/list.c/read_header */ + /* basic parsing for long names. + * look for details in GNU tar/src/xheader.c */ + struct xheader xhdr; + if (xheader_read(vf, &xhdr, header, + tinf->size) < 0) { + av_free(xhdr.buffer); + break; + } + xheader_decode(&xhdr, + &tinf->xhdr); + av_free(xhdr.buffer); } else if (header->header.typeflag == XGLTYPE) { /* just ignore/skip for the moment */ } @@ -426,13 +663,19 @@ } /* NOTE: header->header.name is not necessarily null-terminated */ - if ( next_long_name ) { + if (tinf->xhdr.path) { + tinf->name = tinf->xhdr.path; + tinf->xhdr.path = NULL; + } else if ( next_long_name ) { tinf->name = av_strdup (next_long_name); } else { tinf->name = av_strndup( header->header.name, NAME_FIELD_SIZE ); } - if ( next_long_link ) { + if (tinf->xhdr.linkname) { + tinf->linkname = tinf->xhdr.linkname; + tinf->xhdr.linkname = NULL; + } else if ( next_long_link ) { tinf->linkname = av_strdup (next_long_link); } else { tinf->linkname = av_strndup( header->header.linkname, NAME_FIELD_SIZE ); @@ -729,9 +972,16 @@ av_default_stat(&tarstat); decode_header(&tinf.header, &tarstat, &format, cache); + // overwrite info from xhdr + if (tinf.xhdr.size_set) { + tarstat.size = tinf.xhdr.size; + } + insert_tarentry(arch, &tinf, &tarstat); av_free(tinf.name); av_free(tinf.linkname); + av_free(tinf.xhdr.path); + av_free(tinf.xhdr.linkname); } return 0; @@ -1354,6 +1604,11 @@ struct ext_info tarexts[2]; struct archparams *ap; + pthread_mutex_init(&utf8_convert.iconv_lock, NULL); +#if defined(HAVE_NL_LANGINFO) && defined(HAVE_ICONV) + utf8_convert.iconv_handle = iconv_open(nl_langinfo(CODESET), "UTF-8"); +#endif + tarexts[0].from = ".tar", tarexts[0].to = NULL; tarexts[1].from = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/avfs-1.1.4/modules/uxz.c new/avfs-1.1.5/modules/uxz.c --- old/avfs-1.1.4/modules/uxz.c 2021-04-04 15:41:21.000000000 +0200 +++ new/avfs-1.1.5/modules/uxz.c 2023-02-18 19:03:03.000000000 +0100 @@ -14,6 +14,9 @@ #include "filecache.h" #include "oper.h" #include "version.h" +#include "internal.h" +#include <stdio.h> +#include <stdlib.h> struct xznode { struct avstat sig; @@ -227,11 +230,60 @@ extern int av_init_module_uxz(struct vmodule *module); +static int xz_memlimit_get(struct entry *ent, const char *param, char **retp) +{ + char buf[32]; + + snprintf(buf, sizeof(buf), "%lu\n", av_xzfile_get_memlimit()); + + *retp = av_strdup(buf); + return 0; +} + +static int xz_memlimit_set(struct entry *ent, const char *param, const char *val) +{ + avoff_t offval; + char *end; + + if (!val[0]) { + offval = 0; + } else { + offval = strtoll(val, &end, 0); + if (end == val) { + return -EINVAL; + } + if (*end == '\n') { + end ++; + } + if (*end != '\0') { + return -EINVAL; + } + if (offval < 0) { + return -EINVAL; + } + } + + av_xzfile_set_memlimit(offval); + + return 0; +} + +static int xz_memlimit_hit_get(struct entry *ent, const char *param, char **retp) +{ + char buf[32]; + + snprintf(buf, sizeof(buf), "%lu\n", av_xzfile_get_memlimit_hit()); + + *retp = av_strdup(buf); + return 0; +} + int av_init_module_uxz(struct vmodule *module) { int res; struct avfs *avfs; struct ext_info uxz_exts[5]; + struct statefile statf = { 0 }; uxz_exts[0].from = ".tar.xz", uxz_exts[0].to = ".tar"; uxz_exts[1].from = ".txz", uxz_exts[1].to = ".tar"; @@ -252,5 +304,13 @@ av_add_avfs(avfs); + statf.get = xz_memlimit_get; + statf.set = xz_memlimit_set; + av_avfsstat_register("xz_memlimit", &statf); + + statf.get = xz_memlimit_hit_get; + statf.set = NULL; + av_avfsstat_register("xz_memlimit_hit", &statf); + return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/avfs-1.1.4/scripts/mountavfs new/avfs-1.1.5/scripts/mountavfs --- old/avfs-1.1.4/scripts/mountavfs 2021-04-04 15:41:21.000000000 +0200 +++ new/avfs-1.1.5/scripts/mountavfs 2023-02-18 19:03:03.000000000 +0100 @@ -4,27 +4,30 @@ # companion program to umountavfs # will check to see if avfs is mounted and then # load the avfsd daemon which will mount avfs. -# last updated 2010-09-12 +# +# you can source this file in the login script to automatically make +# AVFS available. The base directory mount point is exported as +# AVFSBASE. +# -# suggested use: in a login script or wm startup routine - -if [ -d "$AVFSBASE" ]; then - MntDir="$AVFSBASE" -else - MntDir=${HOME}/.avfs +# if unset or not pointing to a directory, revert to default mount point +if [ ! -d "$AVFSBASE" ]; then + AVFSBASE="${HOME}/.avfs" fi -grep -qE "avfsd ${MntDir}" /proc/mounts || { - if [ ! -e "$MntDir" ]; then - mkdir -p "$MntDir" +grep -qE "avfsd ${AVFSBASE}" /proc/mounts || { + if [ ! -e "$AVFSBASE" ]; then + mkdir -p "$AVFSBASE" fi - if [ ! -d "$MntDir" ]; then - echo "$MntDir exists but is no directory" + if [ ! -d "$AVFSBASE" ]; then + echo "$AVFSBASE exists but is no directory" exit 1 fi - echo Mounting AVFS on $MntDir... - avfsd "$MntDir" - while test ! -e "$MntDir/#avfsstat/symlink_rewrite" + echo Mounting AVFS on $AVFSBASE... + avfsd "$AVFSBASE" + while test ! -e "$AVFSBASE/#avfsstat/symlink_rewrite" do sleep 0.5 ; done - echo "1" >| "$MntDir/#avfsstat/symlink_rewrite" + echo "1" >| "$AVFSBASE/#avfsstat/symlink_rewrite" + + export AVFSBASE } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/avfs-1.1.4/scripts/umountavfs new/avfs-1.1.5/scripts/umountavfs --- old/avfs-1.1.4/scripts/umountavfs 2021-04-04 15:41:21.000000000 +0200 +++ new/avfs-1.1.5/scripts/umountavfs 2023-02-18 19:03:03.000000000 +0100 @@ -4,21 +4,21 @@ # companion program to mountavfs # will check to see if avfsd is mounted and then # unmount using fusermount. -# last updated 2010-09-12 # suggested use: in a logout script or wm exit routine -if [ -d "$AVFSBASE" ]; then - MntDir="$AVFSBASE" -else - MntDir="${HOME}/.avfs" +# if unset or not pointing to a directory, revert to default mount point +if [ ! -d "$AVFSBASE" ]; then + AVFSBASE="${HOME}/.avfs" fi -grep -qE "${MntDir}.*avfsd" /proc/mounts && { - echo unMounting AVFS on $MntDir... +grep -qE "avfsd ${AVFSBASE}" /proc/mounts && { + echo unMounting AVFS on $AVFSBASE... if type -p fusermount > /dev/null 2>&1 ; then - fusermount -u -z "$MntDir" + fusermount -u -z "$AVFSBASE" else - umount -l "$MntDir" + umount -l "$AVFSBASE" fi + + unset AVFSBASE } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/avfs-1.1.4/src/parse.c new/avfs-1.1.5/src/parse.c --- old/avfs-1.1.4/src/parse.c 2021-04-04 15:41:21.000000000 +0200 +++ new/avfs-1.1.5/src/parse.c 2023-02-18 19:03:03.000000000 +0100 @@ -824,7 +824,10 @@ /* no ventry so force localfile to be able to create files with the magic character inside filename */ - if(res < 0) { + + /* only if we got explicit NOENT error, for other errors assume + some handler tried to handle it but failed to some reason */ + if(res == -ENOENT) { av_free(copypath); copypath = av_strdup(path); av_free_ventry(ps.ve); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/avfs-1.1.4/src/parsels.c new/avfs-1.1.5/src/parsels.c --- old/avfs-1.1.4/src/parsels.c 2021-04-04 15:41:21.000000000 +0200 +++ new/avfs-1.1.5/src/parsels.c 2023-02-18 19:03:03.000000000 +0100 @@ -488,6 +488,9 @@ /* This is for an extra ACL attribute (HP-UX) */ if (*line == '+') line++; + /* This is for an extra SElinux attribute */ + if (*line == '.') + line++; } p_copy = av_strdup(line); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/avfs-1.1.4/src/xzread.c new/avfs-1.1.5/src/xzread.c --- old/avfs-1.1.4/src/xzread.c 2021-04-04 15:41:21.000000000 +0200 +++ new/avfs-1.1.5/src/xzread.c 2023-02-18 19:03:03.000000000 +0100 @@ -33,6 +33,8 @@ static struct xzstreamcache xzscache; static int xzread_nextid; static AV_LOCK_DECL(xzread_lock); +static uint64_t xz_memlimit = INITIAL_MEMLIMIT; +static uint64_t xz_memlimit_hit = 0; struct xzcache { int id; @@ -83,7 +85,7 @@ *s = tmp; /* TODO: choose good memory limit */ - res = lzma_auto_decoder(s, INITIAL_MEMLIMIT, 0); + res = lzma_auto_decoder(s, xz_memlimit, 0); if(res != LZMA_OK) { *resp = NULL; av_log(AVLOG_ERROR, "XZ: decompress init error: %i", res); @@ -178,7 +180,12 @@ AV_UNLOCK(xzread_lock); return 0; } - /*TODO handle LZMA_MEMLIMIT_ERROR */ + if (res == LZMA_MEMLIMIT_ERROR) { + av_log(AVLOG_ERROR, "XZ: memlimit error: %lu\n", lzma_memusage(fil->s)); + __atomic_fetch_add(&xz_memlimit_hit, 1, __ATOMIC_RELAXED); + return -ENOMEM; + } + if(res != LZMA_OK) { av_log(AVLOG_ERROR, "XZ: decompress error: %i", res); return -EIO; @@ -358,3 +365,20 @@ return zc; } + +int av_xzfile_set_memlimit(uint64_t new_limit) +{ + xz_memlimit = new_limit; + + return 0; +} + +uint64_t av_xzfile_get_memlimit() +{ + return xz_memlimit; +} + +uint64_t av_xzfile_get_memlimit_hit() +{ + return xz_memlimit_hit; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/avfs-1.1.4/test/testread.c new/avfs-1.1.5/test/testread.c --- old/avfs-1.1.4/test/testread.c 2021-04-04 15:41:21.000000000 +0200 +++ new/avfs-1.1.5/test/testread.c 2023-02-18 19:03:03.000000000 +0100 @@ -25,7 +25,7 @@ struct stat stat_buf; if ( virt_stat( argv[1], &stat_buf ) != 0 ) { - printf( "Could not stat %s\n", argv[1] ); + printf( "Could not stat %s (%s)\n", argv[1], strerror( errno ) ); } else { printf( "Size: %lu\n", stat_buf.st_size ); } @@ -63,6 +63,8 @@ } virt_close( fd ); + } else { + printf( "Could not open %s (%s)\n", argv[1], strerror( errno ) ); } return 0; }