From f5d29d64245fc2d8f1c2d1738895f754631450f5 Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 27 Jan 2026 16:15:22 +0000 Subject: [PATCH] Teach sqlite3_rsync to increment its error count when a child process fails, based on [forum:8fe404e547faa42e|forum post 8fe404e547faa42e]. This passes basic sanity tests but requires more testing and needs a review of the final 'else' block in the new code. FossilOrigin-Name: 8be55d405f4ce424760150a2b59b5f663041fdcb377d1b9893b4f4e8e1940246 --- manifest | 17 ++++++++++------- manifest.tags | 4 ++-- manifest.uuid | 2 +- tool/sqlite3_rsync.c | 20 +++++++++++++++++--- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index d346d1eaee..29104ff473 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Additional\susage\snotes\sadded\sto\sthe\sheader\scomment\sof\sthe\stmstmpvfs.c\nsource\sfile.\s\sNo\scode\schanges. -D 2026-01-27T12:50:52.534 +C Teach\ssqlite3_rsync\sto\sincrement\sits\serror\scount\swhen\sa\schild\sprocess\sfails,\sbased\son\s[forum:8fe404e547faa42e|forum\spost\s8fe404e547faa42e].\sThis\spasses\sbasic\ssanity\stests\sbut\srequires\smore\stesting\sand\sneeds\sa\sreview\sof\sthe\sfinal\s'else'\sblock\sin\sthe\snew\scode. +D 2026-01-27T16:15:22.598 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -2174,7 +2174,7 @@ F tool/spellsift.tcl 52b4b04dc4333c7ab024f09d9d66ed6b6f7c6eb00b38497a09f338fa55d F tool/split-sqlite3c.tcl 4969fd642dad0ea483e4e104163021d92baf98f6a8eac981fe48525f9b873430 F tool/sqldiff.c 68f88017de3bed3aa65c93a4cf3a04d0989d158bc6fad8f1475beeeea1aae3ac F tool/sqlite3_analyzer.c.in 14f02cb5ec3c264cd6107d1f1dad77092b1cf440fc196c30b69ae87b56a1a43b -F tool/sqlite3_rsync.c 695ec8892ae7527db30019947132f7307a4828d311d1b933af6a066426057b6c +F tool/sqlite3_rsync.c f510a8b230e1c5b0f62842acd0e94ff15d2f77a00ae782f7d20f9e39919fa19b F tool/sqltclsh.c.in c103c6fc7d42bce611f9d4596774d60b7ef3d0b291a1f58c9e6184e458b89296 F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848 F tool/src-verify.c 6c655d9a8d6b30f3648fc78a79bf3838ed68f8543869d380c43ea9f17b3b8501 @@ -2193,8 +2193,11 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c -P 3d37da3cb5943a61f528e3002c4c3ac3d41e871d742d8e603bffcc4bc5bd42fd -R 8a32f6cdd6aca81d8601f27b004d8314 -U drh -Z d0b77a5a906394fca0dd542c83c29e20 +P d1b8e7740bee13a8cf199c6477ee20a4f8bcbbd9ec4096bcdc05a996fadf0d56 +R 22c9810e3abb2d143c6c544199799928 +T *branch * rsync-child-rc +T *sym-rsync-child-rc * +T -sym-trunk * Cancelled\sby\sbranch. +U stephan +Z e4761a6190c2383487d9598ed9b32aa9 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.tags b/manifest.tags index bec971799f..9abf1ce796 100644 --- a/manifest.tags +++ b/manifest.tags @@ -1,2 +1,2 @@ -branch trunk -tag trunk +branch rsync-child-rc +tag rsync-child-rc diff --git a/manifest.uuid b/manifest.uuid index fa632973fb..21f8983a15 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d1b8e7740bee13a8cf199c6477ee20a4f8bcbbd9ec4096bcdc05a996fadf0d56 +8be55d405f4ce424760150a2b59b5f663041fdcb377d1b9893b4f4e8e1940246 diff --git a/tool/sqlite3_rsync.c b/tool/sqlite3_rsync.c index 1d770f8ab6..b10224b2f7 100644 --- a/tool/sqlite3_rsync.c +++ b/tool/sqlite3_rsync.c @@ -325,15 +325,29 @@ static int popen2( ** Close the connection to a child process previously created using ** popen2(). */ -static void pclose2(FILE *pIn, FILE *pOut, int childPid){ +static int pclose2(FILE *pIn, FILE *pOut, int childPid){ #ifdef _WIN32 /* Not implemented, yet */ fclose(pIn); fclose(pOut); + return 0; #else + int wp, rc = 0; fclose(pIn); fclose(pOut); - while( waitpid(0, 0, WNOHANG)>0 ) {} + do{ + wp = waitpid(0, &rc, WNOHANG); + if( wp>0 ){ + if( WIFEXITED(rc) ){ + rc = WEXITSTATUS(rc); + }else if( WIFSIGNALED(rc) ){ + rc = WTERMSIG(rc); + }else{ + rc = 0/*???*/; + } + } + } while( wp>0 ); + return rc; #endif } /***************************************************************************** @@ -2362,7 +2376,7 @@ int main(int argc, char const * const *argv){ } originSide(&ctx); } - pclose2(ctx.pIn, ctx.pOut, childPid); + ctx.nErr += !!pclose2(ctx.pIn, ctx.pOut, childPid); if( ctx.pLog ) fclose(ctx.pLog); tmEnd = currentTime(); tmElapse = tmEnd - tmStart; /* Elapse time in milliseconds */ -- 2.47.3