Summary: | --define deletes backslashes from the argument, but this is undocumented and useless | ||
---|---|---|---|
Product: | Sisyphus | Reporter: | Ivan Zakharyaschev <imz> |
Component: | rpm | Assignee: | placeholder <placeholder> |
Status: | CLOSED NOTABUG | QA Contact: | qa-sisyphus |
Severity: | enhancement | ||
Priority: | P3 | CC: | at, glebfm, imz, ldv, placeholder, vt |
Version: | unstable | ||
Hardware: | all | ||
OS: | Linux |
Description
Ivan Zakharyaschev
2017-09-13 21:23:42 MSK
The use of the backslashes in rpm turns out to be there for multiline values. In spec:
%define foo a\
b
or in command line:
$ rpm --define 'foo a\
> b' --eval '%foo'
a
b
$
This means we need to escape backslashes and perhaps need a special tool to do this (in scripts). printf %q is an incorrect "overkill" because it does also other kinds of escaping/quoting. Perhaps something like: rpm --define "foo $(sed -e 's:\:\\:g' <<<"$VALUE")"
$ VALUE='a\b'
$ echo "$VALUE"
a\b
$ rpm --define "foo $(sed -e 's:\\:\\\\:g' <<<"$VALUE")" --eval '%foo'
a\b
$
|