1#!/bin/bash 2# This library is free software; you can redistribute it and/or 3# modify it under the terms of the GNU Lesser General Public 4# License as published by the Free Software Foundation version 2.1 5# of the License. 6# 7# Copyright(c) 2023 Huawei Device Co., Ltd. 8 9set -e 10cd $1 11touch test.lock 12( 13 flock -x -w 10 200 || exit 1 14if [ -d "e2fsprogs" ];then 15 exit 0 16fi 17tar xvf e2fsprogs.tar.xz 18cd $1/e2fsprogs 19patch -p1 < $1/0001-e2fsprogs-set-hugefile-from-4T-to-1T-in-hugefile-tes.patch --fuzz=0 --no-backup-if-mismatch 20patch -p1 < $1/0002-libss-add-newer-libreadline.so.8-to-dlopen-path.patch --fuzz=0 --no-backup-if-mismatch 21patch -p1 < $1/0003-tests-update-expect-files-for-f_mmp_garbage.patch --fuzz=0 --no-backup-if-mismatch 22patch -p1 < $1/0004-tests-update-expect-files-for-f_large_dir-and-f_larg.patch --fuzz=0 --no-backup-if-mismatch 23patch -p1 < $1/0005-resize2fs-resize2fs-disk-hardlinks-will-be-error.patch --fuzz=0 --no-backup-if-mismatch 24patch -p1 < $1/0006-e2fsck-exit-journal-recovery-when-find-EIO-ENOMEM-er.patch --fuzz=0 --no-backup-if-mismatch 25patch -p1 < $1/0007-e2fsck-exit-journal-recovery-when-jounral-superblock.patch --fuzz=0 --no-backup-if-mismatch 26patch -p1 < $1/0008-e2fsck-add-env-param-E2FS_UNRELIABLE_IO-to-fi.patch --fuzz=0 --no-backup-if-mismatch 27patch -p1 < $1/0009-e2mmpstatus.8.in-detele-filesystem-can-be-UUID-or-LA.patch --fuzz=0 --no-backup-if-mismatch 28patch -p1 < $1/0010-tests-update-expect-file-for-u_direct_io.patch --fuzz=0 --no-backup-if-mismatch 29patch -p1 < $1/0011-libext2fs-don-t-old-the-CACHE_MTX-while-doing-I-O.patch --fuzz=0 --no-backup-if-mismatch 30patch -p1 < $1/0012-tests-fix-ACL-printing-tests.patch --fuzz=0 --no-backup-if-mismatch 31patch -p1 < $1/0013-e2fsck-do-not-clean-up-file-acl-if-the-inode-is-trun.patch --fuzz=0 --no-backup-if-mismatch 32patch -p1 < $1/0014-e2fsck-handle-level-is-overflow-in-ext2fs_extent_get.patch --fuzz=0 --no-backup-if-mismatch 33patch -p1 < $1/0015-libext2fs-add-sanity-check-to-extent-manipulation.patch --fuzz=0 --no-backup-if-mismatch 34patch -p1 < $1/0016-e2fsprogs-add-sw64.patch --fuzz=0 --no-backup-if-mismatch 35patch -p1 < $1/0017-tune2fs-do-not-change-j_tail_sequence-in-journal-sup.patch --fuzz=0 --no-backup-if-mismatch 36patch -p1 < $1/0018-debugfs-teach-logdump-the-n-num_trans-option.patch --fuzz=0 --no-backup-if-mismatch 37patch -p1 < $1/0019-tune2fs-fix-tune2fs-segfault-when-ext2fs_run_ext3_jo.patch --fuzz=0 --no-backup-if-mismatch 38patch -p1 < $1/0020-tune2fs-tune2fs_main-should-return-rc-when-some-erro.patch --fuzz=0 --no-backup-if-mismatch 39patch -p1 < $1/0021-tune2fs-exit-directly-when-fs-freed-in-ext2fs_run_ext3_journal.patch --fuzz=0 --no-backup-if-mismatch 40patch -p1 < $1/0022-unix_io.c-fix-deadlock-problem-in-unix_write_blk64.patch --fuzz=0 --no-backup-if-mismatch 41patch -p1 < $1/0023-debugfs-fix-repeated-output-problem-with-logdump-O-n.patch --fuzz=0 --no-backup-if-mismatch 42patch -p1 < $1/0024-tune2fs-check-return-value-of-ext2fs_mmp_update2-in-.patch --fuzz=0 --no-backup-if-mismatch 43patch -p1 < $1/0025-mmp-fix-wrong-comparison-in-ext2fs_mmp_stop.patch --fuzz=0 --no-backup-if-mismatch 44patch -p1 < $1/0026-misc-fsck.c-Processes-may-kill-other-processes.patch --fuzz=0 --no-backup-if-mismatch 45patch -p1 < $1/0027-dumpe2fs-resize2fs-avoid-memory-leak-on-error-path.patch --fuzz=0 --no-backup-if-mismatch 46patch -p1 < $1/0028-libext2fs-fix-memory-leak-in-error-path-while-openin.patch --fuzz=0 --no-backup-if-mismatch 47patch -p1 < $1/0029-e2fsck-avoid-theoretical-null-dereference-in-end_pro.patch --fuzz=0 --no-backup-if-mismatch 48patch -p1 < $1/0030-e2fsck-fix-potential-out-of-bounds-read-in-inc_ea_in.patch --fuzz=0 --no-backup-if-mismatch 49patch -p1 < $1/0031-e2fsck-avoid-out-of-bounds-write-for-very-deep-exten.patch --fuzz=0 --no-backup-if-mismatch 50patch -p1 < $1/0032-e2fsck-fix-potential-fencepost-error-in-e2fsck_shoul.patch --fuzz=0 --no-backup-if-mismatch 51patch -p1 < $1/0033-libext2fs-fix-potential-integer-overflow-in-bitmap-a.patch --fuzz=0 --no-backup-if-mismatch 52patch -p1 < $1/0034-tune2fs-fix-an-error-message.patch --fuzz=0 --no-backup-if-mismatch 53patch -p1 < $1/0035-e2fsck-don-t-allow-journal-inode-to-have-encrypt-fla.patch --fuzz=0 --no-backup-if-mismatch 54patch -p1 < $1/0036-lib-ext2fs-fix-unbalanced-mutex-unlock-for-BOUNCE_MT.patch --fuzz=0 --no-backup-if-mismatch 55patch -p1 < $1/0037-libext2fs-fix-ext2fs_compare_generic_bmap-logic.patch --fuzz=0 --no-backup-if-mismatch 56patch -p1 < $1/0038-Quiet-unused-variable-warnings.patch --fuzz=0 --no-backup-if-mismatch 57patch -p1 < $1/0039-ext2fs-Use-64bit-lseek-when-_FILE_OFFSET_BITS-is-64.patch --fuzz=0 --no-backup-if-mismatch 58patch -p1 < $1/0040-e2fsck-fix-bad-htree-checksums-in-preen-mode.patch --fuzz=0 --no-backup-if-mismatch 59patch -p1 < $1/0041-debugfs-Fix-infinite-loop-when-dump-log.patch --fuzz=0 --no-backup-if-mismatch 60patch -p1 < $1/1001-image-make.patch --fuzz=0 --no-backup-if-mismatch 61patch -p1 < $1/1002-add-header-file-to-musl-compile-mk2efs.patch --fuzz=0 --no-backup-if-mismatch 62patch -p1 < $1/1003-add-dac-config.patch --fuzz=0 --no-backup-if-mismatch 63patch -p1 < $1/1004-modify-code-to-compile.patch --fuzz=0 --no-backup-if-mismatch 64patch -p1 < $1/1005-read-vfat-chinese-label.patch --fuzz=0 --no-backup-if-mismatch 65exit 0 66)200>$1/test.lock 67