We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pkg unlock -a
The unlock command with the -a switch will terminate with failure if it encounters the first package that is not unlocked.
unlock
-a
The following is an example using the "ruby" package.
# pkg lock -y ruby Locking ruby-3.2.3,1 # pkg unlock -ay 0ad-0.0.26_23: already unlocked # pkg unlock -y ruby Unlocking ruby-3.2.3,1
I expected the following.
# pkg lock -y ruby Locking ruby-3.2.3,1 # pkg unlock -ay Unlocking ruby-3.2.3,1
I don't know what behavior is preferable, so here is a patch I wrote anyway.
diff --git a/src/lock.c b/src/lock.c index fdcf629ef..6120ae489 100644 --- a/src/lock.c +++ b/src/lock.c @@ -42,8 +42,8 @@ enum action { }; static int exec_lock_unlock(int, char**, enum action); -static int do_lock(struct pkgdb *db, struct pkg *pkg); -static int do_unlock(struct pkgdb *db, struct pkg *pkg); +static int do_lock(struct pkgdb *db, struct pkg *pkg, int match); +static int do_unlock(struct pkgdb *db, struct pkg *pkg, int match); void usage_lock(void) @@ -55,9 +55,11 @@ usage_lock(void) } static int -do_lock(struct pkgdb *db, struct pkg *pkg) +do_lock(struct pkgdb *db, struct pkg *pkg, int match) { if (pkg_is_locked(pkg)) { + if (match == MATCH_ALL) + return (EPKG_OK); if (!quiet) pkg_printf("%n-%v: already locked\n", pkg, pkg); @@ -76,9 +78,11 @@ do_lock(struct pkgdb *db, struct pkg *pkg) static int -do_unlock(struct pkgdb *db, struct pkg *pkg) +do_unlock(struct pkgdb *db, struct pkg *pkg, int match) { if (!pkg_is_locked(pkg)) { + if (match == MATCH_ALL) + return (EPKG_OK); if (!quiet) pkg_printf("%n-%v: already unlocked\n", pkg, pkg); return (EPKG_FATAL); @@ -124,9 +128,9 @@ do_lock_unlock(struct pkgdb *db, int match, const char *pkgname, } tll_foreach(pkgs, p) { if (action == LOCK) - retcode = do_lock(db, p->item); + retcode = do_lock(db, p->item, match); else - retcode = do_unlock(db, p->item); + retcode = do_unlock(db, p->item, match); if (retcode != EPKG_OK) { exitcode = EXIT_FAILURE;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The
unlock
command with the-a
switch will terminate with failure if it encounters the first package that is not unlocked.The following is an example using the "ruby" package.
I expected the following.
I don't know what behavior is preferable, so here is a patch I wrote anyway.
The text was updated successfully, but these errors were encountered: