labs: fix snapshot taking for ssh installs
autostart_from_config reads the config/scripts.* files from stdin. That works as long as nothing messes with the standard file descriptors. When we use ssh to execute scripts within the autostart_from_config reading loop, stdin is no longer safe. The result is that config files are only read until the first boot command is encountered and executed, which for the current configuration files means that the final snapshot command is skipped. To fix this bug, the patch opens the config file on file descriptor 3 where it is safe from ssh. Change-Id: I2880a8b301c6032b1e077bd458b2b25a89552b89
This commit is contained in:
parent
5a32910539
commit
77c3156e61
@ -263,7 +263,11 @@ function autostart_from_config {
|
||||
fi
|
||||
|
||||
log_autostart_source "$config_file"
|
||||
while read -r field_1 field_2; do
|
||||
|
||||
# Open file on file descriptor 3 so programs we call in this loop (ssh)
|
||||
# are free to mess with the standard file descriptors.
|
||||
exec 3< "$config_path"
|
||||
while read -r field_1 field_2 <&3; do
|
||||
if [[ $field_1 =~ ^# ]]; then
|
||||
# Skip lines that are commented out
|
||||
continue
|
||||
@ -282,7 +286,7 @@ function autostart_from_config {
|
||||
echo >&2 _autostart_queue "$field_1/$field_2"
|
||||
_autostart_queue "$field_1/$field_2"
|
||||
fi
|
||||
done < "$config_path"
|
||||
done
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user