From bc92b387cb1bc4aa17dfc153155de63c403ebf53 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 23 Aug 2014 16:25:51 +0200 Subject: [PATCH] Really fix #53 this time: with or without -n. --- bin/xbps-install/main.c | 3 ++- tests/xbps/xbps-install/behaviour_tests.sh | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/xbps-install/main.c b/bin/xbps-install/main.c index b8aa47cf..20c01886 100644 --- a/bin/xbps-install/main.c +++ b/bin/xbps-install/main.c @@ -236,9 +236,10 @@ main(int argc, char **argv) rv = exec_transaction(&xh, maxcols, yes, drun); } else if (!update) { /* Install target packages */ + int npkgs = argc - optind; for (i = optind; i < argc; i++) { rv = install_new_pkg(&xh, argv[i], reinstall); - if (optind >= 2 && rv == EEXIST) { + if (npkgs >= 2 && rv == EEXIST) { rv = 0; } else if (rv != 0) { xbps_pkgdb_unlock(&xh); diff --git a/tests/xbps/xbps-install/behaviour_tests.sh b/tests/xbps/xbps-install/behaviour_tests.sh index 0c71f86d..24a5de8c 100644 --- a/tests/xbps/xbps-install/behaviour_tests.sh +++ b/tests/xbps/xbps-install/behaviour_tests.sh @@ -22,9 +22,13 @@ install_existent_body() { cd .. xbps-install -r root -C empty.conf --repository=$PWD/some_repo -y A atf_check_equal $? 0 - xbps-install -r root -C empty.conf --repository=$PWD/some_repo -yn A B + xbps-install -r root -C empty.conf --repository=$PWD/some_repo -y A B atf_check_equal $? 0 - xbps-install -r root -C empty.conf --repository=$PWD/some_repo -yn B A + + rm -r root + xbps-install -r root -C empty.conf --repository=$PWD/some_repo -y A + atf_check_equal $? 0 + xbps-install -r root -C empty.conf --repository=$PWD/some_repo -y B A atf_check_equal $? 0 }