diff --git a/zpaqfranz.cpp b/zpaqfranz.cpp index 8ce096d..8690205 100644 --- a/zpaqfranz.cpp +++ b/zpaqfranz.cpp @@ -52,8 +52,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#define ZPAQ_VERSION "58.2g" -#define ZPAQ_DATE "(2023-05-02)" // cannot use __DATE__ on Debian! +#define ZPAQ_VERSION "58.3c" +#define ZPAQ_DATE "(2023-05-08)" // cannot use __DATE__ on Debian! /// optional align for malloc (sparc64) via -DALIGNMALLOC @@ -986,7 +986,7 @@ Greetings 18 Thanks to https://github.com/justinormont for the proposed Homebrew install formula for macOS and x64 Linux 19 Thanks to https://github.com/alebcay for coding the Homebrew install formula for macOS and x64 Linux 20 Thanks to https://github.com/ZhongRuoyu for __linux__ instead of older #defines - +21 Thanks to Coody user of encode.ru for unexistent folder bug _____ _ _ _____ _______ _ _ |_ _| \ | |/ ____|__ __|/\ | | | | | | | \| | (___ | | / \ | | | | @@ -10809,6 +10809,7 @@ vector g_crc32; vector g_arraybytescanned; vector g_arrayfilescanned; MAPPAERRORS g_errors; +bool g_flagcreating; char command; string g_franzsnap; string g_vss_shadow; @@ -39137,6 +39138,56 @@ string exec(const char* cmd) } #endif +string tail(string const& i_source, size_t const i_length) +{ + if (i_length>=i_source.size()) + return i_source; + return i_source.substr(i_source.size()-i_length); +} + +string x_one_vector(string i_command,string i_text,vector& o_line) +{ + o_line.clear(); + if (i_command=="") + return ""; + + string risultato=exec(i_command.c_str()); + if (i_text!="") + myprintf("39147: running %s\n",i_text.c_str()); + if (risultato=="") + { + myprintf("39149: x_one %s\n",i_command.c_str()); + return ""; + } + if (flagdebug) + myprintf("39153: x_one %s => %s\n",i_command.c_str(),risultato.c_str()); + + unsigned int i=0; + string lineetta=""; + + while (i=i_source.size()) - return i_source; - return i_source.substr(i_source.size()-i_length); -} // Rename name using tofiles[] string Jidac::rename(string name) { @@ -45447,6 +45492,7 @@ int Jidac::loadparameters(int argc, const char** argv) version =DEFAULT_VERSION; date =0; g_flagmultipart =false; + g_flagcreating =false; #ifdef GUI iszpaqloaded =false; @@ -47943,7 +47989,7 @@ class HTIndex { HTIndex(vector& r, size_t sz): htr(r), t(0), htsize(1) { int b; for (b=1; sz*3>>b; ++b); - t.resize(1, b-1); + t.resize(1, b-1); update(); } // Find sha1 in ht. Return its index or 0 if not found. @@ -48683,14 +48729,12 @@ ThreadReturn decompressThread(void* arg) { { /// -zero -debug: write all zeros in output if (flagdebug) - { ///seek to the end and write a 0 if (job.outf!=NULL) { fseeko(job.outf, offset+usize, SEEK_SET); fwrite(&byte0, 1, 1, job.outf); } - } } else { @@ -54849,17 +54893,23 @@ void my_handler(int s) myprintf("54470: Closing file handle\n"); fclose(g_archivefp); } - if (fileexists(g_archive.c_str())) - if (prendidimensionefile(g_archive.c_str())>=0) - { - if (delete_file(g_archive.c_str())) - myprintf("54766: Erased chunk <<"); - else - myprintf("54766: *FAILED* delete of <<"); - printUTF8(g_archive.c_str()); - myprintf(">>\n"); - } + bool flagalwayscheck=g_flagcreating; + if (command=='Z') + flagalwayscheck=true; + + + if (flagalwayscheck) + if (fileexists(g_archive.c_str())) + if (prendidimensionefile(g_archive.c_str())>=0) + { + if (delete_file(g_archive.c_str())) + myprintf("54766: Erased chunk <<"); + else + myprintf("54766: *FAILED* delete of <<"); + printUTF8(g_archive.c_str()); + myprintf(">>\n"); + } // 2==control-C (maybe) if (s==2) { @@ -56976,7 +57026,6 @@ bool isbackuppart(string i_partname,string i_mask) -typedef std::pair mycoppia; bool compare_second(const std::pair& a,const std::pair& b) { return (a.second>\n"); + return 2; + } + } } #ifdef SERVER @@ -66301,6 +66393,8 @@ int Jidac::versum() } +typedef std::pair mycoppia; + int Jidac::zfsproxbackup() { string storepath ="/var/lib/vz"; @@ -66404,33 +66498,89 @@ int Jidac::zfsproxbackup() string listresult=x_one(listme,"Searching vz from zfs list..."); #endif - int vzpos=mypos(storepath,listresult); + + vector arraylist; + listresult=x_one_vector(listme,"Searching something",arraylist); - if (vzpos==-1) - { - myprintf("38042: GURU, cannot find %s inside zfs list\n",storepath.c_str()); - return 2; - } - if (flagdebug) + +///fika + + vector name_mountpoint; + + for (unsigned int i=0;i0) + { + if (lavoro[j]!=' ') + j--; + else + break; + } + ///printf("k2 j %d\n",j); + for (unsigned int k=j+1;k> <<%s>>",name.c_str(),mountpoint.c_str()); + if (i==0) + { + if ((name!="NAME") || (mountpoint!="MOUNTPOINT")) + break; + } + else + name_mountpoint.push_back(std::pair(name,mountpoint)); } - while ((vzpos>0) && (listresult[--vzpos]!=10)); - if (flagdebug) - myprintf("38070: vzpos 2 %d\n",vzpos); - if (vzpos>0) + + string mountpoint =""; + for (unsigned int i=0;i> <<%30s>>\n",name_mountpoint[i].first.c_str(),name_mountpoint[i].second.c_str()); + + /// first try + for (unsigned int i=0;i>\n",thepool.c_str()); if (isdirectory(thepool)) { @@ -66442,15 +66592,10 @@ int Jidac::zfsproxbackup() if (snapmark!="") themark=snapmark; - int howmanyslash =0; int howmanyat =0; for (unsigned int i=0;i1) - { - myprintf("53549: A pool-dataset |%s| must have exactly 0 or 1 / instead of %d\n",thepool.c_str(),howmanyslash); - return 2; - } + if (howmanyat>0) { myprintf("52984: A pool-dataset |%s| cannot have @\n",thepool.c_str()); return 2; } - string fullexpectedsnapshot=thepool+'@'+themark; vector thedrives; - for (unsigned int i=0;i array_primachiocciola; @@ -66502,7 +66635,18 @@ int Jidac::zfsproxbackup() myprintf("38152: GURU, something seems wrong, %s\n",runresult.c_str()); return 2; } - + + for (unsigned int i=0;i