summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorsteffeno2023-08-05 22:19:22 +0200
committersteffeno2023-08-05 22:19:22 +0200
commitbf0d39f44938bb65906494110f39e44aece99c90 (patch)
tree9396054eb50ad18d5ce01bc16b7eb5266a76d4a5
downloadaur-bf0d39f44938bb65906494110f39e44aece99c90.tar.gz
initial commit
-rw-r--r--.SRCINFO24
-rw-r--r--01-i_dir_acl.patch29
-rw-r--r--02-Fix-undefined-reference-to-makedev.patch30
-rw-r--r--03-Fix-segfault-extent-free.patch15
-rw-r--r--PKGBUILD48
-rw-r--r--workaround.patch51
6 files changed, 197 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..1d711888b031
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,24 @@
+pkgbase = ext4magic-patch-extent-free
+ pkgdesc = Upstream ext4magic-0.3.2 package, patched not to segfault
+ pkgver = 0.3.2
+ pkgrel = 4
+ url = https://sourceforge.net/projects/ext4magic/
+ arch = x86_64
+ license = GPL2
+ depends = bzip2
+ depends = file
+ depends = util-linux
+ depends = e2fsprogs
+ conflicts = ext4magic
+ source = https://sourceforge.net/projects/ext4magic//files/ext4magic-0.3.2.tar.gz
+ source = https://sourceforge.net/projects/ext4magic//files/Patches/workaround.patch
+ source = 01-i_dir_acl.patch
+ source = 02-Fix-undefined-reference-to-makedev.patch
+ source = 03-Fix-segfault-extent-free.patch
+ sha256sums = 8d9c6a594f212aecf4eb5410d277caeaea3adc03d35378257dfd017ef20ea115
+ sha256sums = 89468a7857778bd171490cddfc1f4ce8b8308c46353e8c01998dc054373f5fff
+ sha256sums = 2b5cde2612370f49fa9ed8442c23425499bdcf67aaba442087eb11f1c8b51e06
+ sha256sums = 850378bcee22c9e4888c7ebb77085db29747383e5a272795be18341d4426f2db
+ sha256sums = b8f4660c11c7e91edd85caa848a009b1a11b168cb80dec9cf7f23ac9d90dcdab
+
+pkgname = ext4magic-patch-extent-free
diff --git a/01-i_dir_acl.patch b/01-i_dir_acl.patch
new file mode 100644
index 000000000000..37e9c47510e5
--- /dev/null
+++ b/01-i_dir_acl.patch
@@ -0,0 +1,29 @@
+From: Gokturk Yuksek <gokturk@gentoo.org>
+Subject: [PATCH] src/inode: supersede i_dir_acl with i_size_high
+
+The upstream has removed the macro that defined i_dir_acl as
+i_size_high which causes a build failure with the later versions of
+e2fsprogs. Replace every reference to inode->i_dir_acl with
+inode->i_size_high.
+
+[0] https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/commit/?id=578fcbfd2e61e0b13ce8c7b62804c941d6c1eb8e
+
+--- a/src/inode.c
++++ b/src/inode.c
+@@ -404,14 +404,14 @@
+ fprintf(out,
+ "%sFile ACL: %d Directory ACL: %d Translator: %d\n",
+ prefix,
+- inode->i_file_acl, LINUX_S_ISDIR(inode->i_mode) ? inode->i_dir_acl : 0,
++ inode->i_file_acl, LINUX_S_ISDIR(inode->i_mode) ? inode->i_size_high : 0,
+ inode->osd1.hurd1.h_i_translator);
+ else
+ fprintf(out, "%sFile ACL: %llu Directory ACL: %d\n",
+ prefix,
+ inode->i_file_acl | ((long long)
+ (inode->osd2.linux2.l_i_file_acl_high) << 32),
+- LINUX_S_ISDIR(inode->i_mode) ? inode->i_dir_acl : 0);
++ LINUX_S_ISDIR(inode->i_mode) ? inode->i_size_high : 0);
+ if (os == EXT2_OS_LINUX)
+ fprintf(out, "%sLinks: %d Blockcount: %llu\n",
+ prefix, inode->i_links_count,
diff --git a/02-Fix-undefined-reference-to-makedev.patch b/02-Fix-undefined-reference-to-makedev.patch
new file mode 100644
index 000000000000..d3b4ba4016cc
--- /dev/null
+++ b/02-Fix-undefined-reference-to-makedev.patch
@@ -0,0 +1,30 @@
+From d412778d45774225ff4b36470193a6056ecc03cd Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= <seblu@seblu.net>
+Date: Sun, 11 Nov 2018 14:42:38 +0100
+Subject: [PATCH] Fix undefined reference to `makedev'
+
+Add include to sys/sysmacros.h to fix compilation with gcc 8.2.1
+
+Error:
+gcc -O2 -g -D_FILE_OFFSET_BITS=64 -g -O2 -o ext4magic ext4magic-block.o ext4magic-dir_list.o ext4magic-ext4magic.o ext4magic-extent_db.o ext4magic-file_type.o ext4magic-hard_link_stack.o ext4magic-imap_search.o ext4magic-inode.o ext4magic-journal.o ext4magic-lookup_local.o ext4magic-magic_block_scan.o ext4magic-recover.o ext4magic-ring_buf.o ext4magic-util.o -le2p -luuid -lblkid -lz -lbz2 -lmagic -lext2fs
+/bin/ld: ext4magic-recover.o: in function `recover_file':
+/home/seblu/scm/foss/ext4magic/src/recover.c:478: undefined reference to `makedev'
+---
+ src/recover.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/recover.c b/src/recover.c
+index 41b4aee..30b5d8f 100644
+--- a/src/recover.c
++++ b/src/recover.c
+@@ -24,6 +24,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <utime.h>
++#include <sys/sysmacros.h>
+
+ #ifndef O_LARGEFILE
+ #define O_LARGEFILE 0
+--
+2.19.1
+
diff --git a/03-Fix-segfault-extent-free.patch b/03-Fix-segfault-extent-free.patch
new file mode 100644
index 000000000000..b85bfcc23623
--- /dev/null
+++ b/03-Fix-segfault-extent-free.patch
@@ -0,0 +1,15 @@
+See [0], [1]
+[0] https://bugs.archlinux.org/task/79120?project=1&string=ext4magic
+[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=854497#10
+
+--- a/src/block.c
++++ b/src/block.c
+@@ -699,7 +699,7 @@ errcode_t local_block_iterate3(ext2_fils
+ mark_extent_block(fs, (char*) inode.i_block);
+
+ extent_errout:
+- local_ext2fs_extent_free(handle);
++ ext2fs_extent_free(handle);
+ ret |= BLOCK_ERROR | BLOCK_ABORT;
+ goto errout;
+ }
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..925bb0a33751
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,48 @@
+# Maintainer: steffeno <steffeno dash etc at protonmail dot com>
+
+_pkgname=ext4magic
+pkgname=$_pkgname-patch-extent-free
+pkgver=0.3.2
+pkgrel=4
+pkgdesc="Upstream $_pkgname-$pkgver package, patched not to segfault"
+arch=('x86_64')
+url='https://sourceforge.net/projects/ext4magic/'
+license=('GPL2')
+depends=('bzip2' 'file' 'util-linux' 'e2fsprogs')
+conflicts=($_pkgname)
+source=("$url/files/$_pkgname-$pkgver.tar.gz"
+ "$url/files/Patches/workaround.patch"
+ '01-i_dir_acl.patch'
+ '02-Fix-undefined-reference-to-makedev.patch'
+ '03-Fix-segfault-extent-free.patch')
+sha256sums=('8d9c6a594f212aecf4eb5410d277caeaea3adc03d35378257dfd017ef20ea115'
+ '89468a7857778bd171490cddfc1f4ce8b8308c46353e8c01998dc054373f5fff'
+ '2b5cde2612370f49fa9ed8442c23425499bdcf67aaba442087eb11f1c8b51e06'
+ '850378bcee22c9e4888c7ebb77085db29747383e5a272795be18341d4426f2db'
+ 'b8f4660c11c7e91edd85caa848a009b1a11b168cb80dec9cf7f23ac9d90dcdab')
+
+prepare() {
+ cd $_pkgname-$pkgver
+ # apply patch from the source array (should be a pacman feature)
+ local filename
+ for filename in "${source[@]}"; do
+ if [[ "$filename" =~ \.patch$ ]]; then
+ echo "Applying patch ${filename##*/}"
+ patch -p1 -N -i "$srcdir/${filename##*/}"
+ fi
+ done
+ :
+}
+
+build() {
+ cd $_pkgname-$pkgver
+ ./configure --prefix=/usr --sbindir=/usr/bin
+ make
+}
+
+package() {
+ cd $_pkgname-$pkgver
+ make DESTDIR="$pkgdir" install
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/workaround.patch b/workaround.patch
new file mode 100644
index 000000000000..e639dc3afb4a
--- /dev/null
+++ b/workaround.patch
@@ -0,0 +1,51 @@
+diff -Naur ext4magic-0.3.2/src/block.c ext4magic-0.3.2_new/src/block.c
+--- ext4magic-0.3.2/src/block.c 2014-03-12 01:54:03.000000000 +0100
++++ ext4magic-0.3.2_new/src/block.c 2015-10-18 23:28:47.060000000 +0200
+@@ -130,7 +130,8 @@
+
+
+
+-
++//FIXME : Debian Bug #802089 (temporary work around)
++/*
+ errcode_t local_ext2fs_extent_open(ext2_filsys fs, struct ext2_inode inode,
+ ext2_extent_handle_t *ret_handle) {
+
+@@ -189,7 +190,7 @@
+
+ return 0;
+ }
+-
++*/
+
+ static int mark_extent_block(ext2_filsys fs, char *extent_block ){
+ struct ext3_extent_header *eh;
+@@ -613,7 +614,11 @@
+ int uninit;
+ unsigned int j;
+
+- ctx.errcode = local_ext2fs_extent_open(fs, inode, &handle);
++
++//FIXME : Debian Bug #802089 (temporary work around)
++// ctx.errcode = local_ext2fs_extent_open(fs, inode, &handle);
++ ctx.errcode = ext2fs_extent_open2(fs,0,&inode,&handle);
++//
+ if (ctx.errcode)
+ goto abort_exit;
+
+diff -Naur ext4magic-0.3.2/src/inode.c ext4magic-0.3.2_new/src/inode.c
+--- ext4magic-0.3.2/src/inode.c 2014-03-12 01:54:03.000000000 +0100
++++ ext4magic-0.3.2_new/src/inode.c 2015-10-18 23:23:19.468000000 +0200
+@@ -112,8 +112,10 @@
+ unsigned int printed = 0;
+ errcode_t errcode;
+
+-
+- errcode = local_ext2fs_extent_open(current_fs, *inode, &handle);
++//FIXME : Debian Bug #802089 (temporary work around)
++// errcode = local_ext2fs_extent_open(current_fs, *inode, &handle);
++ errcode = ext2fs_extent_open2(current_fs,0,inode,&handle);
++//
+ if (errcode)
+ return;
+