base-files: quote values when evaluating uevent
When sourcing /sys/class/block/*/uevent values have to be quoted as they may contain spaces (e.g. in PARTNAME). Fix this by pre-processing with sed before sourcing. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
		 Daniel Golle
					Daniel Golle
				
			
				
					committed by
					
						 John Crispin
						John Crispin
					
				
			
			
				
	
			
			
			 John Crispin
						John Crispin
					
				
			
						parent
						
							25a72f5a01
						
					
				
				
					commit
					da52dd0c83
				
			| @@ -134,8 +134,7 @@ export_bootdevice() { | |||||||
| 		esac | 		esac | ||||||
|  |  | ||||||
| 		if [ -e "$uevent" ]; then | 		if [ -e "$uevent" ]; then | ||||||
| 			. "$uevent" | 			eval "$(sed "s/=\(.*\)/=\'\1\'/" < "$uevent")" | ||||||
|  |  | ||||||
| 			export BOOTDEV_MAJOR=$MAJOR | 			export BOOTDEV_MAJOR=$MAJOR | ||||||
| 			export BOOTDEV_MINOR=$MINOR | 			export BOOTDEV_MINOR=$MINOR | ||||||
| 			return 0 | 			return 0 | ||||||
| @@ -150,7 +149,7 @@ export_partdevice() { | |||||||
| 	local uevent MAJOR MINOR DEVNAME DEVTYPE | 	local uevent MAJOR MINOR DEVNAME DEVTYPE | ||||||
|  |  | ||||||
| 	for uevent in /sys/class/block/*/uevent; do | 	for uevent in /sys/class/block/*/uevent; do | ||||||
| 		. "$uevent" | 		eval "$(sed "s/=\(.*\)/=\'\1\'/" < "$uevent")" | ||||||
| 		if [ $BOOTDEV_MAJOR = $MAJOR -a $(($BOOTDEV_MINOR + $offset)) = $MINOR -a -b "/dev/$DEVNAME" ]; then | 		if [ $BOOTDEV_MAJOR = $MAJOR -a $(($BOOTDEV_MINOR + $offset)) = $MINOR -a -b "/dev/$DEVNAME" ]; then | ||||||
| 			export "$var=$DEVNAME" | 			export "$var=$DEVNAME" | ||||||
| 			return 0 | 			return 0 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user