Date: Tuesday, August 3, 2021 @ 15:16:37
  Author: eworm
Revision: 421106

upgpkg: e2fsprogs 1.46.3-3: use upstream fix

Added:
  
e2fsprogs/trunk/0001-mke2fs-fix-creating-a-file-system-image-w-o-a-pre-existing-file.patch
Modified:
  e2fsprogs/trunk/PKGBUILD
Deleted:
  
e2fsprogs/trunk/0001-mke2fs-do-not-warn-about-a-pre-existing-partition-table-when-using-a-non-zero-offset.patch

-------------------------------------------------------------------------------------------------+
 
0001-mke2fs-do-not-warn-about-a-pre-existing-partition-table-when-using-a-non-zero-offset.patch
 |   79 ----------
 0001-mke2fs-fix-creating-a-file-system-image-w-o-a-pre-existing-file.patch     
                 |   47 +++++
 PKGBUILD                                                                       
                 |   10 -
 3 files changed, 52 insertions(+), 84 deletions(-)

Deleted: 
0001-mke2fs-do-not-warn-about-a-pre-existing-partition-table-when-using-a-non-zero-offset.patch
===================================================================
--- 
0001-mke2fs-do-not-warn-about-a-pre-existing-partition-table-when-using-a-non-zero-offset.patch
     2021-08-03 15:08:27 UTC (rev 421105)
+++ 
0001-mke2fs-do-not-warn-about-a-pre-existing-partition-table-when-using-a-non-zero-offset.patch
     2021-08-03 15:16:37 UTC (rev 421106)
@@ -1,79 +0,0 @@
-commit 942b00cb9d2f2b52f4c58877d523145ee59a89b0
-Author: Theodore Ts'o <[email protected]>
-Date:   Wed Jul 21 15:46:09 2021 -0400
-
-    mke2fs: do not warn about a pre-existing partition table when using a 
non-zero offset
-    
-    The existing code attempted to avoid warning about a pre-existing file
-    system with a non-zero offset, but because the offset was not set at
-    the time of the check, this intention was not actually working.  So
-    this commit will suppress warnings about pre-existing a partition
-    table as well as pre-existing file system when there is a non-zero
-    offset.
-    
-    Addresses-Debian-Bug: #989612
-    Signed-off-by: Theodore Ts'o <[email protected]>
-
-diff --git a/lib/support/plausible.c b/lib/support/plausible.c
-index 2a3ae140..bbed2a70 100644
---- a/lib/support/plausible.c
-+++ b/lib/support/plausible.c
-@@ -282,11 +282,11 @@ int check_plausibility(const char *device, int flags, 
int *ret_is_dev)
-               return !has_magic;
-       }
- #endif
--
--      ret = check_partition_table(device);
--      if (ret >= 0)
--              return ret;
--
-+      if (flags & CHECK_FS_EXIST) {
-+              ret = check_partition_table(device);
-+              if (ret >= 0)
-+                      return ret;
-+      }
-       return 1;
- }
- 
-diff --git a/misc/mke2fs.c b/misc/mke2fs.c
-index 5a35e9ef..c7b32316 100644
---- a/misc/mke2fs.c
-+++ b/misc/mke2fs.c
-@@ -1973,18 +1973,8 @@ profile_error:
-       profile_get_integer(profile, "options", "proceed_delay", 0, 0,
-                           &proceed_delay);
- 
--      /* The isatty() test is so we don't break existing scripts */
--      flags = CREATE_FILE;
--      if (isatty(0) && isatty(1) && !offset)
--              flags |= CHECK_FS_EXIST;
--      if (!quiet)
--              flags |= VERBOSE_CREATE;
--      if (fs_blocks_count == 0)
--              flags |= NO_SIZE;
--      else
-+      if (fs_blocks_count)
-               explicit_fssize = 1;
--      if (!check_plausibility(device_name, flags, &is_device) && !force)
--              proceed_question(proceed_delay);
- 
-       check_mount(device_name, force, _("filesystem"));
- 
-@@ -2650,6 +2640,17 @@ profile_error:
- 
-       free(fs_type);
-       free(usage_types);
-+
-+      /* The isatty() test is so we don't break existing scripts */
-+      flags = CREATE_FILE;
-+      if (isatty(0) && isatty(1) && !offset)
-+              flags |= CHECK_FS_EXIST;
-+      if (!quiet)
-+              flags |= VERBOSE_CREATE;
-+      if (!explicit_fssize)
-+              flags |= NO_SIZE;
-+      if (!check_plausibility(device_name, flags, &is_device) && !force)
-+              proceed_question(proceed_delay);
- }
- 
- static int should_do_undo(const char *name)

Added: 
0001-mke2fs-fix-creating-a-file-system-image-w-o-a-pre-existing-file.patch
===================================================================
--- 0001-mke2fs-fix-creating-a-file-system-image-w-o-a-pre-existing-file.patch  
                        (rev 0)
+++ 0001-mke2fs-fix-creating-a-file-system-image-w-o-a-pre-existing-file.patch  
2021-08-03 15:16:37 UTC (rev 421106)
@@ -0,0 +1,47 @@
+commit 53464654bd33e58e3fff079f34261b823d839f3b
+Author: Theodore Ts'o <[email protected]>
+Date:   Mon Aug 2 21:08:01 2021 -0400
+
+    mke2fs: fix creating a file system image w/o a pre-existing file
+    
+    The mke2fs program should allow creating a file system image when an
+    explicit file system size is specified, even if the file doesn't yet
+    exist.  By deferring the call to check_plausible() in commit
+    942b00cb9d2f ("mke2fs: do not warn about a pre-existing partition
+    table when using a non-zero offset") this behaviour was broken.
+    
+    Fix this regression by explicitly creating the file if the file system
+    size is specified.
+    
+    Signed-off-by: Theodore Ts'o <[email protected]>
+
+diff --git a/misc/mke2fs.c b/misc/mke2fs.c
+index 306064df..31e8de1a 100644
+--- a/misc/mke2fs.c
++++ b/misc/mke2fs.c
+@@ -1986,6 +1986,25 @@ profile_error:
+               retval = ext2fs_get_device_size2(device_name,
+                                                EXT2_BLOCK_SIZE(&fs_param),
+                                                &dev_size);
++      if (retval == ENOENT) {
++              int fd;
++
++              if (!explicit_fssize) {
++                      fprintf(stderr,
++                              _("The file %s does not exist and no "
++                                "size was specified.\n"), device_name);
++                      exit(1);
++              }
++              fd = ext2fs_open_file(device_name,
++                                    O_CREAT | O_WRONLY, 0666);
++              if (fd < 0) {
++                      retval = errno;
++              } else {
++                      dev_size = 0;
++                      retval = 0;
++                      printf(_("Creating regular file %s\n"), device_name);
++              }
++      }
+       if (retval && (retval != EXT2_ET_UNIMPLEMENTED)) {
+               com_err(program_name, retval, "%s",
+                       _("while trying to determine filesystem size"));

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2021-08-03 15:08:27 UTC (rev 421105)
+++ PKGBUILD    2021-08-03 15:16:37 UTC (rev 421106)
@@ -3,7 +3,7 @@
 
 pkgname=e2fsprogs
 pkgver=1.46.3
-pkgrel=2
+pkgrel=3
 pkgdesc="Ext2/3/4 filesystem utilities"
 arch=('x86_64')
 license=('GPL' 'LGPL' 'MIT')
@@ -18,11 +18,11 @@
 options=('staticlibs')
 validpgpkeys=('3AB057B7E78D945C8C5591FBD36F769BC11804F0') # Theodore Ts'o 
<[email protected]>
 
source=("https://www.kernel.org/pub/linux/kernel/people/tytso/${pkgname}/v${pkgver}/${pkgname}-${pkgver}.tar."{xz,sign}
-        
'0001-mke2fs-do-not-warn-about-a-pre-existing-partition-table-when-using-a-non-zero-offset.patch'
+        
'0001-mke2fs-fix-creating-a-file-system-image-w-o-a-pre-existing-file.patch'
         'MIT-LICENSE')
 sha256sums=('86d1580facdd49f2e0e6b027e26b1e6c48af538762dc40aeed2a87153c1f11b7'
             'SKIP'
-            '48ac4367d729aede1ba84974a237e5c3421ea9b4371b17a83842b54b62931a80'
+            '1e0eb9e1f809aa6b09131d9153bf683c152358a09a6770cbf6268d563ef3481a'
             'cc45386c1d71f438ad648fd7971e49e3074ad9dbacf9dd3a5b4cb61fd294ecbb')
 
 
@@ -29,8 +29,8 @@
 prepare() {
   cd "${srcdir}/${pkgname}-${pkgver}"
 
-  # revert: mke2fs: do not warn about a pre-existing partition table when 
using a non-zero offset
-  patch -Np1 -R < 
../0001-mke2fs-do-not-warn-about-a-pre-existing-partition-table-when-using-a-non-zero-offset.patch
+  # mke2fs: fix creating a file system image w/o a pre-existing file
+  patch -Np1 < 
../0001-mke2fs-fix-creating-a-file-system-image-w-o-a-pre-existing-file.patch
 
   # Remove unnecessary init.d directory
   sed -i '/init\.d/s|^|#|' misc/Makefile.in

Reply via email to