summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog6
-rw-r--r--src/cstore/unionfs/cstore-unionfs.cpp23
2 files changed, 26 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog
index 5dcca6e..dfd15d7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+vyatta-cfg (0.102.0+vyos2+current5) unstable; urgency=medium
+
+ * Provide internal stream_copy fall-through for Boost's copy_file
+
+ -- Boris Lukashev <rageltman@sempervictus.com> Sat, 13 Aug 2022 19:00:00 -0500
+
vyatta-cfg (0.102.0+vyos2+current4) unstable; urgency=medium
* Adjust for replacement of Quagga with FRR.
diff --git a/src/cstore/unionfs/cstore-unionfs.cpp b/src/cstore/unionfs/cstore-unionfs.cpp
index e713dbd..e9aa7b2 100644
--- a/src/cstore/unionfs/cstore-unionfs.cpp
+++ b/src/cstore/unionfs/cstore-unionfs.cpp
@@ -167,6 +167,14 @@ _unescape_path_name(const string& path)
return npath;
}
+// Fall-through for Boost's filesystem::copy_file "complexity"
+void stream_file( const char* srce_file, const char* dest_file )
+{
+ std::ifstream srce( srce_file, std::ios::binary ) ;
+ std::ofstream dest( dest_file, std::ios::binary ) ;
+ dest << srce.rdbuf() ;
+}
+
vector<int> getActiveCommits()
{
string process_name = "vbash";
@@ -322,7 +330,6 @@ UnionfsCstore::~UnionfsCstore()
{
}
-
////// public virtual functions declared in base class
bool
UnionfsCstore::markSessionUnsaved()
@@ -750,7 +757,12 @@ UnionfsCstore::sync_dir(const FsPath& src, const FsPath& dst,
try {
if (path_is_regular(s)) {
// it's file
- b_fs::copy_file(s.path_cstr(), d.path_cstr());
+ try {
+ b_fs::copy_file(s.path_cstr(), d.path_cstr());
+ } catch (const boost::filesystem::filesystem_error& e) {
+ output_internal("syncdir failed due to %s in copy_file. Falling back to internal stream_file\n", e.what());
+ stream_file(s.path_cstr(), d.path_cstr());
+ }
} else {
// dir
recursive_copy_dir(s, d, true);
@@ -1592,7 +1604,12 @@ UnionfsCstore::recursive_copy_dir(const FsPath& src, const FsPath& dst,
}
}
}
- b_fs::copy_file(di->path(), nname);
+ try {
+ b_fs::copy_file(di->path(), nname);
+ } catch (const b_fs::filesystem_error& e) {
+ output_internal("recursive_copy_dir failed due to %s in copy_file. Falling back to internal stream_file\n", e.what());
+ stream_file(di->path().string().c_str(), nname.c_str());
+ }
}
}
}