From 62fb9f7a8585895ab4ed22dcc587fc5b77ec8428 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 17 Feb 2016 11:14:06 +0000 Subject: [PATCH] Add more patches since 5.1.14. --- ...ze-since-it-can-be-computed-from-_st.patch | 2 +- ...l-exclude-setting-when-downloading-p.patch | 2 +- ...ng-dnf-builddep-command-on-Fedora-yu.patch | 29 ++++++++++ 0004-ext2-check-for-needed-block-size.patch | 58 +++++++++++++++++++ supermin.spec | 7 ++- 5 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 0003-docs-Mention-using-dnf-builddep-command-on-Fedora-yu.patch create mode 100644 0004-ext2-check-for-needed-block-size.patch diff --git a/0001-bin2s-Remove-_size-since-it-can-be-computed-from-_st.patch b/0001-bin2s-Remove-_size-since-it-can-be-computed-from-_st.patch index 757bbbf..8ab5f9b 100644 --- a/0001-bin2s-Remove-_size-since-it-can-be-computed-from-_st.patch +++ b/0001-bin2s-Remove-_size-since-it-can-be-computed-from-_st.patch @@ -1,7 +1,7 @@ From 7cff794d82076df70dde7a851937fc7bf93fdf44 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 12 Jan 2016 11:07:57 +0000 -Subject: [PATCH 1/2] bin2s: Remove _size, since it can be computed from _start +Subject: [PATCH 1/4] bin2s: Remove _size, since it can be computed from _start and _end. Also declare the _start and _end as uint8_t instead of char, since diff --git a/0002-dnf-Ignore-global-exclude-setting-when-downloading-p.patch b/0002-dnf-Ignore-global-exclude-setting-when-downloading-p.patch index a83cccf..df386dd 100644 --- a/0002-dnf-Ignore-global-exclude-setting-when-downloading-p.patch +++ b/0002-dnf-Ignore-global-exclude-setting-when-downloading-p.patch @@ -1,7 +1,7 @@ From 53a113ee3ada2e2aea586a62c258e5bb46ca32d5 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 12 Jan 2016 19:02:44 +0000 -Subject: [PATCH 2/2] dnf: Ignore global exclude setting when downloading +Subject: [PATCH 2/4] dnf: Ignore global exclude setting when downloading packages. When you use `dnf download', it obeys the exclude settings in diff --git a/0003-docs-Mention-using-dnf-builddep-command-on-Fedora-yu.patch b/0003-docs-Mention-using-dnf-builddep-command-on-Fedora-yu.patch new file mode 100644 index 0000000..0a73f08 --- /dev/null +++ b/0003-docs-Mention-using-dnf-builddep-command-on-Fedora-yu.patch @@ -0,0 +1,29 @@ +From d763aa475d15b1ec5edb368039244ca21ff08928 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 14 Jan 2016 13:58:10 +0000 +Subject: [PATCH 3/4] docs: Mention using dnf builddep command on Fedora, + yum-builddep on RHEL. + +See: https://bugzilla.redhat.com/show_bug.cgi?id=1297606 +--- + README | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/README b/README +index b8ad550..34949a2 100644 +--- a/README ++++ b/README +@@ -58,8 +58,8 @@ For Fedora/RHEL: + librpm + yumdownloader (from yum-utils) or 'dnf download' plugin + +- NB: On Fedora, use `yum-builddep supermin' to install all the +- dependencies. ++ NB: On RHEL, use `yum-builddep supermin' to install all the ++ dependencies. On Fedora use `dnf builddep supermin'. + + For Debian/Ubuntu: + +-- +2.5.0 + diff --git a/0004-ext2-check-for-needed-block-size.patch b/0004-ext2-check-for-needed-block-size.patch new file mode 100644 index 0000000..f188fe3 --- /dev/null +++ b/0004-ext2-check-for-needed-block-size.patch @@ -0,0 +1,58 @@ +From 7798f601b766adc55b98d3da726c50fe32060e4a Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Fri, 22 Jan 2016 17:35:27 +0100 +Subject: [PATCH 4/4] ext2: check for needed block size + +Check early that there are enough free blocks to store each file, +erroring out with ENOSPC if not; this avoids slightly more obscure +errors later on. +--- + src/ext2fs-c.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/src/ext2fs-c.c b/src/ext2fs-c.c +index f01ca9d..e45980a 100644 +--- a/src/ext2fs-c.c ++++ b/src/ext2fs-c.c +@@ -52,6 +52,9 @@ + /* fts.h in glibc is broken, forcing us to use the GNUlib alternative. */ + #include "fts_.h" + ++/* How many blocks of size S are needed for storing N bytes. */ ++#define ROUND_UP(N, S) (((N) + (S) - 1) / (S)) ++ + struct ext2_data + { + ext2_filsys fs; +@@ -629,6 +632,7 @@ ext2_copy_file (struct ext2_data *data, const char *src, const char *dest) + errcode_t err; + struct stat statbuf; + struct statvfs statvfsbuf; ++ size_t blocks; + + if (data->debug >= 3) + printf ("supermin: ext2: copy_file %s -> %s\n", src, dest); +@@ -649,6 +653,20 @@ ext2_copy_file (struct ext2_data *data, const char *src, const char *dest) + caml_copy_string (data->fs->device_name)); + } + ++ /* Check that we have enough free blocks to store the resulting blocks ++ * for this file. The file might need more than that in the filesystem, ++ * but at least this provides a quick check to avoid failing later on. ++ */ ++ blocks = ROUND_UP (statbuf.st_size, data->fs->blocksize); ++ if (blocks > ext2fs_free_blocks_count (data->fs->super)) { ++ fprintf (stderr, "supermin: %s: needed %lu blocks (%d each) for " ++ "%lu bytes, available only %llu\n", ++ src, blocks, data->fs->blocksize, statbuf.st_size, ++ ext2fs_free_blocks_count (data->fs->super)); ++ unix_error (ENOSPC, (char *) "block size", ++ data->fs->device_name ? caml_copy_string (data->fs->device_name) : Val_none); ++ } ++ + /* Sanity check the path. These rules are always true for the paths + * passed to us here from the appliance layer. The assertions just + * verify that the rules haven't changed. +-- +2.5.0 + diff --git a/supermin.spec b/supermin.spec index 2972539..0550169 100644 --- a/supermin.spec +++ b/supermin.spec @@ -6,7 +6,7 @@ Summary: Tool for creating supermin appliances Name: supermin Version: 5.1.14 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2+ %if 0%{?rhel} >= 7 @@ -19,6 +19,8 @@ Source0: http://libguestfs.org/download/supermin/%{name}-%{version}.tar.gz # All upstream since 5.1.14. Patch1: 0001-bin2s-Remove-_size-since-it-can-be-computed-from-_st.patch Patch2: 0002-dnf-Ignore-global-exclude-setting-when-downloading-p.patch +Patch3: 0003-docs-Mention-using-dnf-builddep-command-on-Fedora-yu.patch +Patch4: 0004-ext2-check-for-needed-block-size.patch BuildRequires: /usr/bin/pod2man BuildRequires: /usr/bin/pod2html @@ -134,6 +136,9 @@ make check || { %changelog +* Wed Feb 17 2016 Richard W.M. Jones - 5.1.14-4 +- Add more patches since 5.1.14. + * Fri Feb 05 2016 Fedora Release Engineering - 5.1.14-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild