]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add the (undocumented) --debug option to the ".ar" command in the CLI
authordrh <>
Thu, 11 Jun 2026 14:14:37 +0000 (14:14 +0000)
committerdrh <>
Thu, 11 Jun 2026 14:14:37 +0000 (14:14 +0000)
FossilOrigin-Name: 3a040ffc47fa3e38b36716587c56d9b071d9c69d9daaa9cf0ef6baa654419ab5

manifest
manifest.uuid
src/shell.c.in

index 2bb19ee48b2dbcb63a81ed0a1e51f15afc5a171b..5df250a818227fedfaa1160974d7ebf24769ef0c 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Improved\sdetection\sof\scorrupt\snode\sIDs\sin\sRTree\sshadow\stables.\nTest\scase\sin\sTH3.
-D 2026-06-11T01:31:19.738
+C Add\sthe\s(undocumented)\s--debug\soption\sto\sthe\s".ar"\scommand\sin\sthe\sCLI
+D 2026-06-11T14:14:37.249
 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -739,7 +739,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
 F src/resolve.c d0724113da9f5c0430d2052808ce59519f51ae7c4fbb1f5ef21fe3a832956086
 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
 F src/select.c 5c3a5e3c1e6c3f8ccabeb414e18dce64e6f3e797de225ee93034f2c9e76f289c
-F src/shell.c.in a2da6feaab1614d45f6140528bf09e20186d4b0b865d83466f1c4826c394fefe
+F src/shell.c.in 20bdae8e587db01ecc02b99f7af5339db5de3fccf1f4ca325695604f22a0ff9f
 F src/sqlite.h.in 749454ec71c875bc130d399ff9a7e47191d143d1b9d8b4af3839b6028df9eda9
 F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
 F src/sqlite3ext.h 9788c301f95370fa30e808861f1d2e6f022a816ddbe2a4f67486784c1b31db2e
@@ -2209,8 +2209,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee
 F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
 F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
-P fc6442ee54795fbeb746539193716238aa653d80170523bc327ae3ce0d945ebf
-R b62a1a9be915fa38c4712f8e4e09ecb6
+P e01a185a699d0c4ad2341ce2114bc826f02768735cef67179a1127229a073d03
+R d2a6bbd4c0f8b7bc9e21299e9449c104
 U drh
-Z 070cbc699c8093e05563261e6f56f802
+Z c9bb4b4e063916ece8127fa255c743ff
 # Remove this line to create a well-formed Fossil manifest.
index 79c8d3d3fa41f3447ba2a7fd315d83254cc5ea72..7ebdc9afdb954ddff7da63660b14601ac58ee102 100644 (file)
@@ -1 +1 @@
-e01a185a699d0c4ad2341ce2114bc826f02768735cef67179a1127229a073d03
+3a040ffc47fa3e38b36716587c56d9b071d9c69d9daaa9cf0ef6baa654419ab5
index bce2235a6a6de4f865b88c1de93ed0fa41f208f5..c700943dcfeb49b3c869d327fc5e9993bc234ea4 100644 (file)
@@ -6902,7 +6902,7 @@ struct ArCommand {
   u8 eCmd;                        /* An AR_CMD_* value */
   u8 bVerbose;                    /* True if --verbose */
   u8 bZip;                        /* True if the archive is a ZIP */
-  u8 bDryRun;                     /* True if --dry-run */
+  u8 bDryRun;                     /* 1 for --dry-run, 2 for --debug */
   u8 bAppend;                     /* True if --append */
   u8 bGlob;                       /* True if --glob */
   u8 fromCmdLine;                 /* Run from -A instead of .archive */
@@ -6964,6 +6964,7 @@ static int arErrorMsg(ArCommand *pAr, const char *zFmt, ...){
 #define AR_SWITCH_APPEND     11
 #define AR_SWITCH_DRYRUN     12
 #define AR_SWITCH_GLOB       13
+#define AR_SWITCH_DEBUG      14
 
 static int arProcessSwitch(ArCommand *pAr, int eSwitch, const char *zArg){
   switch( eSwitch ){
@@ -6981,7 +6982,10 @@ static int arProcessSwitch(ArCommand *pAr, int eSwitch, const char *zArg){
       break;
 
     case AR_SWITCH_DRYRUN:
-      pAr->bDryRun = 1;
+      if( pAr->bDryRun<2 ) pAr->bDryRun = 1;
+      break;
+    case AR_SWITCH_DEBUG:
+      pAr->bDryRun = 2;
       break;
     case AR_SWITCH_GLOB:
       pAr->bGlob = 1;
@@ -7032,6 +7036,7 @@ static int arParseCommand(
     { "append",    'a', AR_SWITCH_APPEND,    1 },
     { "directory", 'C', AR_SWITCH_DIRECTORY, 1 },
     { "dryrun",    'n', AR_SWITCH_DRYRUN,    0 },
+    { "debug",      0,  AR_SWITCH_DEBUG,     0 },
     { "glob",      'g', AR_SWITCH_GLOB,      0 },
   };
   int nSwitch = sizeof(aSwitch) / sizeof(struct ArSwitch);
@@ -7335,8 +7340,12 @@ static int arExtractCommand(ArCommand *pAr){
   const char *zSql1 =
     "WITH dest(dpath,dlen) AS (SELECT realpath($dir),length(realpath($dir)))\n"
     "SELECT ($dir || name),\n"
-    "       CASE WHEN $dryrun THEN 0\n"
-    "            ELSE writefile($dir||name, %s, mode, mtime) END\n"
+    "    CASE $dryrun\n"
+    "    WHEN 0 THEN writefile($dir||name, %s, mode, mtime)\n"
+    "    WHEN 1 THEN 0\n"
+    "    ELSE shell_putsnl(format('writefile(%%Q,%%s,%%0o,%%d)',"
+                           "$dir||name,quote(%s),mode,mtime))\n"
+    "    END\n"
     "  FROM dest CROSS JOIN %s\n"
     " WHERE (%s)\n"
     "   AND (data IS NULL OR $pass==0)\n"                /* Dirs both passes */
@@ -7370,7 +7379,7 @@ static int arExtractCommand(ArCommand *pAr){
   }
 
   shellPreparePrintf(pAr->db, &rc, &pSql, zSql1,
-      azExtraArg[pAr->bZip], pAr->zSrcTable, zWhere
+      azExtraArg[pAr->bZip], azExtraArg[pAr->bZip], pAr->zSrcTable, zWhere
   );
 
   if( rc==SQLITE_OK ){
@@ -7386,19 +7395,24 @@ static int arExtractCommand(ArCommand *pAr){
     ** will be reset to the value in the archive, since populating them
     ** in the first pass will have changed the timestamp. */
     for(i=0; i<2; i++){
+      if( pAr->bDryRun>=2 ){
+        cli_printf(pAr->out, "*** BEGIN PASS %d ***\n", i+1);
+      }
       j = sqlite3_bind_parameter_index(pSql, "$pass");
       sqlite3_bind_int(pSql, j, i);
-      if( pAr->bDryRun ){
+      if( pAr->bDryRun && i==0 ){
         cli_printf(pAr->out, "%s\n", sqlite3_sql(pSql));
-        if( pAr->bVerbose==0 ) break;
       }
       while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSql) ){
         if( i==0 && pAr->bVerbose ){
           cli_printf(pAr->out, "%s\n", sqlite3_column_text(pSql, 0));
         }
       }
-      if( pAr->bDryRun ) break;
+      if( pAr->bDryRun==1 ) break;
       shellReset(&rc, pSql);
+      if( pAr->bDryRun>=2 ){
+        cli_printf(pAr->out, "*** END PASS %d ***\n", i+1);
+      }
     }
     shellFinalize(&rc, pSql);
   }