xbps-checkvers: fixed an endless loop with "reverts" containing extra alphanumeric chars.
This commit is contained in:
		
							
								
								
									
										4
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								NEWS
									
									
									
									
									
								
							| @@ -1,5 +1,9 @@ | ||||
| xbps-0.48 (???): | ||||
|  | ||||
|  * xbps-checkvers(1): fixed an endless loop while processing templates containing | ||||
|    extra alphanumeric characters in the `reverts' object. Added a new testcase | ||||
|    to verify its correctness. | ||||
|  | ||||
| xbps-0.47 (2015-07-18): | ||||
|  | ||||
|  * When executing pkg configuration, override the umask with sane defaults. | ||||
|   | ||||
| @@ -533,7 +533,7 @@ check_reverts(const char *repover, const map_item_t reverts) | ||||
| 		 * Check if it's the first character or the previous character is a | ||||
| 		 * whitespace. | ||||
| 		 */ | ||||
| 		if (p > sreverts && !isspace(p[-1])) | ||||
| 		if (p > sreverts && !isalpha(p[-1]) && !isspace(p[-1])) | ||||
| 			continue; | ||||
| 		p += strlen(repover); | ||||
| 		/* | ||||
|   | ||||
| @@ -301,6 +301,36 @@ EOF | ||||
| 	atf_check_equal "$out" "pkgname: A repover: 1.1_1 srcpkgver: 1.0_1" | ||||
| } | ||||
|  | ||||
| atf_test_case reverts_alpha | ||||
|  | ||||
| reverts_alpha_head() { | ||||
| 	atf_set "descr" "xbps-checkvers(8): test with reverts containing an alphanumeric character" | ||||
| } | ||||
|  | ||||
| reverts_alpha_body() { | ||||
| 	mkdir -p some_repo pkg_A void-packages/srcpkgs/fs-utils | ||||
| 	touch pkg_A/file00 | ||||
| 	cat > void-packages/srcpkgs/fs-utils/template <<EOF | ||||
| pkgname=fs-utils | ||||
| reverts=v1.10_1 | ||||
| version=1.10 | ||||
| revision=1 | ||||
| do_install() { | ||||
| 	: | ||||
| } | ||||
| EOF | ||||
| 	cd some_repo | ||||
| 	xbps-create -A noarch -n fs-utils-1.10_1 -s "A pkg" ../pkg_A | ||||
| 	atf_check_equal $? 0 | ||||
| 	xbps-rindex -d -a $PWD/*.xbps | ||||
| 	atf_check_equal $? 0 | ||||
| 	cd .. | ||||
| 	xbps-checkvers -R $PWD/some_repo -D $PWD/void-packages | ||||
| 	out=`xbps-checkvers -R $PWD/some_repo -D $PWD/void-packages` | ||||
| 	atf_check_equal $? 0 | ||||
| 	atf_check_equal "$out" "pkgname: fs-utils repover: 1.10_1 srcpkgver: 1.10_1" | ||||
| } | ||||
|  | ||||
| atf_init_test_cases() { | ||||
| 	atf_add_test_case srcpkg_newer | ||||
| 	atf_add_test_case srcpkg_newer_with_refs | ||||
| @@ -313,4 +343,5 @@ atf_init_test_cases() { | ||||
| 	atf_add_test_case srcpkg_missing_pkgver | ||||
| 	atf_add_test_case srcpkg_missing_pkgverrev | ||||
| 	atf_add_test_case reverts | ||||
| 	atf_add_test_case reverts_alpha | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user