Move the code which reads the default parameters for each command from quiltrc, from patchfns to the main quilt script. This is needed because the parsing of command line options needs to happen before we source patchfns, which is obviously not possible if some of the options are being set by patchfns itself.
Signed-off-by: Jean Delvare <[email protected]> --- OK, now I remember. The issue with this patch is that we are now sourcing $QUILTRC twice, once for the $QUILT_*_ARGS options in bin/quilt and once again for the other options in patchfns. This will incur a small performance penalty. Unfortunately the quilt commands are run in their own bash instance, presumably so that we can pass tracing options (-x and optionally -v) to it. I wonder if it would be possible to change the bash options dynamically (using shopt) so that we can run the actual quilt command in the same bash instance? Not only this would save the need to source $QUILTRC twice, but this would also skip loading a second bash entirely, which would presumably result in a performance gain. bin/quilt.in | 13 +++++++++++++ quilt/scripts/patchfns.in | 7 ------- 2 files changed, 13 insertions(+), 7 deletions(-) --- quilt.orig/bin/quilt.in 2020-10-05 13:50:54.182622705 +0200 +++ quilt/bin/quilt.in 2020-10-05 14:02:57.254493786 +0200 @@ -150,6 +150,19 @@ set -- "${args[@]}" unset args export QUILT_COMMAND="${command##*/}" + +if [ -e "$QUILTRC" ] +then + source "$QUILTRC" +fi + +# Add default arguments for this command +if [ -n "$QUILT_COMMAND" ]; then + args="QUILT_$(echo $QUILT_COMMAND | tr a-z A-Z)_ARGS" + eval set -- ${!args} \"\$@\" + unset args +fi + bash $BASH_OPTS -c ". $QUILT_DIR/$command" "quilt ${command##*/}" "$@" ### Local Variables: ### mode: shell-script --- quilt.orig/quilt/scripts/patchfns.in 2020-10-05 13:58:49.931840571 +0200 +++ quilt/quilt/scripts/patchfns.in 2020-10-05 14:02:57.255493797 +0200 @@ -33,13 +33,6 @@ then source "$QUILTRC" fi -# Add default arguments for this command -if [ -n "$QUILT_COMMAND" ]; then - args="QUILT_$(echo $QUILT_COMMAND | tr a-z A-Z)_ARGS" - eval set -- ${!args} \"\$@\" - unset args -fi - . $QUILT_DIR/scripts/utilfns # ======================================================== -- Jean Delvare SUSE L3 Support _______________________________________________ Quilt-dev mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/quilt-dev
