Le Thursday 06 March 2014 à 14:25 +0100, Andreas Grünbacher a écrit :
> if you're *really* worried about the speed of this loop, a cleaner
> approach would
> be to remember all the patches in an array, e.g.,
> 
> declare -a patches
> while read tag dir arg1 arg2
> do
>     [...]
>         set -- "$arg1" $arg2
>         patches[${#patches[@]}]="$*"
>     [...]
> done < $tmpfile
> 
> if [ ${#patches[@]} -gt 0 ]
> then
>     [...]
>     (   echo ...
>         printf "%s\n" "${patches[@]}"
>     ) > "$prefix$dir/$QUILT_SERIES"
> fi

Bah, doesn't work actually :( "$dir" is local to the "while read" loop
above. And the reason for that is that there can be several tarballs,
and patches attached to each of them, with multiple series files. Which
means my own patch is broken, as it assumes a single series file. Our
test case doesn't test for this, which is why I didn't notice the
breakage.

I guess I don't care enough about it after all, and I am busy enough
with more urgent and important matters, so I'll just give up. If I must
spend more time on this, I'd rather extend the test case so that it
catches future mistakes like the one I just made. Thanks for catching
it, even if that wasn't on purpose ;-)

-- 
Jean Delvare
SUSE L3 Support


_______________________________________________
Quilt-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to