@mlschroe pushed 1 commit.
630966ce35c39ac5a8c2a2583099a4165ac15c6f Implement short-circuit for logical
and ternary operators
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/846/files/b956786e490c221b6
This adds %[ expr ] as a new means to do expression expansion in rpm. Unlike
%{expr:} the expression is expanded in the parser, so we are safe against
expansion results messing up the syntax and also can to short-circuiting.
You can view, comment on, or merge this pull request online at:
https
Much better, thanks. As I don't see a better way to do it with systemd...
Thanks for the patch!
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/831#issuecomment-532667312__
Merged #831 into master.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/831#event-2643367507___
Rpm-maint mailing list
Rpm-maint
Hmm. It's on the subtle side, and such things aren't the easiest to communicate
to the packager community at large. But lets see...
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/r
Merged #838 into master.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/838#event-2643253274___
Rpm-maint mailing list
Rpm-maint
Okay, looks nice and contained to me. Thanks a bunch!
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/838#issuecomment-532654226_
mlschroe commented on this pull request.
> + result = v1->data.i != 0;
+ break;
+ case VALUE_TYPE_STRING:
+ result = v1->data.s[0] != '\0';
+ break;
+ default:
+ goto err;
+}
+valueFree(v1);
+if (rdToken(state))
+ goto err;
+v1 = doTerna
pmatilai commented on this pull request.
> + result = v1->data.i != 0;
+ break;
+ case VALUE_TYPE_STRING:
+ result = v1->data.s[0] != '\0';
+ break;
+ default:
+ goto err;
+}
+valueFree(v1);
+if (rdToken(state))
+ goto err;
+v1 = doTerna
@mlschroe: Thank you. The PR looks good to me.
@pmatilai After the mentioned example there is a list of operators that can be
used in a condition after
```
%if
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://git
I added the ternary operator to the list of supported operators.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/838#issuecomment-532641740__
Conan-Kudo approved this pull request.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/836#pullrequestreview-289845857___
Rpm
@pavlinamv , what do you mean by changing those conditionals in the
documentation? I don't see them needing changing because of this, but maybe I'm
missing something.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://
No, don't drop it. It's still useful if you need to do expansion before calling
the expression parser.
I.e. you have either 'expand first, then don't expand in the expression parser'
or 'expand in the expression parser':
```
%define test 1 + 2
%{expr:%test}
# the next line expands twice!
%{expand
Merged #844 into master.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/844#event-2643132460___
Rpm-maint mailing list
Rpm-maint
Merged #845 into master.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/845#event-2643127825___
Rpm-maint mailing list
Rpm-maint
pmatilai approved this pull request.
Agreed. Thanks for the patch.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/845#pullrequestreview-289842999
@pmatilai pushed 1 commit.
df5d5b712b6210702c5b399f716780331b5a8b47 Trap division by zero in expression
parser
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/844/files/ee5bda0a5abe968b5c9a8daeea4a4f4a
pmatilai commented on this pull request.
> @@ -438,6 +438,10 @@ static Value doMultiplyDivide(ParseState state)
if (valueIsInteger(v1)) {
int i1 = v1->data.i, i2 = v2->data.i;
+ if ((i2 == 0) && (TOK_DIVIDE)) {
Ugh, yeah:
```
$ ./rpm --eval "%{expr:1*0}"
error: division by z
mlschroe commented on this pull request.
> @@ -438,6 +438,10 @@ static Value doMultiplyDivide(ParseState state)
if (valueIsInteger(v1)) {
int i1 = v1->data.i, i2 = v2->data.i;
+ if ((i2 == 0) && (TOK_DIVIDE)) {
Is `(TOK_DIVIDE)` supposed to be `(op == TOK_DIVIDE)`?
--
You a
Could you change file
```
rpm/doc/manual/spec
```
in section "Conditionals" the text after example:
```
%if 0%{?fedora} > 10 || 0%{?rhel} > 7
```
according of the PR?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https
The %if lines in the specfile are expanded before the expressions
get evaluated, so the re-expansion of strings is surprising.
It's also not done for integers, which makes it inconsistent.
The original expression parser seems to have been written
without taking the upfront expansion into account,
Hmm, but GH doesn't let me merge despite resolving the conflicts. What a mess,
probably my fault.
I'll handle via #844 separately.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rp
Closed #833.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/833#event-2643037718___
Rpm-maint mailing list
Rpm-maint@lists.rpm.o
You can view, comment on, or merge this pull request online at:
https://github.com/rpm-software-management/rpm/pull/844
-- Commit Summary --
* Trap division by zero in expression parser
-- File Changes --
M rpmio/expression.c (4)
M tests/rpmmacro.at (2)
-- Patch Links --
https:/
pmatilai approved this pull request.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/833#pullrequestreview-289822247___
Rpm-m
Closed #843.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/843#event-2643005419___
Rpm-maint mailing list
Rpm-maint@lists.rpm.o
Merged the conflict manually.
Thanks.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/833#issuecomment-532626179___
Rpm-maint mai
@pmatilai pushed 1 commit.
8ac1d0b720b57b02904108b17e90e81d0a48afff Merge branch 'master' into divisionnil
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/833/files/dd010e8e12ab13da4bae3a63f5f6610e22cc8
Reopened #843.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/843#event-2642992993___
Rpm-maint mailing list
Rpm-maint@lists.rpm
Closed #843.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/843#event-2642978604___
Rpm-maint mailing list
Rpm-maint@lists.rpm.o
You can view, comment on, or merge this pull request online at:
https://github.com/rpm-software-management/rpm/pull/843
-- Commit Summary --
* Trap division by zero in expression parser
-- File Changes --
M rpmio/expression.c (4)
M tests/rpmmacro.at (2)
-- Patch Links --
https:/
pmatilai approved this pull request.
Heh, seems you took my remark about being nice rather literally, with "please"
and all in the message :D
Anyway, works for me, thanks for the patch!
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view
Merged #840 into master.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/840#event-2642953609___
Rpm-maint mailing list
Rpm-maint
Meh. Error messages are not about telling people what they may or may not do
when they *just did*. The message should simply be "error: division by zero"
and no further lecturing on the subject.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or
@mlschroe pushed 1 commit.
cd764dbd89f56c7714d94d601c70453d1191ac2d Remove TOK_IDENTIFIER support from
expression parsing
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/840/files/08e34e0929d7278c3b7e6
Right, I'll add a different error message for bare strings.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/840#issuecomment-532607547___
(Sorry for the bad copy&paste with `&state`. Seems I patched it correctly when
I did the change in the fedora chroot I use for testing but then messed it up
when re-doing it in the git tree.)
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or vi
FWIW, the amount of breakage in Fedora is on similar level. Like noted, no
problems with that.
If we want to be nice about it, we could add a warning about it to 4.15, but
that's another topic.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or
@pavlinamv pushed 1 commit.
8e919739e766840626d17b0891bdc27ac6be776e Prevent dividing by 0 in the
expression evaluation
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/833/files/79055aa02f143734ba5e783
Oh, Panu already decided to go with it. Sorry for the noise ;)
I'll change the message and also do a rebase to fix the conflict.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/
("Lots" meaning 26 spec files in Factory, which actually isn't that much. If
Panu decides to drop support for bare strings I'm also fine with that ;) )
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-s
So I grepped through the SUSE specs, and it seems we're stuck with bare
literals. Lots of specs using
things like `%if %llvm == yes` or `%if %{_lib} == lib64` or `%_arch == s390x`.
So I'll redo this pull request so that it keeps that functionality.
--
You are receiving this because you are subs
Merged #842 into master.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/842#event-2642566615___
Rpm-maint mailing list
Rpm-maint
pmatilai approved this pull request.
Right, I guess the only case where %define/%global can be followed by something
is the "silent grouping" with {} eg ```rpm --eval "%define foo {bar}
%{warn:issue}" --eval "%foo"``` and that behavior doesn't change here.
--
You are receiving this because y
Merged #839 into master.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/839#event-264296___
Rpm-maint mailing list
Rpm-maint
…f0f6bbf
"state" is a pointer in this function, we don't want a pointer to
it.
Fixes garbage getting printed in the error message. Add a testcase too.
You can view, comment on, or merge this pull request online at:
https://github.com/rpm-software-management/rpm/pull/842
-- Commit Summary --
Thank you. It solves the problem.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/838#issuecomment-532561398___
Rpm-maint mailing
Requiring quotes around strings explicitly seems only a good thing to me. And
since that's how it originally was, only accidentally changed in that commit so
this is actually a regression fix :)
It does trip up more than just a handful of specs in Fedora, but not a major
breakage and like noted
Note that if we add %[] for expressions then I think we should drop %{expr:...}
entirely, it hardly serves any purpose then.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issu
50 matches
Mail list logo