[Rpm-maint] [rpm-software-management/rpm] Support for x86-64 Microarchitecture Feature Levels? (#1521)

2021-01-27 Thread romulasry
https://www.phoronix.com/scan.php?page=news_item&px=GCC-11-x86-64-Feature-Levels

-- 
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/issues/1521___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Document thread-safety of librpm (#1483)

2021-01-27 Thread Colin Walters
FWIW in rpm-ostree we reimplement most of the RPM install path for multiple 
reasons (among them we "snapshot" multiple RPM versions into ostree commits as 
part of implementing transactional updates, we want to sandbox scripts etc.) 
but another big reason is that we simply cannot have librpm call `chroot()` - 
that has process-global effects.  

(Also on this topic btw rpm-ostree is oxidizing fast now, see e.g. 
https://github.com/coreos/rpm-ostree/pull/2502 which I just submitted - so if 
there's RPM+Rust topics it might come up there too)



-- 
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/issues/1483#issuecomment-768456090___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [rpm-software-management/rpm] Add %bcond macro for defining build conditionals (#1520)

2021-01-27 Thread Petr Viktorin
The names `%bcond_with` and `%bcond_without` are based the inner workings of 
the macros. They describe the inverse of their default; anecdotal evidence 
sugests that this is quite confusing in practice. I personally always have to 
stop and think when using/reviewing them.

This PR adds the macro `%bcond`, which does the same thing as either 
`%bcond_with` or `%bcond_without`, based on a numeric "default" value:

```
# To build with "gnutls" by default (equivalent to %bcond_without 
gnutls):
%bcond gnutls 1
# To build without "gnutls" default (equivalent to %bcond_with 
gnutls):
%bcond gnutls 0
```
It allows more complex defaults, simplifying a common if-elif pattern (see 
https://github.com/rpm-software-management/rpm/issues/941):
```
# By default, build with openssl iff not building with gnutls (but allow 
building with none or both)
%bcond openssl %{without gnutls}

# Enable some new feature that only works on Fedora 30+ with the gnutls crypto
%bcond new_feature %[ 0%fedora > 30 && %{with gnutls} ]
```
Documentation is changed to mention `%bcond` first – the only disadvantage I 
can see vs. the existing macros is that old RPM versions won't have it.

---

This is my first contribution to RPM. Please tell me all the things I'm 
doing wrong!
(e.g. should this be discussed somewhere first?)
You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/1520

-- Commit Summary --

  * Add %bcond macro for defining build conditionals

-- File Changes --

M doc/manual/conditionalbuilds.md (39)
M macros.in (53)
A tests/data/SPECS/bcondtest.spec (33)
M tests/rpmbuild.at (62)
M tests/rpmmacro.at (21)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/1520.patch
https://github.com/rpm-software-management/rpm/pull/1520.diff

-- 
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/1520
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] ‘hdrblobInit’: check pointer is 8-byte aligned (#1499)

2021-01-27 Thread Demi Marie Obenour
@pmatilai does this look okay?  I understand it isn’t high priority, but it 
makes the API that little bit safer.

-- 
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/1499#issuecomment-768386766___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] [WIP] Added fapolicyd plugin (#1475)

2021-01-27 Thread Radovan Sroka
@radosroka pushed 1 commit.

9b36cd27e0442c3e8dd2eb391bed7aab237b7e90  Added fapolicyd plugin


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1475/files/83b75dbe12a8d778089c01e0fd9f3e08fc0fe02e..9b36cd27e0442c3e8dd2eb391bed7aab237b7e90
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Check that count and data length are reasonable (#1492)

2021-01-27 Thread Demi Marie Obenour
@pmatilai does this revised version look good?

-- 
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/1492#issuecomment-768385550___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Forbid tag data with count zero (#1496)

2021-01-27 Thread Demi Marie Obenour
> Let's say not forgotten, just drowned in the mass. This is good to go so no 
> harm in pinging, it's one down even if many to go.
> 
> For the future, I'd say submitting fewer patches at once would probably work 
> better. Too many at once and the pipe just gets clogged :sweat_smile:

Understandable!  I made #1471 and then split it up, which resulted in many 
little patches.

> Anyway, thanks for the patch!

You’re welcome!

-- 
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/1496#issuecomment-768381550___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] [WIP] Added fapolicyd plugin (#1475)

2021-01-27 Thread Radovan Sroka
@radosroka pushed 1 commit.

83b75dbe12a8d778089c01e0fd9f3e08fc0fe02e  Added fapolicyd plugin


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1475/files/46bae1b13ba12e9d40f70f378c6846a881047c53..83b75dbe12a8d778089c01e0fd9f3e08fc0fe02e
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Document thread-safety of librpm (#1483)

2021-01-27 Thread Demi Marie Obenour
The reason I am asking is that I am working on (not yet published) Rust 
bindings to a small part of the RPM API.  Rust requires that safe code not be 
able to invoke undefined behavior.  Is it safe to `fork()` and then perform an 
RPM transaction in the child process, even if the parent was multithreaded?

-- 
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/issues/1483#issuecomment-768373701___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] [WIP] Added fapolicyd plugin (#1475)

2021-01-27 Thread Panu Matilainen
@pmatilai commented on this pull request.



> +(void) close(fapolicyd_state.fd);
+
+fapolicyd_state.fd = -1;
+}
+
+
+static rpmRC fapolicyd_psm_pre(rpmPlugin plugin, rpmte te)
+{
+if (fapolicyd_state.fd == -1)
+goto end;
+
+if (rpmteType(te) == TR_ADDED)
+fapolicyd_state.installed_package = 1;
+else
+fapolicyd_state.installed_package = 0;
+

Oh, actually: tracking this isn't really necessary, as fsm_file_prepare() will 
only ever be called for packages that are being installed. 

-- 
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/1475#pullrequestreview-577363917___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] [WIP] Added fapolicyd plugin (#1475)

2021-01-27 Thread Panu Matilainen
Some minor stylistic nits, but other that it seems quite fine to me now.

-- 
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/1475#issuecomment-768301915___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] [WIP] Added fapolicyd plugin (#1475)

2021-01-27 Thread Panu Matilainen
@pmatilai commented on this pull request.



> +if (!S_ISFIFO(s.st_mode)) {
+rpmlog(RPMLOG_DEBUG, "File: %s exists but it is not a pipe!\n", 
state->fifo_path);
+goto bad;
+}
+
+/* keep only file's permition bits */
+mode_t mode = s.st_mode & ~S_IFMT;
+
+/* we require pipe to have 0660 permission */
+if (mode != 0660) {
+
+rpmlog(RPMLOG_ERR, "File: %s has %o instead of 0660 \n",
+state->fifo_path,
+mode );
+
+goto bad;

Using empty lines for grouping and as visual aid is totally okay, but these two 
seem redundant/to the contrary to me at least.

-- 
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/1475#pullrequestreview-577358310___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] [WIP] Added fapolicyd plugin (#1475)

2021-01-27 Thread Panu Matilainen
@pmatilai commented on this pull request.



> +};
+
+static struct fapolicyd_data fapolicyd_state = {
+.fd = -1,
+.installed_package = -1,
+.changed_files = 0,
+.fifo_path = "/run/fapolicyd/fapolicyd.fifo",
+};
+
+static rpmRC open_fifo(struct fapolicyd_data* state)
+{
+int fd = -1;
+struct stat s;
+
+fd = open(state->fifo_path, O_RDWR);
+if(fd == -1) {

There's a missing space after the if.

-- 
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/1475#pullrequestreview-577356301___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] [WIP] Added fapolicyd plugin (#1475)

2021-01-27 Thread Panu Matilainen
@pmatilai commented on this pull request.



> +
+static rpmRC open_fifo(struct fapolicyd_data* state)
+{
+int fd = -1;
+struct stat s;
+
+fd = open(state->fifo_path, O_RDWR);
+if(fd == -1) {
+rpmlog(RPMLOG_DEBUG, "Open: %s -> %s\n", state->fifo_path, 
strerror(errno));
+goto bad;
+}
+
+if (stat(state->fifo_path, &s) == -1) {
+rpmlog(RPMLOG_DEBUG, "Stat: %s -> %s\n", state->fifo_path, 
strerror(errno));
+goto bad;
+} else {

This else-branch is redundant now with the gotos. Not wrong, but mildly 
confusing when there's no need for it.

-- 
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/1475#pullrequestreview-577355121___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] [WIP] Added fapolicyd plugin (#1475)

2021-01-27 Thread Panu Matilainen
@pmatilai commented on this pull request.



> +/* send a signal that transaction is over */
+(void) write_fifo(&fapolicyd_state, "1\n");
+/* flush cache */
+(void) write_fifo(&fapolicyd_state, "2\n");
+}
+
+ end:
+return RPMRC_OK;
+}
+
+static rpmRC fapolicyd_scriptlet_pre(rpmPlugin plugin, const char *s_name,
+ int type)
+{
+if (fapolicyd_state.fd > 0 &&
+fapolicyd_state.changed_files > 0 &&
+fapolicyd_state.installed_package ) {

The if condition is on same indentation level as the following code, making it 
hard to see where the condition stops and code starts. There are various ways 
to deal with that, my favourite generally is moving (parts of) the condition 
into a helper variable, with well-named variables this has the effect of making 
the code self-documenting as well. For example:
```
int need_flush = (fapolicyd_state.changed_files > 0) && 
fapolicyd_state.installed_package;
if (fapolicyd_state.fd > 0 && need_flush) {
...
}
```

-- 
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/1475#pullrequestreview-577351791___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Lua rpm.error() function (#1218)

2021-01-27 Thread Panu Matilainen
Closed #1218.

-- 
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/issues/1218#event-4255632401___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Lua rpm.error() function (#1218)

2021-01-27 Thread Panu Matilainen
With #1419 merged now, I'm considering this done.

This will be in rpm 4.17, to be released in the spring. Other than that I wont 
make any predictions.

-- 
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/issues/1218#issuecomment-768256810___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Implement a table-like shortcut to rpm macros in Lua (#1419)

2021-01-27 Thread Panu Matilainen
Merged #1419 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/1419#event-4255618529___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Implement a table-like shortcut to rpm macros in Lua (#1419)

2021-01-27 Thread Panu Matilainen
Since there are no further comments...

-- 
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/1419#issuecomment-768255053___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Documentation for %{expr:..} and %[...] is missing from rpm.org/user_doc/macros.html (#1519)

2021-01-27 Thread Miro Hrončok
Feel free to close or repurpose this issue, but note that the docs situation is 
confusing.

-- 
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/issues/1519#issuecomment-768215110___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Documentation for %{expr:..} and %[...] is missing from rpm.org/user_doc/macros.html (#1519)

2021-01-27 Thread Miro Hrončok
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/issues/1519#issuecomment-768214704___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Documentation for %{expr:..} and %[...] is missing from rpm.org/user_doc/macros.html (#1519)

2021-01-27 Thread Panu Matilainen
No, %if is strictly a spec construct. You can evaluate against the arch macros 
though, eg
`%[ "%{_target_cpu}" == "x86_64" ? 1 : 0]`

-- 
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/issues/1519#issuecomment-768214291___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Documentation for %{expr:..} and %[...] is missing from rpm.org/user_doc/macros.html (#1519)

2021-01-27 Thread Miro Hrončok
Related question: There is no `%ifarch` expression, right? E.g. `%{arch:a b c 
d}`/`%{narch:a b c d}` to evaluate to 0/1.

-- 
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/issues/1519#issuecomment-768204449___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Documentation for %{expr:..} and %[...] is missing from rpm.org/user_doc/macros.html (#1519)

2021-01-27 Thread Miro Hrončok
Thanks for the pointers. 

-- 
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/issues/1519#issuecomment-768200993___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Documentation for %{expr:..} and %[...] is missing (#1519)

2021-01-27 Thread Panu Matilainen
...such as those in the release notes (expressions section): 
https://rpm.org/wiki/Releases/4.16.0

-- 
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/issues/1519#issuecomment-768198990___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Documentation for %{expr:..} and %[...] is missing (#1519)

2021-01-27 Thread Panu Matilainen
The expression section could also use some more concrete examples...

-- 
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/issues/1519#issuecomment-768198374___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Documentation for %{expr:..} and %[...] is missing (#1519)

2021-01-27 Thread Panu Matilainen
Try the in-tree documentation instead: 
https://github.com/rpm-software-management/rpm/blob/master/doc/manual/macros.md

We'll need to have the rpm.org content pointing to the in-tree documenation 
sooner than later...

-- 
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/issues/1519#issuecomment-768197468___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [rpm-software-management/rpm] Documentation for %{expr:..} and %[...] is missing (#1519)

2021-01-27 Thread Miro Hrončok
I was searching for it in https://rpm.org/user_doc/macros.html but found 
nothing.

-- 
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/issues/1519___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Document thread-safety of librpm (#1483)

2021-01-27 Thread Panu Matilainen
Well yes, most people will find the going along a running transaction a bit too 
much when not just the current directory but also the root can change and 
whatnot. 

-- 
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/issues/1483#issuecomment-768157062___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Forbid tag data with count zero (#1496)

2021-01-27 Thread Panu Matilainen
Merged #1496 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/1496#event-4254775253___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Forbid tag data with count zero (#1496)

2021-01-27 Thread Panu Matilainen
Let's say not forgotten, just drowned in the mass. This is good to go so no 
harm in pinging, it's one down even if many to go.

For the future, I'd say submitting fewer patches at once would probably work 
better. Too many at once and the pipe just gets clogged :sweat_smile: 

Anyway, 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/1496#issuecomment-768148523___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint