Control: tags 787996 pending
Control: tags 1005413 pending
Control: tags 1005414 pending

I have uploaded an NMU fixing FTBFS and reproducible builds issues:

diff -Nru cloop-3.14.1.3/advancecomp-1.15/file.cc 
cloop-3.14.1.3+nmu1/advancecomp-1.15/file.cc
--- cloop-3.14.1.3/advancecomp-1.15/file.cc     2020-04-19 01:18:13.000000000 
-0700
+++ cloop-3.14.1.3+nmu1/advancecomp-1.15/file.cc        2022-12-22 
12:41:49.000000000 -0800
@@ -98,7 +98,7 @@
 /**
  * Check if a file exists.
  */
-bool file_exists(const string& path) throw (error)
+bool file_exists(const string& path)
 {
        struct stat s;
        if (stat(path.c_str(), &s) != 0) {
@@ -114,7 +114,7 @@
 /**
  * Write a whole file.
  */
-void file_write(const string& path, const char* data, unsigned size) throw 
(error)
+void file_write(const string& path, const char* data, unsigned size)
 {
        FILE* f = fopen(path.c_str(), "wb");
        if (!f)
@@ -134,7 +134,7 @@
 /**
  * Read a whole file.
  */
-void file_read(const string& path, char* data, unsigned size) throw (error)
+void file_read(const string& path, char* data, unsigned size)
 {
        file_read(path, data, 0, size);
 }
@@ -142,7 +142,7 @@
 /**
  * Read a whole file.
  */
-void file_read(const string& path, char* data, unsigned offset, unsigned size) 
throw (error)
+void file_read(const string& path, char* data, unsigned offset, unsigned size)
 {
        FILE* f = fopen(path.c_str(), "rb");
        if (!f)
@@ -166,7 +166,7 @@
 /**
  * Get the time of a file.
  */
-time_t file_time(const string& path) throw (error)
+time_t file_time(const string& path)
 {
        struct stat s;
        if (stat(path.c_str(), &s)!=0)
@@ -178,7 +178,7 @@
 /**
  * Set the time of a file.
  */
-void file_utime(const string& path, time_t tod) throw (error)
+void file_utime(const string& path, time_t tod)
 {
        struct utimbuf u;
 
@@ -192,7 +192,7 @@
 /**
  * Get the size of a file.
  */
-unsigned file_size(const string& path) throw (error)
+unsigned file_size(const string& path)
 {
        struct stat s;
        if (stat(path.c_str(), &s)!=0)
@@ -204,7 +204,7 @@
 /**
  * Get the crc of a file.
  */
-crc_t file_crc(const string& path) throw (error)
+crc_t file_crc(const string& path)
 {
        unsigned size = file_size(path);
 
@@ -227,7 +227,7 @@
 /**
  * Copy a file.
  */
-void file_copy(const string& path1, const string& path2) throw (error)
+void file_copy(const string& path1, const string& path2)
 {
        unsigned size;
 
@@ -249,7 +249,7 @@
 /**
  * Move a file.
  */
-void file_move(const string& path1, const string& path2) throw (error)
+void file_move(const string& path1, const string& path2)
 {
        if (rename(path1.c_str(), path2.c_str())!=0
                && errno==EXDEV) {
@@ -271,7 +271,7 @@
 /**
  * Remove a file.
  */
-void file_remove(const string& path1) throw (error)
+void file_remove(const string& path1)
 {
        if (remove(path1.c_str())!=0) {
                throw error() << "Failed remove of " << path1;
@@ -281,7 +281,7 @@
 /**
  * Rename a file.
  */
-void file_rename(const string& path1, const string& path2) throw (error)
+void file_rename(const string& path1, const string& path2)
 {
        if (rename(path1.c_str(), path2.c_str())!=0) {
                throw error() << "Failed rename of " << path1 << " to " << 
path2;
@@ -400,7 +400,7 @@
 /**
  * Make a drectory tree.
  */
-void file_mktree(const std::string& path) throw (error)
+void file_mktree(const std::string& path)
 {
        string dir = file_dir(path);
        string name = file_name(path);
diff -Nru cloop-3.14.1.3/advancecomp-1.15/file.h 
cloop-3.14.1.3+nmu1/advancecomp-1.15/file.h
--- cloop-3.14.1.3/advancecomp-1.15/file.h      2020-04-19 01:18:13.000000000 
-0700
+++ cloop-3.14.1.3+nmu1/advancecomp-1.15/file.h 2022-12-22 12:41:49.000000000 
-0800
@@ -67,18 +67,18 @@
 crc_t crc_compute(const char* data, unsigned len);
 crc_t crc_compute(crc_t pred, const char* data, unsigned len);
 
-bool file_exists(const std::string& file) throw (error);
-void file_write(const std::string& path, const char* data, unsigned size) 
throw (error);
-void file_read(const std::string& path, char* data, unsigned size) throw 
(error);
-void file_read(const std::string& path, char* data, unsigned offset, unsigned 
size) throw (error);
-time_t file_time(const std::string& path) throw (error);
-void file_utime(const std::string& path, time_t tod) throw (error);
-unsigned file_size(const std::string& path) throw (error);
-crc_t file_crc(const std::string& path) throw (error);
-void file_copy(const std::string& path1, const std::string& path2) throw 
(error);
-void file_move(const std::string& path1, const std::string& path2) throw 
(error);
-void file_remove(const std::string& path1) throw (error);
-void file_mktree(const std::string& path1) throw (error);
+bool file_exists(const std::string& file);
+void file_write(const std::string& path, const char* data, unsigned size);
+void file_read(const std::string& path, char* data, unsigned size);
+void file_read(const std::string& path, char* data, unsigned offset, unsigned 
size);
+time_t file_time(const std::string& path);
+void file_utime(const std::string& path, time_t tod);
+unsigned file_size(const std::string& path);
+crc_t file_crc(const std::string& path);
+void file_copy(const std::string& path1, const std::string& path2);
+void file_move(const std::string& path1, const std::string& path2);
+void file_remove(const std::string& path1);
+void file_mktree(const std::string& path1);
 
 std::string file_randomize(const std::string& path, int n) throw ();
 std::string file_name(const std::string& file) throw ();
diff -Nru cloop-3.14.1.3/cloop.c cloop-3.14.1.3+nmu1/cloop.c
--- cloop-3.14.1.3/cloop.c      2020-04-19 01:18:13.000000000 -0700
+++ cloop-3.14.1.3+nmu1/cloop.c 2022-12-22 12:41:49.000000000 -0800
@@ -309,15 +309,8 @@
  while (buf_done < buf_len)
   {
    size_t size = buf_len - buf_done, size_read;
-   mm_segment_t old_fs;
-   /* kernel_read() only supports 32 bit offsets, so we use vfs_read() 
instead. */
-   /* int size_read = kernel_read(f, pos, buf + buf_done, size); */
-
    // mutex_lock(&clo->clo_rq_mutex);
-   old_fs = get_fs();
-   set_fs(KERNEL_DS);
-   size_read = vfs_read(f, (void __user *)(buf + buf_done), size, &pos);
-   set_fs(old_fs);
+   size_read = kernel_read(f, buf + buf_done, size, &pos);
    // mutex_unlock(&clo->clo_rq_mutex);
 
    if(size_read <= 0)
@@ -528,7 +521,7 @@
   }
  clo->backing_file = file;
  clo->backing_inode= inode ;
- clo->underlying_total_size = (isblkdev) ? inode->i_bdev->bd_inode->i_size : 
inode->i_size;
+ clo->underlying_total_size = (isblkdev) ? file->f_mapping->host->i_size : 
inode->i_size;
  if(clo->underlying_total_size < header_size)
   {
    printk(KERN_ERR "%s: %llu bytes (must be >= %u bytes)\n",
@@ -538,7 +531,7 @@
   }
  if(isblkdev)
   {
-   struct request_queue *q = bdev_get_queue(inode->i_bdev);
+   struct request_queue *q = bdev_get_queue(I_BDEV(file->f_mapping->host));
    blk_queue_max_hw_sectors(clo->clo_queue, queue_max_hw_sectors(q)); /* 
Renamed in 2.6.34 */
    blk_queue_max_segments(clo->clo_queue, queue_max_segments(q)); /* Renamed 
in 2.6.34 */
    /* blk_queue_max_hw_segments(clo->clo_queue, queue_max_hw_segments(q)); */ 
/* Removed in 2.6.34 */
@@ -547,7 +540,7 @@
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
    blk_queue_merge_bvec(clo->clo_queue, q->merge_bvec_fn);
 #endif
-   clo->underlying_blksize = block_size(inode->i_bdev);
+   clo->underlying_blksize = block_size(I_BDEV(file->f_mapping->host));
   }
  else
    clo->underlying_blksize = PAGE_SIZE;
@@ -816,7 +809,7 @@
  file = fget(arg); /* get filp struct from ioctl arg fd */
  if(!file) return -EBADF;
  error=cloop_set_file(cloop_num,file);
- set_device_ro(bdev, 1);
+ set_disk_ro(clo->clo_disk, true);
  if(error) fput(file);
  return error;
 }
@@ -1125,6 +1118,7 @@
 static int cloop_alloc(int cloop_num)
 {
  struct cloop_device *clo = (struct cloop_device *) cloop_malloc(sizeof(struct 
cloop_device));
+ int error = -ENOMEM;
  if(clo == NULL) goto error_out;
  cloop_dev[cloop_num] = clo;
  memset(clo, 0, sizeof(struct cloop_device));
@@ -1138,39 +1132,58 @@
  clo->tag_set.flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_BLOCKING;
  clo->tag_set.driver_data = clo;
  if(blk_mq_alloc_tag_set(&clo->tag_set)) goto error_out_free_clo;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
  clo->clo_queue = blk_mq_init_queue(&clo->tag_set);
  if(IS_ERR(clo->clo_queue))
   {
    printk(KERN_ERR "%s: Unable to alloc queue[%d]\n", cloop_name, cloop_num);
    goto error_out_free_tags;
   }
- clo->clo_queue->queuedata = clo;
- blk_queue_max_hw_sectors(clo->clo_queue, BLK_DEF_MAX_SECTORS);
  clo->clo_disk = alloc_disk(1);
+#else
+ clo->clo_disk = blk_mq_alloc_disk(&clo->tag_set, NULL);
+#endif
  if(!clo->clo_disk)
   {
    printk(KERN_ERR "%s: Unable to alloc disk[%d]\n", cloop_name, cloop_num);
    goto error_out_free_queue;
   }
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0)
+ clo->clo_disk->queue = clo->clo_queue; 
+#else
+ clo->clo_disk->minors = 1;
+ clo->clo_queue = clo->clo_disk->queue;
+#endif
+ clo->clo_queue->queuedata = clo;
+ blk_queue_max_hw_sectors(clo->clo_queue, BLK_DEF_MAX_SECTORS);
  spin_lock_init(&clo->queue_lock);
  mutex_init(&clo->clo_ctl_mutex);
  mutex_init(&clo->clo_rq_mutex);
  clo->clo_disk->major = cloop_major;
  clo->clo_disk->first_minor = cloop_num;
  clo->clo_disk->fops = &clo_fops;
- clo->clo_disk->queue = clo->clo_queue;
  clo->clo_disk->private_data = clo;
  sprintf(clo->clo_disk->disk_name, "%s%d", cloop_name, cloop_num);
- add_disk(clo->clo_disk);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
+ error = add_disk(clo->clo_disk);
+ if (error)
+  goto error_out_free_disk;
+#endif
  return 0;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
+error_out_free_disk:
+ blk_cleanup_disk(clo->clo_disk);
+#endif
 error_out_free_queue:
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0)
  blk_cleanup_queue(clo->clo_queue);
 error_out_free_tags:
+#endif
  blk_mq_free_tag_set(&clo->tag_set);
 error_out_free_clo:
  cloop_free(clo, sizeof(struct cloop_device));
 error_out:
- return -ENOMEM;
+ return error;
 }
 
 static void cloop_dealloc(int cloop_num)
@@ -1178,9 +1191,13 @@
  struct cloop_device *clo = cloop_dev[cloop_num];
  if(clo == NULL) return;
  del_gendisk(clo->clo_disk);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
+ blk_cleanup_disk(clo->clo_disk);
+#else
  blk_cleanup_queue(clo->clo_queue);
- blk_mq_free_tag_set(&clo->tag_set);
  put_disk(clo->clo_disk);
+#endif
+ blk_mq_free_tag_set(&clo->tag_set);
  cloop_free(clo, sizeof(struct cloop_device));
  cloop_dev[cloop_num] = NULL;
 }
@@ -1269,8 +1286,3 @@
 /* The cloop init and exit function registration (especially needed for Kernel 
2.6) */
 module_init(cloop_init);
 module_exit(cloop_exit);
-
-#include <linux/vermagic.h>
-#include <linux/compiler.h>
-
-MODULE_INFO(vermagic, VERMAGIC_STRING);
diff -Nru cloop-3.14.1.3/debian/changelog cloop-3.14.1.3+nmu1/debian/changelog
--- cloop-3.14.1.3/debian/changelog     2020-04-19 01:18:13.000000000 -0700
+++ cloop-3.14.1.3+nmu1/debian/changelog        2022-12-22 12:41:49.000000000 
-0800
@@ -1,3 +1,30 @@
+cloop (3.14.1.3+nmu1) unstable; urgency=medium
+
+  * Non-maintainer upload
+
+  [ Ben Hutchings ]
+  * Fix FTBFS with gcc 11 (Closes: #1005413):
+    - Remove exception specifications
+  * Fix module build for recent kernel versions (Closes: #1005414):
+    - Stop generating module vermagic in cloop.c. This has always been handled
+      by modpost and doing it here now results in build failure.
+    - Avoid using inode::i_bdev, which was removed in Linux 5.11.
+    - Use set_disk_ro() instead of set_device_ro(). The latter was not meant to
+      be used by device drivers and was removed in Linux 5.11.
+    - Use blk_{mq_alloc,cleanup}_disk() instead of separate queue and disk
+      allocation and cleanup on Linux 5.15+, since alloc_disk() was removed.
+    - Handle potential failure of add_disk() on Linux 5.15+.
+    - Use kernel_read() instead of vfs_read() and set_fs(). set_fs() is no
+      longer defined on some architectures, and kernel_read() has had large
+      file support since Linux 2.6.31.
+
+  [ Vagrant Cascadian ]
+  * debian/rules: Build tarball reproducibly, using consistent time, uid,
+    gid and sort order. Thanks to Dhole for the initial patch.
+    (Closes: #787996)
+
+ -- Vagrant Cascadian <vagr...@reproducible-builds.org>  Thu, 22 Dec 2022 
12:41:49 -0800
+
 cloop (3.14.1.3) unstable; urgency=medium
 
   * Upgrading to more recent debhelper and latest policy standards
diff -Nru cloop-3.14.1.3/debian/rules cloop-3.14.1.3+nmu1/debian/rules
--- cloop-3.14.1.3/debian/rules 2020-04-19 01:18:13.000000000 -0700
+++ cloop-3.14.1.3+nmu1/debian/rules    2022-12-22 12:41:49.000000000 -0800
@@ -28,4 +28,4 @@
        cp Makefile *.c *.h README ChangeLog $(XDIR)
        cd debian && install rules.m-a ../$(XDIR)/debian/rules && cp -r po 
compat control* copyright *_KVERS_* README.Debian changelog ../$(XDIR)/debian
        dh_fixperms -i -Xrules
-       cd debian/cloop-src/usr/src && XZ_OPT=-9 tar --xz -c -f cloop.tar.xz 
modules && rm -rf modules
+       cd debian/cloop-src/usr/src && XZ_OPT=-9 tar --xz --sort=name 
--mtime=@$(SOURCE_DATE_EPOCH) --owner=0 --group=0 --numeric-owner  -c -f 
cloop.tar.xz modules && rm -rf modules


live well,
  vagrant

Attachment: signature.asc
Description: PGP signature

Reply via email to