Re: [Rpm-maint] [rpm-software-management/rpm] Support new %[ ] expression expansion syntax (#846)

2019-09-18 Thread Michael Schroeder
@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

[Rpm-maint] [rpm-software-management/rpm] Support new %[ ] expression expansion syntax (#846)

2019-09-18 Thread Michael Schroeder
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

Re: [Rpm-maint] [rpm-software-management/rpm] Suppress inhibition lock warning message in single-user mode (#831)

2019-09-18 Thread Panu Matilainen
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__

Re: [Rpm-maint] [rpm-software-management/rpm] Suppress inhibition lock warning message in single-user mode (#831)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] expression expansion (#834)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] Add ternary operator support to expression parser (#838)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] Add ternary operator support to expression parser (#838)

2019-09-18 Thread Panu Matilainen
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_

Re: [Rpm-maint] [rpm-software-management/rpm] Add ternary operator support to expression parser (#838)

2019-09-18 Thread Michael Schroeder
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

Re: [Rpm-maint] [rpm-software-management/rpm] Add ternary operator support to expression parser (#838)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] Add ternary operator support to expression parser (#838)

2019-09-18 Thread pavlinamv
@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

Re: [Rpm-maint] [rpm-software-management/rpm] Add ternary operator support to expression parser (#838)

2019-09-18 Thread Michael Schroeder
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__

Re: [Rpm-maint] [rpm-software-management/rpm] Localize our chroot in/out operations to minimize time spent inside (#836)

2019-09-18 Thread ニール・ゴンパ
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

Re: [Rpm-maint] [rpm-software-management/rpm] Add ternary operator support to expression parser (#838)

2019-09-18 Thread Panu Matilainen
@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://

Re: [Rpm-maint] [rpm-software-management/rpm] expression expansion (#834)

2019-09-18 Thread Michael Schroeder
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

Re: [Rpm-maint] [rpm-software-management/rpm] Trap division by zero in expression parser (#844)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] Stop expanding strings in the expression parser (#845)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] Stop expanding strings in the expression parser (#845)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] Trap division by zero in expression parser (#844)

2019-09-18 Thread Panu Matilainen
@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

Re: [Rpm-maint] [rpm-software-management/rpm] Trap division by zero in expression parser (#844)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] Trap division by zero in expression parser (#844)

2019-09-18 Thread Michael Schroeder
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

Re: [Rpm-maint] [rpm-software-management/rpm] Add ternary operator support to expression parser (#838)

2019-09-18 Thread pavlinamv
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

[Rpm-maint] [rpm-software-management/rpm] Stop expanding strings in the expression parser (#845)

2019-09-18 Thread Michael Schroeder
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,

Re: [Rpm-maint] [rpm-software-management/rpm] Do not allow to divide by 0 in the expression evaluation (#833)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] Do not allow to divide by 0 in the expression evaluation (#833)

2019-09-18 Thread Panu Matilainen
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

[Rpm-maint] [rpm-software-management/rpm] Trap division by zero in expression parser (#844)

2019-09-18 Thread Panu Matilainen
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:/

Re: [Rpm-maint] [rpm-software-management/rpm] Do not allow to divide by 0 in the expression evaluation (#833)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] Trap division by zero in expression parser (#843)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] Do not allow to divide by 0 in the expression evaluation (#833)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] Do not allow to divide by 0 in the expression evaluation (#833)

2019-09-18 Thread Panu Matilainen
@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

Re: [Rpm-maint] [rpm-software-management/rpm] Trap division by zero in expression parser (#843)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] Trap division by zero in expression parser (#843)

2019-09-18 Thread Panu Matilainen
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

[Rpm-maint] [rpm-software-management/rpm] Trap division by zero in expression parser (#843)

2019-09-18 Thread Panu Matilainen
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:/

Re: [Rpm-maint] [rpm-software-management/rpm] Remove TOK_IDENTIFIER support from expression parsing (#840)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] Remove TOK_IDENTIFIER support from expression parsing (#840)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] Do not allow to divide by 0 in the expression evaluation (#833)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] Remove TOK_IDENTIFIER support from expression parsing (#840)

2019-09-18 Thread Michael Schroeder
@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

Re: [Rpm-maint] [rpm-software-management/rpm] Remove TOK_IDENTIFIER support from expression parsing (#840)

2019-09-18 Thread Michael Schroeder
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___

Re: [Rpm-maint] [rpm-software-management/rpm] Print an error for expressions with missing operands (#841)

2019-09-18 Thread Michael Schroeder
(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

Re: [Rpm-maint] [rpm-software-management/rpm] Remove TOK_IDENTIFIER support from expression parsing (#840)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] Do not allow to divide by 0 in the expression evaluation (#833)

2019-09-18 Thread pavlinamv
@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

Re: [Rpm-maint] [rpm-software-management/rpm] Remove TOK_IDENTIFIER support from expression parsing (#840)

2019-09-18 Thread Michael Schroeder
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/

Re: [Rpm-maint] [rpm-software-management/rpm] Remove TOK_IDENTIFIER support from expression parsing (#840)

2019-09-18 Thread Michael Schroeder
("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

Re: [Rpm-maint] [rpm-software-management/rpm] Remove TOK_IDENTIFIER support from expression parsing (#840)

2019-09-18 Thread Michael Schroeder
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

Re: [Rpm-maint] [rpm-software-management/rpm] Fix type error introduced in commit 1d055ae1df90fe54cf5c056de085cd987… (#842)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] Drop slen from builtin macro parser function (#839)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] Drop slen from builtin macro parser function (#839)

2019-09-18 Thread Panu Matilainen
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

[Rpm-maint] [rpm-software-management/rpm] Fix type error introduced in commit 1d055ae1df90fe54cf5c056de085cd987… (#842)

2019-09-18 Thread Panu Matilainen
…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 --

Re: [Rpm-maint] [rpm-software-management/rpm] Add ternary operator support to expression parser (#838)

2019-09-18 Thread pavlinamv
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

Re: [Rpm-maint] [rpm-software-management/rpm] Remove TOK_IDENTIFIER support from expression parsing (#840)

2019-09-18 Thread Panu Matilainen
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

Re: [Rpm-maint] [rpm-software-management/rpm] expression expansion (#834)

2019-09-18 Thread Panu Matilainen
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