From cb0f29fdff827aebd1171356f0f6f2f9ad95dc0d541adb311ef265d703cacdff Mon Sep 17 00:00:00 2001 From: Stanislav Brabec Date: Tue, 18 Jun 2019 23:03:43 +0000 Subject: [PATCH 1/2] Accepting request 707937 from home:seilerphilipp:squashfs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add -offset function to skip n bytes at the beginning of the squashfs… https://github.com/plougher/squashfs-tools/commit/5a498ad24dcfeac9f3d747e894f22901f3ac10 OBS-URL: https://build.opensuse.org/request/show/707937 OBS-URL: https://build.opensuse.org/package/show/filesystems/squashfs?expand=0&rev=39 --- ...-Add-offset-function-to-skip-n-bytes.patch | 86 +++++++++++++++++++ squashfs.changes | 6 ++ squashfs.spec | 3 + 3 files changed, 95 insertions(+) create mode 100644 0003-Add-offset-function-to-skip-n-bytes.patch diff --git a/0003-Add-offset-function-to-skip-n-bytes.patch b/0003-Add-offset-function-to-skip-n-bytes.patch new file mode 100644 index 0000000..a433ccc --- /dev/null +++ b/0003-Add-offset-function-to-skip-n-bytes.patch @@ -0,0 +1,86 @@ +From 5a498ad24dcfeac9f3d747e894f22901f3ac10ef Mon Sep 17 00:00:00 2001 +From: probonopd +Date: Thu, 15 Sep 2016 21:09:52 +0200 +Subject: [PATCH] Add -offset function to skip n bytes at the beginning of the + squashfs file + +--- + squashfs-tools/mksquashfs.c | 25 +++++++++++++++++++------ + 1 file changed, 19 insertions(+), 6 deletions(-) + +diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c +index d221c358..92b6a319 100644 +--- a/squashfs-tools/mksquashfs.c ++++ b/squashfs-tools/mksquashfs.c +@@ -98,6 +98,7 @@ int old_exclude = TRUE; + int use_regex = FALSE; + int nopad = FALSE; + int exit_on_error = FALSE; ++static off_t squashfs_start_offset = 0; + + long long global_uid = -1, global_gid = -1; + +@@ -516,9 +517,9 @@ int read_fs_bytes(int fd, long long byte, int bytes, void *buff) + + pthread_cleanup_push((void *) pthread_mutex_unlock, &pos_mutex); + pthread_mutex_lock(&pos_mutex); +- if(lseek(fd, off, SEEK_SET) == -1) { ++ if(lseek(fd, off+squashfs_start_offset, SEEK_SET) == -1) { + ERROR("read_fs_bytes: Lseek on destination failed because %s, " +- "offset=0x%llx\n", strerror(errno), off); ++ "offset=0x%llx\n", strerror(errno), off+squashfs_start_offset); + res = 0; + } else if(read_bytes(fd, buff, bytes) < bytes) { + ERROR("Read on destination failed\n"); +@@ -557,10 +558,10 @@ void write_destination(int fd, long long byte, int bytes, void *buff) + pthread_cleanup_push((void *) pthread_mutex_unlock, &pos_mutex); + pthread_mutex_lock(&pos_mutex); + +- if(lseek(fd, off, SEEK_SET) == -1) { ++ if(lseek(fd, off+squashfs_start_offset, SEEK_SET) == -1) { + ERROR("write_destination: Lseek on destination " + "failed because %s, offset=0x%llx\n", strerror(errno), +- off); ++ off+squashfs_start_offset); + BAD_ERROR("Probably out of space on output %s\n", + block_device ? "block device" : "filesystem"); + } +@@ -2315,9 +2316,9 @@ void *writer(void *arg) + pthread_cleanup_push((void *) pthread_mutex_unlock, &pos_mutex); + pthread_mutex_lock(&pos_mutex); + +- if(lseek(fd, off, SEEK_SET) == -1) { ++ if(lseek(fd, off+squashfs_start_offset, SEEK_SET) == -1) { + ERROR("writer: Lseek on destination failed because " +- "%s, offset=0x%llx\n", strerror(errno), off); ++ "%s, offset=0x%llx\n", strerror(errno), off+squashfs_start_offset); + BAD_ERROR("Probably out of space on output " + "%s\n", block_device ? "block device" : + "filesystem"); +@@ -5341,6 +5342,15 @@ int main(int argc, char *argv[]) + force_progress = TRUE; + else if(strcmp(argv[i], "-no-exports") == 0) + exportable = FALSE; ++ else if(strcmp(argv[i], "-offset") == 0 || ++ strcmp(argv[i], "-o") ==0) { ++ if(++i == argc) { ++ ERROR("%s: %s offset missing argument\n", argv[0], ++ argv[i - 1]); ++ exit(1); ++ } ++ squashfs_start_offset = (off_t)atol(argv[i]); ++ } + else if(strcmp(argv[i], "-processors") == 0) { + if((++i == argc) || !parse_num(argv[i], &processors)) { + ERROR("%s: -processors missing or invalid " +@@ -5641,6 +5651,9 @@ int main(int argc, char *argv[]) + ERROR("\nMiscellaneous options:\n"); + ERROR("-root-owned\t\talternative name for -all-root" + "\n"); ++ ERROR("-o \t\tSkip bytes at the " ++ "beginning of the file.\n\t\t\t" ++ "Default 0 bytes\n"); + ERROR("-noInodeCompression\talternative name for -noI" + "\n"); + ERROR("-noDataCompression\talternative name for -noD" + diff --git a/squashfs.changes b/squashfs.changes index 42429d2..cdd2830 100644 --- a/squashfs.changes +++ b/squashfs.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jun 5 20:21:30 UTC 2019 - Philipp + +- Add -offset function to skip n bytes at the beginning of the squashfs… + https://github.com/plougher/squashfs-tools/commit/5a498ad24dcfeac9f3d747e894f22901f3ac10 + ------------------------------------------------------------------- Wed Apr 24 17:41:17 UTC 2019 - Martin Liška diff --git a/squashfs.spec b/squashfs.spec index 0cdc2b8..c65e307 100644 --- a/squashfs.spec +++ b/squashfs.spec @@ -32,6 +32,8 @@ Patch2: 0002-Fix-2GB-limit-of-the-is_fragment-.-function.patch Patch3: squashfs-thread-limit # PATCH-FIX-UPSTREAM Include for major/minor/makedev Patch4: sysmacros.patch +# PATCH-FIX_UPSTREAM add -offset function to skip n bytes +Patch5: 0003-Add-offset-function-to-skip-n-bytes.patch %if %{?suse_version} > 1315 BuildRequires: liblz4-devel %endif @@ -52,6 +54,7 @@ squashfs images. %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 %build %define _lto_cflags %{nil} From f160d77789b1f71a5578398e14af9c9731c7a5e6f416a4804149c093f827a17a Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Fri, 2 Aug 2019 18:38:02 +0000 Subject: [PATCH 2/2] Accepting request 720279 from home:sbrabec:branches:filesystems Fix changes for rq#710686. OBS-URL: https://build.opensuse.org/request/show/720279 OBS-URL: https://build.opensuse.org/package/show/filesystems/squashfs?expand=0&rev=40 --- squashfs.changes | 1 + 1 file changed, 1 insertion(+) diff --git a/squashfs.changes b/squashfs.changes index cdd2830..8ba9f7f 100644 --- a/squashfs.changes +++ b/squashfs.changes @@ -3,6 +3,7 @@ Wed Jun 5 20:21:30 UTC 2019 - Philipp - Add -offset function to skip n bytes at the beginning of the squashfs… https://github.com/plougher/squashfs-tools/commit/5a498ad24dcfeac9f3d747e894f22901f3ac10 + (0003-Add-offset-function-to-skip-n-bytes.patch) ------------------------------------------------------------------- Wed Apr 24 17:41:17 UTC 2019 - Martin Liška