Fix a macro end detection if the first char of a macro line is '}' (#401)
The algorithm that detects the end of a macro counts for all macro chars their level of nested. It iteratively moves from the first char of the macro further. Before the patch the rpm function does not implement this algorithm correctly. After finishing with the last char of a macro line, it additionally skips one char of the next line. The first char in the line was omitted. Probably affects every rpm version from this millenium.
This commit is contained in:
parent
db88f48061
commit
2456c12894
|
@ -237,7 +237,7 @@ rdcl(char * buf, size_t size, FILE *f)
|
|||
*(++q) = '\0'; /* trim trailing \r, \n */
|
||||
break;
|
||||
}
|
||||
q++; p++; nb++; /* copy newline too */
|
||||
q++; nb++; /* copy newline too */
|
||||
size -= nb;
|
||||
if (*q == '\r') /* XXX avoid \r madness */
|
||||
*q = '\n';
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
# RPM macros for test 'macro with a line starting by "{"'
|
||||
|
||||
%def is_defined
|
||||
%first %{?def:macro_1\
|
||||
}
|
||||
%second %{?def:macro_2}
|
|
@ -427,3 +427,15 @@ is verbose
|
|||
is verbose text
|
||||
])
|
||||
AT_CLEANUP
|
||||
|
||||
AT_SETUP([macro with a line starting by "{"])
|
||||
AT_KEYWORDS([macros])
|
||||
AT_CHECK([
|
||||
runroot rpm --macros "/data/macros.testfile" \
|
||||
--eval "%first" --eval "%second"],
|
||||
[0],
|
||||
[macro_1
|
||||
|
||||
macro_2
|
||||
])
|
||||
AT_CLEANUP
|
Loading…
Reference in New Issue