Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add symlink support to sqlar. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
4a0ed63daef97c4b3380aabc6578e305 |
User & Date: | dan 2017-12-02 19:15:43.286 |
Context
2017-12-04
| ||
16:24 | Update README.md to describe how symbolic links are stored in an archive. check-in: ef2844a7e0 user: dan tags: trunk | |
2017-12-02
| ||
19:15 | Add symlink support to sqlar. check-in: 4a0ed63dae user: dan tags: trunk | |
2017-05-12
| ||
15:32 | Update the built-in SQLite to the first 3.19.0 beta. check-in: 84cb978770 user: drh tags: trunk | |
Changes
Changes to sqlar.c.
︙ | |||
42 43 44 45 46 47 48 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | - + + + + + + + + + | " -x Extract files from archive\n" " -v Verbose output\n" ); exit(1); } /* |
︙ | |||
405 406 407 408 409 410 411 | 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 | + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + - + | FILE *out; make_parent_directory(zFilename); if( pCompr==0 ){ rc = mkdir(zFilename, iMode); if( rc ) errorMsg("cannot make directory: %s\n", zFilename); return; } if( sz<0 ){ /* This is a symlink. */ if( symlink(pCompr, zFilename)<0 ){ errorMsg("failed to create symlink: %s -> %s\n", zFilename, pCompr); } }else{ |
︙ | |||
586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 | 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | + + + + - - - - + + + + + + + + + + + + + + | }else if( extractFlag ){ const char *zSql; db_open(zArchive, 0, seeFlag, azFiles, nFiles); zSql = "SELECT name, mode, mtime, sz, data FROM sqlar" " WHERE name_on_list(name)"; db_prepare(zSql); while( sqlite3_step(pStmt)==SQLITE_ROW ){ int sz = sqlite3_column_int(pStmt, 3); /* Size of file on disk */ const char *pData; /* Data for this file */ const char *zFN = (const char*)sqlite3_column_text(pStmt, 0); check_filename(zFN); if( zFN[0]=='/' ){ errorMsg("absolute pathname: %s\n", zFN); } if( sqlite3_column_type(pStmt,4)==SQLITE_BLOB && access(zFN, F_OK)==0 ){ errorMsg("file already exists: %s\n", zFN); } if( verboseFlag ) printf("%s\n", zFN); if( sz<0 ){ /* symlink */ |
︙ |
Changes to sqlarfs.c.
︙ | |||
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | + + + + + + + + + - + - - + - - - - + - - + - + + + | sqlite3_bind_text(g.pExists, 1, &path[1], -1, SQLITE_STATIC); rc = sqlite3_step(g.pExists); sqlite3_reset(g.pExists); if( rc==SQLITE_DONE ) return -ENOENT; return 0; } static int prepare_read_stmt(void){ int rc = SQLITE_OK; if( g.pRead==0 ){ rc = sqlite3_prepare_v2(g.db, "SELECT sz, data FROM sqlar WHERE name=?1", -1, &g.pRead, 0); } return rc; } /* ** Load the file named path[] into the cache, if it is not there already. ** ** Return 0 on success. Return an error code if the file could not be loaded. */ static int loadCache(const char *path){ unsigned long int nIn; const char *zIn; |
︙ | |||
208 209 210 211 212 213 214 215 216 | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + | if( offset+size>g.szCache ) size = g.szCache - offset; memcpy(buf, g.zCacheData + offset, size); return size; }else{ return rc; } } static int sqlarfs_readlink(const char *zSymlink, char *pBuf, size_t nBuf){ int rc = 0; if( prepare_read_stmt() ){ rc = -EIO; }else{ sqlite3_bind_text(g.pRead, 1, &zSymlink[1], -1, SQLITE_STATIC); if( sqlite3_step(g.pRead)==SQLITE_ROW ){ int n = sqlite3_column_bytes(g.pRead, 1); if( n<nBuf ){ memcpy(pBuf, sqlite3_column_text(g.pRead, 1), n); pBuf[n] = '\0'; }else{ rc = -ENAMETOOLONG; } }else{ rc = -ENOENT; } sqlite3_reset(g.pRead); } return rc; } static struct fuse_operations sqlarfs_methods = { |
︙ |