While creating and testing an ebuild which uses the webapp eclass I was doing a lot of merging and unmerging, this generated a lot of configprotect files. When it should of generated ._cfg0009_.. webapp-config started spitting out errors: /usr/sbin/webapp-config: line 1215: ((: my_number = 0008: value too great for base (error token is "0008") /usr/sbin/webapp-config: line 1216: printf: 0008: invalid number Reproducible: Always Steps to Reproduce: echo $((0008+1)) Actual Results: -bash: 0008: value too great for base (error token is "0008") Expected Results: 9
Created attachment 45360 [details, diff] webapp-config.patch --- webapp-config.orig 2004-12-06 17:09:29.659854000 +1100 +++ /usr/sbin/webapp-config 2004-12-06 17:56:04.709275122 +1100 @@ -1200,19 +1200,17 @@ local my_filedir="`dirname \"$2\"`" # step 2 - find the highest numbered protected file that already - # exists, in case there are any + # exists and increment it by one, in case there are any local my_prot="`find \"$1/${my_filedir}/\" -name \"${G_CONFIGPREFIX}????_${my_file}\" -print 2>&1 | sort | tail -n 1`" if [ -n "$my_prot" ] ; then # extract the number - my_number="`echo \"$my_prot\" | sed -e 's/^.*_cfg\([0-9]\+\).*/\1/g;'`" + my_number="`expr match \"$my_prot\" '.*_cfg\([0-9]\+\).*' + 1`" fi - # step 3 - we have our number - # increment by one, and build our name + # step 3 - we have our number, build our name - (( my_number = $my_number + 1 )) my_return="`printf \"${my_filedir}/${G_CONFIGPREFIX}%04.4d_${my_file}\" \"$my_number\"`" }
Thanks. This fix will appear in webapp-config v1.11.