New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for RPMDBI_BASENAMES on file queries #1755
Conversation
The patch is straightforward enough as such. This being rpm though... does this end up overriding the install-side --allfiles flag behavior? I seem to recall ambiguous flags in popt needing to be handled through a callback instead because of that, but it's been a while. I'm also pondering about the placement/naming: due to internal implementation details, this ends up being a query source selector, when from a user POV it's just a modifier flag. --allfiles as a name also seems applicable to a number of other query/verify things, such as to override possible --nofoo flags with --list, but also alias to a theoretical --filestate=any selector that would allow filter by arbitrary file state (we don't have such a thing now of course). None of this is a bad thing, just trying to think about potential future implications a bit. I'll try to get my pondering to a resolution over lunch 😅 |
Answering myself, yes it does. Without this patch:
And with it:
So this needs to be changed to use a popt callback for --allfiles, I think on both install and query side. |
Eh, you're right. It turns out the handling of This is because, in the The fix is simple: just replace the That said, I agree with your pondering about the naming. As I'm thinking about this more, I'm not quite convinced that adding such a generically-named option that's only applicable in
The proximity to and similarity with |
7762dfb
to
a95afc4
Compare
I've pushed a more straightforward version that adds |
At least to me, "file" seems to refer to something concrete, eg on-disk file, whereas a "path" is more abstract so it matches the case quite nicely. I'd simplify the documentation though: update |
Yep, that's exactly what I was going for 😉 I'm glad it clicked for you too!
Wow, that's much better. I have to admit, I spent quite a while going through various iterations of this documentation, until it felt just about right and expressed the above difference from
However, now I realize both are corner cases that can be left out for the sake of simplicity. They're not an important distinction for the typical use case here, anyway. Moreover, files removed independently of RPM are basically in the undefined state. There's an implicit assumption in the docs that when we talk about queries, we usually mean RPM database queries, as opposed to file system queries. In general, basic operations should have short names and simple, ideally one-sentence, descriptions. Anything more than that raises red flags, such as the scope of the switch being too wide. So, I like your suggestion a lot. I'll update the PR accordingly. Thanks! |
Oh, indeed. There are a few additional subtleties there as you point out, and my "whether on disk or not" is not quite right. I think I originally wrote that "whether installed or not", which is closer to the point, but then I changed to "on disk" because "installed" may refer to package or a file, and .. meh 😅 The replaced files case is a bit special, but replacing a file causes effectively an ownership change so "owning the file" kinda takes care of that. It wouldn't hurt to explain it though, if you find a nice way of putting it. |
Actually, "on disk" would be a good enough abstraction, I think, but let's go with "installed" for another reason, which is that it's an established term used throughout the man page already (i.e. we say "installed" whenever we mean "on disk", but never the latter).
I think we could even leave out "the file" because we're talking about package queries here and it is assumed that those packages are installed... but yeah, let's not make it overly cryptic either. 😄 (Though, I'll take the liberty for the
Good point. I'm adding a note there which should make this replacement case obvious, without being overly verbose. It's now two sentences instead of one, which hurts my perfectionist soul, but meh, it explains it well. Let me know otherwise, we can always just drop it 😄 I'm also removing the man page update for Pushing the updated branch next. |
This has been missing, so add a simple one.
There are legitimate reasons (such as rhbz#1940895 or the included test) for wanting the former behavior where all file states were considered in file queries prior to commit 9ad57bd, so celebrate the tenth anniversary of that commit by adding a CLI switch (a new package selector --path), as contemplated back then. Update the man page for --file to reflect it's current behavior and make --path that more obvious. Resolves: rhbz#1940895
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine with me 👍
--allfiles
switch which augments-qf
-qf
while at it--allfiles
description)