extfs: rpm: use printf instead of echo, when retrieving fields.

We switch to using 'echo' instead of 'printf', for the reason described in a
previous commit.

This time, however, we don't do this in order to preserve the value of the
DESCRIPTION field (because we retrieve it using some other command). We do this
for two reasons:

* As chance would have it, we have the string '\c' in our DESCRIPTION. It turns
  out that Dash's echo interprets '\c' to mean the end of the data[1], so
  fields stored in $AllTAGS after DESCRIPTION aren't seen by our sed script
  (resulting in the helper not reporting a few file entries).

* We also have '\n' in DESCRIPTION. This would translate, by echo, into
  newline, failing the naive sed script.

[1] See "\c as in SYSV echo - abort all processing..." in the source code of
    Dash: https://github.com/gioele/dash/blob/master/src/bltin/printf.c

Signed-off-by: Mooffie <mooffie@gmail.com>
This commit is contained in:
Mooffie 2017-03-08 18:56:05 +02:00
parent 25aa5db3fd
commit a6cd7c9f45

View File

@ -122,7 +122,8 @@ mcrpmfs_getRawOneTag()
mcrpmfs_getOneTag()
{
echo "$AllTAGS" | $SED "s/.*|${1}=//" | cut -d '|' -f 1
# 'echo' can't be used for arbitrary data (see commit message).
printf "%s" "$AllTAGS" | $SED "s/.*|${1}=//" | cut -d '|' -f 1
}
mcrpmfs_printOneMetaInfo()