02-replace-preserves-others.sh (850B)
1 # Regression: `r` must preserve unlisted members in order, replace 2 # matching basenames in place, and append truly-new members. Each 3 # old member's name comes from the iterator's single shared name 4 # buffer, so the driver must copy it into stable storage before the 5 # next iter step (otherwise old members collapse to one name). 6 7 printf 'aaaa' > a.o 8 printf 'bbbbbbbb' > b.o 9 "$KIT" ar c lib.a a.o b.o 10 11 # Replace b.o (shorter content) and add c.o. 12 printf 'BBBBBB' > b.o 13 printf 'cccccccccccc' > c.o 14 echo "== rv (replace b, add c) ==" 15 "$KIT" ar rv lib.a b.o c.o 16 17 echo "== tv after rv ==" 18 "$KIT" ar tv lib.a 19 20 # Add a member that already exists alongside one that doesn't, in 21 # r mode (no v) — exercises the same code path silently. 22 printf 'AA' > a.o 23 printf 'dd' > d.o 24 "$KIT" ar r lib.a a.o d.o 25 echo "== tv after second r ==" 26 "$KIT" ar tv lib.a