Hello community,

here is the log from the commit of package thin-provisioning-tools for 
openSUSE:Factory checked in at 2016-08-24 10:05:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/thin-provisioning-tools (Old)
 and      /work/SRC/openSUSE:Factory/.thin-provisioning-tools.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "thin-provisioning-tools"

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/thin-provisioning-tools/thin-provisioning-tools.changes
  2016-07-18 21:18:43.000000000 +0200
+++ 
/work/SRC/openSUSE:Factory/.thin-provisioning-tools.new/thin-provisioning-tools.changes
     2016-08-24 10:06:01.000000000 +0200
@@ -1,0 +2,6 @@
+Thu Aug 18 14:46:59 UTC 2016 - mplus...@suse.com
+
+- Update to version 0.6.3:
+  * Update documentation
+
+-------------------------------------------------------------------

Old:
----
  thin-provisioning-tools-0.6.2.tar.gz

New:
----
  thin-provisioning-tools-0.6.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ thin-provisioning-tools.spec ++++++
--- /var/tmp/diff_new_pack.r0kYT6/_old  2016-08-24 10:06:02.000000000 +0200
+++ /var/tmp/diff_new_pack.r0kYT6/_new  2016-08-24 10:06:02.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           thin-provisioning-tools
-Version:        0.6.2
+Version:        0.6.3
 Release:        0
 Summary:        Thin Provisioning Tools
 License:        GPL-3.0

++++++ thin-provisioning-tools-0.6.2.tar.gz -> 
thin-provisioning-tools-0.6.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/thin-provisioning-tools-0.6.2/Makefile.in 
new/thin-provisioning-tools-0.6.3/Makefile.in
--- old/thin-provisioning-tools-0.6.2/Makefile.in       2016-05-07 
15:40:31.000000000 +0200
+++ new/thin-provisioning-tools-0.6.3/Makefile.in       2016-07-21 
16:42:52.000000000 +0200
@@ -25,6 +25,7 @@
 all: $(PROGRAMS)
 
 SOURCE=\
+       base/output_file_requirements.cc \
        base/application.cc \
        base/base64.cc \
        base/disk_units.cc \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/thin-provisioning-tools-0.6.2/VERSION 
new/thin-provisioning-tools-0.6.3/VERSION
--- old/thin-provisioning-tools-0.6.2/VERSION   2016-05-07 15:40:31.000000000 
+0200
+++ new/thin-provisioning-tools-0.6.3/VERSION   2016-07-21 16:42:52.000000000 
+0200
@@ -1 +1 @@
-0.6.2-rc9
+0.6.3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/thin-provisioning-tools-0.6.2/base/application.cc 
new/thin-provisioning-tools-0.6.3/base/application.cc
--- old/thin-provisioning-tools-0.6.2/base/application.cc       2016-05-07 
15:40:31.000000000 +0200
+++ new/thin-provisioning-tools-0.6.3/base/application.cc       2016-07-21 
16:42:52.000000000 +0200
@@ -61,8 +61,14 @@
 
        std::list<command::ptr>::const_iterator it;
        for (it = cmds_.begin(); it != cmds_.end(); ++it) {
-               if (cmd == (*it)->get_name())
-                       return (*it)->run(argc, argv);
+               if (cmd == (*it)->get_name()) {
+                       try {
+                               return (*it)->run(argc, argv);
+                       } catch (std::exception const &e) {
+                               cerr << e.what() << "\n";
+                               return 1;
+                       }
+               }
        }
 
        std::cerr << "Unknown command '" << cmd << "'\n";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/thin-provisioning-tools-0.6.2/base/output_file_requirements.cc 
new/thin-provisioning-tools-0.6.3/base/output_file_requirements.cc
--- old/thin-provisioning-tools-0.6.2/base/output_file_requirements.cc  
1970-01-01 01:00:00.000000000 +0100
+++ new/thin-provisioning-tools-0.6.3/base/output_file_requirements.cc  
2016-07-21 16:42:52.000000000 +0200
@@ -0,0 +1,54 @@
+#include "base/output_file_requirements.h"
+
+#include <iostream>
+#include <linux/fs.h>
+#include <sstream>
+#include <stdexcept>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+using namespace base;
+using namespace std;
+
+//----------------------------------------------------------------
+
+namespace {
+       void explain_output_file_requirements() {
+               ostringstream out;
+               out << "The output file should either be a block device,\n"
+                   << "or an existing file.  The file needs to be large\n"
+                   << "enough to hold the metadata.";
+
+               throw runtime_error(out.str());
+       }
+
+       unsigned const MIN_SIZE = 32 * 1024;
+}
+
+void
+base::check_output_file_requirements(string const &path)
+{
+       struct stat info;
+       int r = ::stat(path.c_str(), &info);
+       if (r) {
+               cerr << "Output file does not exist.\n\n";
+               explain_output_file_requirements();
+       }
+
+       // We only really want these checks for regular files
+       if (S_ISREG(info.st_mode)) {
+               if (!info.st_size) {
+                       cerr << "Zero size output file.\n\n";
+                       explain_output_file_requirements();
+               }
+
+               if (info.st_size < MIN_SIZE) {
+                       cerr << "Output file too small.\n\n";
+                       explain_output_file_requirements();
+               }
+       }
+}
+
+//----------------------------------------------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/thin-provisioning-tools-0.6.2/base/output_file_requirements.h 
new/thin-provisioning-tools-0.6.3/base/output_file_requirements.h
--- old/thin-provisioning-tools-0.6.2/base/output_file_requirements.h   
1970-01-01 01:00:00.000000000 +0100
+++ new/thin-provisioning-tools-0.6.3/base/output_file_requirements.h   
2016-07-21 16:42:52.000000000 +0200
@@ -0,0 +1,14 @@
+#ifndef BASE_OUTPUT_FILE_REQUIREMENTS_H
+#define BASE_OUTPUT_FILE_REQUIREMENTS_H
+
+#include <string>
+
+//----------------------------------------------------------------
+
+namespace base {
+       void check_output_file_requirements(std::string const &path);
+}
+
+//----------------------------------------------------------------
+
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/thin-provisioning-tools-0.6.2/caching/cache_repair.cc 
new/thin-provisioning-tools-0.6.3/caching/cache_repair.cc
--- old/thin-provisioning-tools-0.6.2/caching/cache_repair.cc   2016-05-07 
15:40:31.000000000 +0200
+++ new/thin-provisioning-tools-0.6.3/caching/cache_repair.cc   2016-07-21 
16:42:52.000000000 +0200
@@ -2,6 +2,7 @@
 #include <getopt.h>
 #include <libgen.h>
 
+#include "base/output_file_requirements.h"
 #include "caching/commands.h"
 #include "caching/metadata.h"
 #include "caching/metadata_dump.h"
@@ -105,7 +106,10 @@
                return 1;
        }
 
-       if (!output_path) {
+       if (output_path)
+               check_output_file_requirements(*output_path);
+
+       else {
                cerr << "no output file provided" << endl;
                usage(cerr);
                return 1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/thin-provisioning-tools-0.6.2/caching/cache_restore.cc 
new/thin-provisioning-tools-0.6.3/caching/cache_restore.cc
--- old/thin-provisioning-tools-0.6.2/caching/cache_restore.cc  2016-05-07 
15:40:31.000000000 +0200
+++ new/thin-provisioning-tools-0.6.3/caching/cache_restore.cc  2016-07-21 
16:42:52.000000000 +0200
@@ -1,5 +1,6 @@
 #include "version.h"
 
+#include "base/output_file_requirements.h"
 #include "caching/commands.h"
 #include "caching/metadata.h"
 #include "caching/restore_emitter.h"
@@ -169,7 +170,10 @@
                return 1;
        }
 
-       if (!fs.output) {
+       if (fs.output)
+               check_output_file_requirements(*fs.output);
+
+       else {
                cerr << "No output file provided." << endl << endl;
                usage(cerr);
                return 1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/thin-provisioning-tools-0.6.2/era/era_restore.cc 
new/thin-provisioning-tools-0.6.3/era/era_restore.cc
--- old/thin-provisioning-tools-0.6.2/era/era_restore.cc        2016-05-07 
15:40:31.000000000 +0200
+++ new/thin-provisioning-tools-0.6.3/era/era_restore.cc        2016-07-21 
16:42:52.000000000 +0200
@@ -1,5 +1,6 @@
 #include "version.h"
 
+#include "base/output_file_requirements.h"
 #include "era/commands.h"
 #include "era/metadata.h"
 #include "era/restore_emitter.h"
@@ -121,7 +122,10 @@
                return 1;
        }
 
-       if (!fs.output) {
+       if (fs.output)
+               check_output_file_requirements(*fs.output);
+
+       else {
                cerr << "No output file provided." << endl << endl;
                usage(cerr);
                return 1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/thin-provisioning-tools-0.6.2/features/step_definitions/thin_steps.rb 
new/thin-provisioning-tools-0.6.3/features/step_definitions/thin_steps.rb
--- old/thin-provisioning-tools-0.6.2/features/step_definitions/thin_steps.rb   
2016-05-07 15:40:31.000000000 +0200
+++ new/thin-provisioning-tools-0.6.3/features/step_definitions/thin_steps.rb   
2016-07-21 16:42:52.000000000 +0200
@@ -24,6 +24,11 @@
   end
 end
 
+Given(/^a tiny file$/) do
+  run_simple("rm -f tiny")
+  run_simple("fallocate -l 123 tiny")
+end
+
 When(/^I run thin_check with (.*?)$/) do |opts|
   run_simple("thin_check #{opts} #{dev_file}", false)
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/thin-provisioning-tools-0.6.2/features/thin_restore.feature 
new/thin-provisioning-tools-0.6.3/features/thin_restore.feature
--- old/thin-provisioning-tools-0.6.2/features/thin_restore.feature     
2016-05-07 15:40:31.000000000 +0200
+++ new/thin-provisioning-tools-0.6.3/features/thin_restore.feature     
2016-07-21 16:42:52.000000000 +0200
@@ -55,6 +55,18 @@
     No output file provided.
     """
 
+  Scenario: tiny output file
+    Given a tiny file
+    When I run thin_restore with -i metadata.xml -o tiny
+    Then it should fail with:
+    """
+    Output file too small.
+
+    The output file should either be a block device,
+    or an existing file.  The file needs to be large
+    enough to hold the metadata.
+    """
+
   Scenario: --quiet is accepted
     Given valid thin metadata
     When I run thin_restore with -i metadata.xml -o metadata.bin --quiet
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/thin-provisioning-tools-0.6.2/man8/cache_repair.8 
new/thin-provisioning-tools-0.6.3/man8/cache_repair.8
--- old/thin-provisioning-tools-0.6.2/man8/cache_repair.8       2016-05-07 
15:40:31.000000000 +0200
+++ new/thin-provisioning-tools-0.6.3/man8/cache_repair.8       2016-07-21 
16:42:52.000000000 +0200
@@ -32,7 +32,8 @@
 Input file or device with binary metadata.
 
 .IP "\fB\-o, \-\-output\fP \fI{device|file}\fP"
-Output file or device for repaired binary metadata.
+Output file or device for repaired binary metadata.  If a file is used
+then it must be preallocated, and large enough to hold the metadata.
 
 .IP "\fB\-h, \-\-help\fP"
 Print help and exit.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/thin-provisioning-tools-0.6.2/man8/cache_restore.8 
new/thin-provisioning-tools-0.6.3/man8/cache_restore.8
--- old/thin-provisioning-tools-0.6.2/man8/cache_restore.8      2016-05-07 
15:40:31.000000000 +0200
+++ new/thin-provisioning-tools-0.6.3/man8/cache_restore.8      2016-07-21 
16:42:52.000000000 +0200
@@ -30,7 +30,8 @@
 Input file or device with metadata.
 
 .IP "\fB\-o, \-\-output\fP \fI{device|file}\fP"
-Output file or device.
+Output file or device for repaired binary metadata.  If a file is used
+then it must be preallocated, and large enough to hold the metadata.
 
 .IP "\fB{\-\-debug-override-metadata-version}\fP \fI<integer>\fP"
 ONLY FOR DEBUGGING PURPOSES:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/thin-provisioning-tools-0.6.2/man8/thin_repair.8 
new/thin-provisioning-tools-0.6.3/man8/thin_repair.8
--- old/thin-provisioning-tools-0.6.2/man8/thin_repair.8        2016-05-07 
15:40:31.000000000 +0200
+++ new/thin-provisioning-tools-0.6.3/man8/thin_repair.8        2016-07-21 
16:42:52.000000000 +0200
@@ -32,7 +32,8 @@
 Input file or device with binary metadata.
 
 .IP "\fB\-o, \-\-output\fP \fI{device|file}\fP"
-Output file or device for repaired binary metadata.
+Output file or device for repaired binary metadata.  If a file is used
+then it must be preallocated, and large enough to hold the metadata.
 
 .IP "\fB\-h, \-\-help\fP"
 Print help and exit.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/thin-provisioning-tools-0.6.2/man8/thin_restore.8 
new/thin-provisioning-tools-0.6.3/man8/thin_restore.8
--- old/thin-provisioning-tools-0.6.2/man8/thin_restore.8       2016-05-07 
15:40:31.000000000 +0200
+++ new/thin-provisioning-tools-0.6.3/man8/thin_restore.8       2016-07-21 
16:42:52.000000000 +0200
@@ -33,7 +33,8 @@
 Input file or device with metadata.
 
 .IP "\fB\-o, \-\-output\fP \fI{device|file}\fP"
-Output file or device.
+Output file or device for repaired binary metadata.  If a file is used
+then it must be preallocated, and large enough to hold the metadata.
 
 .IP "\fB\-h, \-\-help\fP"
 Print help and exit.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/thin-provisioning-tools-0.6.2/persistent-data/file_utils.cc 
new/thin-provisioning-tools-0.6.3/persistent-data/file_utils.cc
--- old/thin-provisioning-tools-0.6.2/persistent-data/file_utils.cc     
2016-05-07 15:40:31.000000000 +0200
+++ new/thin-provisioning-tools-0.6.3/persistent-data/file_utils.cc     
2016-07-21 16:42:52.000000000 +0200
@@ -22,8 +22,11 @@
        block_address nr_blocks;
 
        int r = ::stat(path.c_str(), &info);
-       if (r)
-               throw runtime_error("Couldn't stat dev path");
+       if (r) {
+               ostringstream out;
+               out << "Couldn't stat dev path '" << path << "'";
+               throw runtime_error(out.str());
+       }
 
        if (S_ISREG(info.st_mode) && info.st_size)
                nr_blocks = div_down<block_address>(info.st_size, block_size);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/thin-provisioning-tools-0.6.2/thin-provisioning/thin_repair.cc 
new/thin-provisioning-tools-0.6.3/thin-provisioning/thin_repair.cc
--- old/thin-provisioning-tools-0.6.2/thin-provisioning/thin_repair.cc  
2016-05-07 15:40:31.000000000 +0200
+++ new/thin-provisioning-tools-0.6.3/thin-provisioning/thin_repair.cc  
2016-07-21 16:42:52.000000000 +0200
@@ -2,6 +2,7 @@
 #include <getopt.h>
 #include <libgen.h>
 
+#include "base/output_file_requirements.h"
 #include "persistent-data/file_utils.h"
 #include "thin-provisioning/commands.h"
 #include "human_readable_format.h"
@@ -99,7 +100,10 @@
                return 1;
        }
 
-       if (!output_path) {
+       if (output_path)
+               check_output_file_requirements(*output_path);
+
+       else {
                cerr << "no output file provided" << endl;
                usage(cerr);
                return 1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/thin-provisioning-tools-0.6.2/thin-provisioning/thin_restore.cc 
new/thin-provisioning-tools-0.6.3/thin-provisioning/thin_restore.cc
--- old/thin-provisioning-tools-0.6.2/thin-provisioning/thin_restore.cc 
2016-05-07 15:40:31.000000000 +0200
+++ new/thin-provisioning-tools-0.6.3/thin-provisioning/thin_restore.cc 
2016-07-21 16:42:52.000000000 +0200
@@ -16,6 +16,7 @@
 // with thin-provisioning-tools.  If not, see
 // <http://www.gnu.org/licenses/>.
 
+#include "base/output_file_requirements.h"
 #include "persistent-data/file_utils.h"
 #include "thin-provisioning/commands.h"
 #include "thin-provisioning/emitter.h"
@@ -138,7 +139,8 @@
                cerr << "No output file provided." << endl << endl;
                usage(cerr);
                return 1;
-       }
+       } else
+               check_output_file_requirements(output);
 
        return restore(input, output, quiet);
 }


Reply via email to