ar: Correct -N COUNT off-by-one
authorMark Wielaard <mark@klomp.org>
Sun, 28 Aug 2022 15:46:08 +0000 (17:46 +0200)
committerMark Wielaard <mark@klomp.org>
Wed, 14 Sep 2022 18:48:29 +0000 (20:48 +0200)
commit6cb01b4ef3cdd4f83d21bbcec72fa66712ac14e6
tree5e37ea849e6d667903ff56623f5bc4ea0b8925b5
parentee188125b10d1588a0536af033d7b7b1bbbaafaf
ar: Correct -N COUNT off-by-one

When using instance [COUNT], the instance check is wrong.
instance-- == 0 should be --instance == 0.

Add a testcase run-ar-N.sh that uses -N COUNT with extract and delete
operations checking the right instance was extracted and deleted.

https://sourceware.org/bugzilla/show_bug.cgi?id=28725

Reported-by: panxiaohe <panxh_ran@163.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
src/ChangeLog
src/ar.c
tests/ChangeLog
tests/Makefile.am
tests/run-ar-N.sh [new file with mode: 0755]