Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 73520 - small bug in the fn_getprotectedname function of webapp-config
Summary: small bug in the fn_getprotectedname function of webapp-config
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Web Application Packages Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-05 22:57 UTC by Ross Dougherty
Modified: 2005-05-30 04:21 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
webapp-config.patch (webapp-config.patch,928 bytes, patch)
2004-12-05 22:58 UTC, Ross Dougherty
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Dougherty 2004-12-05 22:57:09 UTC
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
Comment 1 Ross Dougherty 2004-12-05 22:58:28 UTC
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\"`"
 }
Comment 2 Stuart Herbert (RETIRED) gentoo-dev 2005-05-30 04:21:52 UTC
Thanks.  This fix will appear in webapp-config v1.11.