From: Nathan Wagner Date: Mon, 11 Feb 2019 13:55:38 +0000 (+0000) Subject: fix some todo items X-Git-Tag: v0.5.0~20 X-Git-Url: https://pd.if.org/git/?p=zpackage;a=commitdiff_plain;h=7d16c50a5abf9b605e59859fc29e29757f857df5 fix some todo items --- diff --git a/zpm-add.c b/zpm-add.c index d72a789..86b289d 100644 --- a/zpm-add.c +++ b/zpm-add.c @@ -440,7 +440,6 @@ int main(int ac, char **av) { char *pkgid; pkgstr = av[optind++]; pkgid = zpm_findpkg(&zpm, pkgstr, NULL); - /* TODO if not found, error */ if (!pkgid) { die("package %s not found\n", pkgstr); } diff --git a/zpm-parse.c b/zpm-parse.c index ec05356..896dba9 100644 --- a/zpm-parse.c +++ b/zpm-parse.c @@ -36,10 +36,11 @@ int main(int ac, char **av) { pver = pver || pdefault; prel = prel || pdefault; - /* TODO need to quote single quotes for eval'able output */ for (i=optind; i= 1 && pname) { if (eval) { printf("name='%s'\n", name); diff --git a/zpm-syncfs.c b/zpm-syncfs.c index 0e82b13..220ee03 100644 --- a/zpm-syncfs.c +++ b/zpm-syncfs.c @@ -697,7 +697,9 @@ static int remove_files(void *f, int ncols, char **vals, char **cols) { if (lstat(dest, &st) == -1) { switch (errno) { case ENOENT: - /* TODO chatter if verbose */ + if (conf->verbose > 1) { + fprintf(stderr, "expected file not found: '%s'\n", dest); + } break; default: return seterror(conf, "can't stat %s: %s", dest, strerror(errno)); @@ -721,7 +723,7 @@ static int remove_files(void *f, int ncols, char **vals, char **cols) { break; case ENOTEMPTY: /* fall through */ case EEXIST: - /* TODO chatter, or possibly require */ + fprintf(stderr, "expected empty directory: %s\n", dest); break; default: return seterror(conf, "can't unlink %s: %s", dest, strerror(errno)); @@ -939,7 +941,7 @@ static int adjust_for_config(struct nitem *n, unsigned int diffs) { int isdir = (diffs & D_ISDIR); int eisdir = (diffs & D_EISDIR); - /* TODO what if old was a directory? */ + /* what if old was a directory? */ if (!n->configuration) { /* replacing conf with non-conf */ /* absorb file, mark todo */ @@ -1157,7 +1159,7 @@ static int install_files(void *f, int ncols, char **vals, char **cols) { struct stat existing; int update = 0; - /* TODO put the result row in a hash table. May not actually + /* put the result row in a hash table? May not actually * be faster */ if (!read_item(conf, ncols, vals, cols, &nitem)) { @@ -1260,6 +1262,7 @@ static int install_files(void *f, int ncols, char **vals, char **cols) { * and group, it might be correct on disk * but not as in the local database */ + /* TODO detect whether this a logic bug or * an on-disk difference */ @@ -1331,7 +1334,9 @@ static int install_files(void *f, int ncols, char **vals, char **cols) { } if (!mdsame && isdir && conf->ignoredirmd) { - /* TODO warn ignoring dir md */ + if (conf->verbose > 1) { + fprintf(stderr, "ignoring directory metadata difference: %s\n", nitem.dest); + } return 0; } @@ -1393,7 +1398,7 @@ static int install_files(void *f, int ncols, char **vals, char **cols) { /* error */ return seterror(conf, "%s (md+hash): %s", accept ? "existing file not acceptable" : "file exists", nitem.dest); } - /* TODO error, should be impossible */ + /* error, should be impossible */ return seterror(conf, "impossible state reached"); } @@ -1412,9 +1417,7 @@ static int install_files(void *f, int ncols, char **vals, char **cols) { /* existing path is a directory */ if (isdir) { /* fix md */ - /* impossible, if isdir and eisdir, would - * be same type - * TODO + /* impossible, if isdir and eisdir, would be same type */ return set_md(conf, &nitem); } else { @@ -1423,12 +1426,10 @@ static int install_files(void *f, int ncols, char **vals, char **cols) { return install(conf, &nitem, 11); } /* if we get here, we missed a case */ - /* TODO error */ return seterror(conf, "impossible state 2 reached"); } - /* TODO extra verbose print perms, mtime, etc, probably ls -l - * format + /* TODO extra verbose print perms, mtime, etc, probably ls -l format */ if (conf->verbose) { printf("%s\n", nitem.path); @@ -1586,12 +1587,10 @@ int main(int ac, char **av) { localdbfile = ZPM_LOCAL_DB; if ((s = getenv("ZPMDB"))) { - /* TODO does this need to be copied ? */ localdbfile = s; } if ((s = getenv("ZPM_ROOT_DIR"))) { - /* TODO does this need to be copied ? */ conf.rootdir = s; } @@ -1647,8 +1646,6 @@ int main(int ac, char **av) { } } - /* TODO find pkgid from arg */ - /* TODO set conf var to finalize error reporting */ if (conf.verbose) { fprintf(stderr, "syncing filesystem %s (ldb %s) from %s\n",