Skip to content

Commit

Permalink
Use read -r to no mangle backslashes
Browse files Browse the repository at this point in the history
Signed-off-by: Alberto Planas <[email protected]>
  • Loading branch information
aplanas committed May 16, 2024
1 parent 5d416e9 commit 0b1ab9e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions sbin/transactional-update.in
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ load_roles() {
xpath="//*[local-name()='system_role']"
xpath+="/*[local-name()='id']/text()"
local role patterns
while read role; do
while read -r role; do
xpath="//*[local-name()='system_role'][*[local-name()='id']='"$role"']"
xpath+="/*[local-name()='software']"
xpath+="/*[local-name()='default_patterns']/text()"
Expand All @@ -516,7 +516,7 @@ load_repo_alias() {
# Get the repositories, remove the ones that have duplicated URL,
# and sort by priority
local line
while read line; do
while read -r line; do
line=($line)
[ "${line[2]}" != "0" ] && REPOS+=("${line[0]} ${line[1]}")
done <<< $(callext zypper --root {} --xmlout lr | re_findall "$regex" | xargs -n4 | LC_COLLATE=C sort -k4 | uniq -f3 | LC_COLLATE=C sort -k2 -r)
Expand All @@ -531,18 +531,18 @@ load_buildtime_for_repo() {
regex+='|(?<=<time ).*?(?=/>)'

local name arch line epoch ver rel file build
while read name; do
read arch
read line; eval "$line"
read line; eval "$line"
while read -r name; do
read -r arch
read -r line; eval "$line"
read -r line; eval "$line"
[ ! -z "$name" ] && echo "${name}-${ver}-${rel}.${arch} $build" >> "$2"
done <<< $(zcat "$file" | re_findall "$regex")
}

# Read all the build time of installed packages
load_buildtime() {
local line
while read line; do
while read -r line; do
line=($line)
BUILDTIME["${line[0]}"]="${line[1]}"
done <<< $(callext rpm --root {} --query --all --queryformat='%{NVRA} %{BUILDTIME}\n')
Expand Down Expand Up @@ -613,15 +613,15 @@ load_packages_for_role() {
# Calculate the manifest document using the repository information
base_manifest() {
local pkg
while read pkg; do
while read -r pkg; do
grep "^$pkg " "$1" || echo "$pkg"
done <"$2"
}

# Calculate the manifest document from the current system
system_manifest() {
local pkg
while read pkg; do
while read -r pkg; do
if [ "${BUILDTIME["$pkg"]+_}" ]; then
echo "$pkg ${BUILDTIME["$pkg"]}"
else
Expand Down

0 comments on commit 0b1ab9e

Please sign in to comment.