Init package

This commit is contained in:
dillon chen 2020-07-28 15:51:55 +08:00
parent 926d9f39de
commit 3657af7d38
5 changed files with 236 additions and 0 deletions

BIN
0.5.4.15.tar.gz Normal file

Binary file not shown.

25
debian-bug-959914.patch Normal file
View File

@ -0,0 +1,25 @@
From 080c9316350bc3a72efe3423e20a31a628e89524 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ingo=20Br=C3=BCckl?= <ib@wupperonline.de>
Date: Tue, 2 Jun 2020 13:06:46 +0200
Subject: [PATCH] Handle multi-volume 7zip archives
Replace a sloppy data section detection with a more robust one.
This fixes github issue #92, reported by apoleon.
---
src/7zip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/7zip.c b/src/7zip.c
index 091a19aa..1d5f2e59 100644
--- a/src/7zip.c
+++ b/src/7zip.c
@@ -213,7 +213,7 @@ static void xa_7zip_parse_output (gchar *line, XArchive *archive)
archive->has_password = TRUE;
}
- if ((line[0] == '-') && line[3])
+ if (strncmp(line, "-----", 5) == 0)
{
data_line = TRUE;
return;

View File

@ -0,0 +1,35 @@
From a357525312112491b2cefc144a6d5853db9f1a4e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ingo=20Br=C3=BCckl?= <ib@wupperonline.de>
Date: Wed, 17 Jun 2020 13:34:06 +0200
Subject: [PATCH] Add xa_7zip_seek_position()
This will allow going through volumes later on.
---
src/7zip.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/7zip.c b/src/7zip.c
index 1d5f2e59..54ceb956 100644
--- a/src/7zip.c
+++ b/src/7zip.c
@@ -29,6 +29,11 @@
static gboolean data_line, encrypted, last_line;
+static void xa_7zip_seek_position (GIOChannel *file, gint64 offset, GSeekType type)
+{
+ g_io_channel_seek_position(file, offset, type, NULL);
+}
+
static void xa_7zip_uint64_skip (GIOChannel *file)
{
gchar first, byte;
@@ -85,7 +90,7 @@ gboolean is7zip_mhe (const gchar *filename)
}
/* skip next header size and CRC32 */
- g_io_channel_seek_position(file, 12 + offset, G_SEEK_CUR, NULL);
+ xa_7zip_seek_position(file, 12 + offset, G_SEEK_CUR);
/* header info */
g_io_channel_read_chars(file, &byte, sizeof(byte), NULL, NULL);

View File

@ -0,0 +1,112 @@
From 62249180ee80494fc74ea3731af9bd52a78d1e02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ingo=20Br=C3=BCckl?= <ib@wupperonline.de>
Date: Wed, 17 Jun 2020 21:40:59 +0200
Subject: [PATCH] Handle header encrypted multi-volume 7zip archives
Keep skipping volumes until the offset is reached and proceed
with is7zip_mhe() to detect header encryption as before.
This fixes github issue #92, reported by Ski-lleR.
---
src/7zip.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 63 insertions(+), 3 deletions(-)
diff --git a/src/7zip.c b/src/7zip.c
index 54ceb956..71bba0cd 100644
--- a/src/7zip.c
+++ b/src/7zip.c
@@ -17,6 +17,7 @@
*/
#include <string.h>
+#include <glib/gstdio.h>
#include "7zip.h"
#include "gzip_et_al.h"
#include "interface.h"
@@ -29,9 +30,67 @@
static gboolean data_line, encrypted, last_line;
-static void xa_7zip_seek_position (GIOChannel *file, gint64 offset, GSeekType type)
+static void xa_7zip_seek_position (const gchar *filename, GIOChannel **file, gint64 offset, GSeekType type)
{
- g_io_channel_seek_position(file, offset, type, NULL);
+ gchar byte;
+
+ g_io_channel_seek_position(*file, offset, type, NULL);
+
+ /* check whether it's a volume. i.e. whether offset is beyond the end of the file */
+ if (g_io_channel_read_chars(*file, &byte, sizeof(byte), NULL, NULL) == G_IO_STATUS_NORMAL)
+ /* doesn't seem so - back to requested position */
+ g_io_channel_seek_position(*file, -(gint64) sizeof(byte), G_SEEK_CUR, NULL);
+ else /* find the volume the offset is pointing to */
+ {
+ guint64 position, volsizes = 0;
+ gchar *fvname;
+ size_t ext;
+ guint i;
+ GStatBuf st;
+ GIOChannel *fnew;
+
+ if (!g_str_has_suffix(filename, ".001"))
+ return;
+
+ position = 12 + 8 + (guint64) offset; // absolute position
+
+ fvname = g_strdup(filename);
+ ext = strlen(fvname) - 4;
+
+ /* check volumes ... */
+ for (i = 1; i < 1000; i++)
+ {
+ fvname[ext] = 0;
+ sprintf(fvname, "%s.%03u", fvname, i);
+
+ if (!g_file_test(fvname, G_FILE_TEST_EXISTS) || (g_stat(fvname, &st) != 0))
+ break;
+
+ volsizes += (guint64) st.st_size;
+
+ /* ... up to the one we're looking for */
+ if (volsizes > position)
+ {
+ fnew = g_io_channel_new_file(fvname, "r", NULL);
+
+ if (!fnew)
+ break;
+
+ /* switch to volume */
+
+ g_io_channel_shutdown(*file, FALSE, NULL);
+
+ *file = fnew;
+
+ g_io_channel_set_encoding(*file, NULL, NULL);
+ g_io_channel_seek_position(*file, position - (volsizes - (guint64) st.st_size), G_SEEK_SET, NULL);
+
+ break;
+ }
+ }
+
+ g_free(fvname);
+ }
}
static void xa_7zip_uint64_skip (GIOChannel *file)
@@ -78,6 +137,7 @@ gboolean is7zip_mhe (const gchar *filename)
if (file)
{
g_io_channel_set_encoding(file, NULL, NULL);
+ g_io_channel_set_buffered(file, FALSE);
/* skip signature, version and header CRC32 */
g_io_channel_seek_position(file, 12, G_SEEK_SET, NULL);
@@ -90,7 +150,7 @@ gboolean is7zip_mhe (const gchar *filename)
}
/* skip next header size and CRC32 */
- xa_7zip_seek_position(file, 12 + offset, G_SEEK_CUR);
+ xa_7zip_seek_position(filename, &file, 12 + offset, G_SEEK_CUR);
/* header info */
g_io_channel_read_chars(file, &byte, sizeof(byte), NULL, NULL);

64
xarchiver.spec Normal file
View File

@ -0,0 +1,64 @@
Name: xarchiver
Version: 0.5.4.15
Release: 1
Summary: Archive manager for Xfce
License: GPLv2+
#Group: Development/Libraries
URL: https://github.com/ib/xarchiver
Source0: https://github.com/ib/xarchiver/archive/%{version}.tar.gz
Patch1: debian-bug-959914.patch
Patch2: debian-bug-959914_part2.patch
Patch3: debian-bug-959914_part3.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
#BuildArch: noarch
BuildRequires: gtk2-devel, libxml2-devel, gettext, desktop-file-utils
BuildRequires: xfce4-dev-tools >= 4.3.90.2
BuildRequires: autoconf >= 2.69
BuildRequires: libtool
BuildRequires: automake
BuildRequires: intltool
%description
Xarchiver is a lightweight desktop independent GTK+ frontend for manipulating
xz, 7z, lzma, arj, bzip2, gzip, rar, tar, zip, rpm, lz4, compress, zstd, lzip,
lrzip, lzop, lha, ar files including the deb format and self-extracting
exe files, if they were internally compressed with either 7zip, arj, lha, rar
or zip. Multi-threading tools such as lbzip2, pbzip2, pigz and plzip can be
used as replacements for their respective counterparts.
Xarchiver allows you to create archives and add, extract, and delete files
from them. Password protected archives in the arj, 7z, rar, zip and lrzip
formats are supported.
%prep
%autosetup -p1
%build
./autogen.sh
%configure
%make_build
%install
make install DESTDIR=%{buildroot} INSTALL="install -p"
%find_lang %{name}
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop
# remove duplicate docs
rm %{buildroot}%{_docdir}/%{name}/{COPYING,ChangeLog,README}
%files -f %{name}.lang
%doc COPYING ChangeLog README
%doc %{_docdir}/%{name}/
%{_bindir}/%{name}
%{_datadir}/applications/*%{name}.desktop
%{_datadir}/icons/hicolor/*/*/*
%{_datadir}/pixmaps/%{name}/
%{_libexecdir}/thunar-archive-plugin/
%{_mandir}/man1/%{name}.1*
%changelog
* Mon Jul 27 2020 Dillon Chen <dillon.chen@turbolinux.com.cn> - 0.5.4.15-1
- Init package