« first day (3113 days earlier)      last day (1824 days later) » 

6:27 AM
In a Linux distribution, Is there a general way to know what happens when a package is installed or how the package places all its files? I found only ArchWiki shows the file list, for example archlinux.org/packages/core/x86_64/ncurses/files.
 
@Biswapriyo All major distributions have packaging systems. And those packaging systems have functionality that includes information about what files are included in each package, and of course there location on the system.
 
 
2 hours later…
8:20 AM
there -> their
 
Adding to what @FaheemMitha said, you can start from the package manager "Rosetta stone" on the Arch Wiki: https://wiki.archlinux.org/index.php/Pacman/Rosetta
E.g. in the "Querying specific packages" section you'll find the commands that list files held by the selected package(s).
 
8:44 AM
@fra-san Thank you. That link provides all I want.
 
@Biswapriyo I'm glad it helped.
 
 
3 hours later…
Tim
12:03 PM
Hello the people of the chat room, may I ask something about middleware?
 
12:36 PM
@Tim Ask away!
(I probably can't answer though)
 
1:18 PM
middleware is a buzz word
 
1:45 PM
@Kusalananda: Is there a way to handle filenames with spaces using bsd xargs?
 
@Jesse_b If they have no newlines, yes.
 
@Kusalananda My xargs doesn't have the -d option
 
OpenBSD xargs additionally supports -0.
 
ah
 
What does -d do?
 
1:46 PM
sets the delimiter, so you could specify \n
Anyway I think while read in this answer may be better than xargs anyway? It definitely seems to be faster than the find -exec solution OP came up with in my testing anyway
 
Most xargs implementations nowadays have -0, but it's rather inelegant.
@Jesse_b They are not interested in the contents of the files, just the filenames, as far as I understand.
 
@Kusalananda Yeah the final grep in my solution uses -l so it only prints filenames
> I need to print filenames containing all 3 keywords: kwd1, kwd2, and kwd3.
 
@Jesse_b "Print filenames containing keywords", not "print filenames of files containing keywords".
 
oh
 
Well, it's unclear.
 
1:53 PM
ops own solution looks in the content of the file though
$ find . -type f -name "*.ext" -exec grep -q kwd1 {} \; -exec grep -q kwd2 {} \; -exec grep -l kwd3 {} \;
./file4.ext
./file2.ext
./file with spaces.ext
I'm fairly certain op wants the content lol. I think this is why people with poor english hate this site :p
 
I'm "just answering the question" :-)
 
Yeah and your answer gets upvoted but not mine :(
 
@Jesse_b your answer uses read when it doesn’t need to
 
@StephenKitt What is the alternative? I didn't think xargs would be right either
 
@Jesse_b the alternative is the OP’s answer, use find
 
2:05 PM
@StephenKitt find is slower than my solution though, at least in my limited testing. I can create a lot more files to test with though
 
@Jesse_b it’s guaranteed to be correct ;-)
 
@StephenKitt and mine isn't?
 
@Jesse_b filenames with newlines :-(
 
Doesn't work for me
$ cat 'file'$'\n''newline'
kwd1
kwd2
kwd3
$ find . -type f -name "*.ext" -exec grep -q kwd1 {} \; -exec grep -q kwd2 {} \; -exec grep -l kwd3 {} \;
./file4.ext
./file2.ext
./file with spaces.ext
duh
sorry
well people who have newlines in filenames should use windows anyway
 
@Jesse_b Your filename does not match *.ext.
 
2:17 PM
@Kusalananda Yeah, I realized that shortly before saying "duh" :p
 
@Jesse_b you could get a bit more speed if you add -m 1 to both greps.
 
@terdon Thanks
 
But isn't your answer supposed to find files recursively?
terdon@tpad foo $ tree
.
├── bad
│   ├── file
│   └── file.ext
├── bar
│   ├── file
│   └── file.ext
└── baz
    ├── file
    └── file.ext

3 directories, 6 files
terdon@tpad foo $ grep -lr foo *ext
grep: *ext: No such file or directory
The *ext will be expanded by the shell, not grep. So if no files in the curent dir match the glob, your command won't do anything.
You probably wanted --include=*ext
 
@terdon and perhaps + for the last one (I haven’t tried)
 
2:26 PM
@StephenKitt +?
 
@terdon Well damn...thanks =)
 
@Jesse_b That probably explains why it was faster than find ;)
 
well I wasn't using subdirs with either
but I can't get that to work
 
@terdon instead of \; on the last find
but I’m probably mixing answers up
 
@StephenKitt Ah yes, Jesse's doesn't use find.
No, hang on, @Kusalananda's is searching for the keywords in the file names, not their contents.
 
2:31 PM
@terdon I do both.
 
Yes, sorry, didn't see the second part.
 
There's no nice way of changing the last ; into + in my solution though.
 
@Kusalananda sed -E 's/(.*);/\1+/`
:P
 
And then eval? Yeah...
 
More seriously, why not just set -- "$@" -exec grep -q -wF -e "$word" {} + in your 3rd code block?
 
2:35 PM
Because grep -q does not make sense on multiple files.
... in the context of find.
 
ah, point
 
You'd just get "yep, one file matched".
 
Yes, it would only make sense with -l.
 
In any case, it's the first grep that's going to be slow, as that's the one that is being run on the most files.
 
 
2 hours later…
4:31 PM
Can anyone point me to an article regarding porting udev scripts from RHEL6 to RHEL7? I've been assigned this tasking and I'm completely new to udev. I'm working through some articles and documentation, but something more concise would be very helpful.
im googling as hard as I can for em
This page makes it seem like nothing has changed unixadminschool.com/blog/2015/07/…
 
4:47 PM
@Ungeheuer Yeah, what makes you think any porting will be needed?
 
That's what I want to know. Have any variables that were available e.g. (looking at an existing rule) ID_CDROM, changed/don't exist? Are there new things in udev? Stuff I need to know in order to figure out what, if any, changes need to be made to scripts that udev will trigger.
@terdon
I'd guess the rule syntax hasn't changed, but other stuff might have. Especially coming from a place of total udev ignorance, I have no idea what udev in RHEL6/pre-systemd looked like as compared to now.
This SO post links and appears to quote an article claiming changes: stackoverflow.com/questions/33412437/udev-rules-from-rhel-7
 
@Ungeheuer Why don't you just test the scripts first?
It sounds like you are looking for a solution to a problem that may not exist.
 
5:04 PM
I work with a guy that has a problem for every solution
 
@Jesse_b pretty sure we don't work together...
 
@Ungeheuer but not entirely sure?
 
@FaheemMitha hmmm that makes too much sense. lol I'll throw the rule in, link it to a script that logs a message and see if it works out.
@Jesse_b Yea, there might be an issue with that conclusion. I'll need to do some testing.
 
5:22 PM
Why does the Buster Python 3 say rc in the version string?
    python3 --version
Python 3.7.3rc1
 
"rc" = "release candidate", usually
 
@Kusalananda Yes, which usually comes before the final version.
But Buster is supposed to be in freeze.
And if it really is a rc version, why is it being packaged, anyway?
I mean, I know Debian maintainers have a lot of latitude.
 
5:39 PM
@FaheemMitha (BTW: I have libgl1-nvidia-legacy-390xx-glvnd-glx on this system, which uses runtime picking of the driver, so you can have multiple active at once. Not that this system has multiple,...)
 
@derobert Runtime picking? Yikes.
Why would one want to do that?
 
@FaheemMitha because you have one screen on an Intel card and one on an nvidia card?
 
@derobert I don't understand. We're talking about swapping out drivers for Nvidia cards, right?
 
Or because you switch between the two drivers (on one screen) based on power saving. Common on laptops.
 
And we are talking about alternatives, right?
@derobert Switch between drivers based on power saving?
This is actually done?
 
5:42 PM
Not sure if it can swap between nvidia and nvidia-legacy, possibly not. But apparently can between say Intel and nVidia, which is also something that alternatives setup does.
@FaheemMitha yes, normally with an Intel GPU and an nVidia or ATI one.
 
@derobert What is "it"?
 
@FaheemMitha the glvnd stuff
 
@derobert You mean use a less demanding card (from the power pov) when the battery goes low?
And this is done at a hardware/bios level, or the OS handles it?
 
@FaheemMitha Normally, when you're not doing something that requires the higher-power card (e.g., a 3D game). And when you're on battery. But it's done by the OS, so it could be whatever. wiki.archlinux.org/index.php/hybrid_graphics has some description.
 
@Ungeheuer yep, precisely. But I would be very surprised if any udev update were to break backwards compatibility. Also, in general, don't search for "changes in RHEL7", just look at what udev versions you have. The distributions are just collections of software, so it's rarely useful to search based on the distro version.
 
5:46 PM
@derobert Hmm, doesn't look like Arch is using anything like alternatives.
 
@FaheemMitha If you mean the debian alternatives, no, this is quite different. It's just that the OS can choose to use either card and only goes for the discrete one for the hard stuff. The simple stuff is done using the onboard card.
 
I think the alternatives stuff predates glvnd. But don't quote me on that, I haven't researched it.
 
@terdon Yes, I meant Debian alternatives.
The context is that Debian actually used alternatives for switching between different drivers for the Nvidia card. Which I just got bitten by, on upgrade.
It strikes me as a tad eccentric, but Debian isn't going to change the established way of doing things, so...
 
@FaheemMitha yeah, but that's completely different. The Debian Alternatives is a tool for installing software packages, it isn't related to this at all.
 
@terdon In this case, it kind of is related.
 
5:50 PM
Yes, you could install another driver (software) using the debian alternatives, but that has nothing to do with switchable graphics where your OS can choose to use one card or the other at any one time, without rebooting or installing anything new.
 
Because this is also about graphics drivers.
 
@FaheemMitha Only about installing them. The trick here is less about the driver and more about the hardware itself and having both cards active at the same time which didn't used to be possible.
 
@terdon Yes, but Debian alternatives are also about switching on the fly.
 
@FaheemMitha Only the software, not the hardware.
 
I'm not sure if rebooting is necessary or not.
@terdon Yes, the software.
 
5:51 PM
DA gives you a method to choose from multiple packages that do the same thing. For example, the thing might be "graphics card driver".
 
Anyway, it does seem a bit tangential. I'm not sure why Anthony bought it up.
@terdon Yes, I know.
 
The switchable graphics thing is different. For instance, inxi reports both of my cards as active:
$ inxi -G
Graphics:
  Device-1: Intel HD Graphics 530 driver: i915 v: kernel
  Device-2: NVIDIA GM108M [GeForce 940MX] driver: nvidia v: 418.56
  Display: x11 server: X.Org 1.20.4 driver: nvidia
  resolution: 2560x1440~60Hz, 1920x1080~60Hz, 1920x1080~60Hz
  OpenGL: renderer: Mesa DRI Intel HD Graphics 530 (Skylake GT2) v: 4.5 Mesa 19.0.1
Both drivers installed, both active.
 
@terdon What do two active cards do?
 
@FaheemMitha Enable the OS to handle GPU intensive tasks on the more powerful, and more battery draining, NVIDIA card and normal every-day activity on the more battery friendly on-board Intel card.
 
@terdon Simultaneously?
 
5:54 PM
@FaheemMitha As I understand it, not simultaneously, no. The kernel (?), the OS anyway, will choose whichever one it needs depending on the task. But it is supposed to be done completely seamlessly and transparently.
 
@terdon I see. Fancy.
 
I can confirm that I can play games or run glxgears at speeds that suggest my NVIDIA card is being used.
 
@terdon What laptop is this?
 
I haven't found a way of seeing which card is actually being used at any one time, so that's the best indication I have that it is actually working.
@FaheemMitha A thinkpad t460p
 
And what OS? Windows?
 
5:55 PM
@FaheemMitha Say that again.
I dare you.
 
Of course not Windows, you ninny!
Do I look like @Kusalananda?
 
Hey, people do use Windows.
Decent upstanding citizens, even.
 
So they say.
 
I mean, don't know why, but they do.
 
5:56 PM
Anyway, I'm on Arch.
 
Ah. So the Linux kernel can do this kind of thing?
 
yep
Or some part of the OS, I don't know for sure that it's the kernel although I assume so.
 
Cool, looks like I may not need to learn udev, which might actually be worse than spending hours googling for stuff and things. Thanks for reminding to check to see if something is broken BEFORE trying to fix it
 
So I just managed to send an email message to myself using Python. It was very exciting. The first recipe in docs.python.org/3/library/email.examples.html
I'm very impressed with myself.
@terdon One assumes it's the kernel.
@Ungeheuer It's rather easy to overlook the obvious. I do it all the time.
@terdon Nasty business about Assange. The "good" news is that at least some people seem to understand what is happening, based on protests, and comments on the net. Not sure how seriously to take the latter, though.
 
6:11 PM
@terdon Watch it ;-)
 
6:57 PM
user image
2
It's like finding a perfectly shaped stone on a beach.
 
@Kusalananda Cryptic.
 
7:26 PM
@FaheemMitha I use windows. However I am certainly not a "decent upstanding citizen"
 
I'm a bit decent. Most often not upstanding though, as I spend most of my time sitting.
Decent slouching citizen
 
@Kusalananda You come across as a man with exceptional posture
 
@Jesse_b I'll take that as a compliment, by my masseuse will disagree.
 
@Jesse_b Indecent sitting citizen?
@Kusalananda It's hard to keep good posture when you sit at a computer all day.
Motivation is lacking.
 
@FaheemMitha Well I have excellent posture, but I am indecent and crooked
 
7:39 PM
@Jesse_b Hmm. Are you an international super-spy?
Maybe you should get yourself a theme tune? Or a musical motif?
 
Methinks @Jesse_b protests too much.
I smell black ops.
 
@FaheemMitha So it is.
 
0
Q: Reading an argument and creating a tempfile from it to use within the script

R00ki3 M1stak3I am trying to write a script that would count the number of columns in a file. However, I don't know what the name of the file will be. I am trying to create a file called tempfile which has the information from the argument catted into it. Here is the script that I have so far for the script...

What is that script even doing
ah I see, it is only reading the number of words on the first line
 
Is there official udev documentation somewhere? I went to the github page, but the most recent thing there is almost a decade old: github.com/mfwitten/udev
I need some centralized documentation about the available environment variables. I logged the output of env, and now I need to be able to check the outputted variables against docs.
The arch and gentoo pages didn't have anything on that. Nor have other pages i'm slowly plodding my way through.
I have no clue what's up with the encoding on this page. Am I the only seeing weird characters everywhere?
 
8:03 PM
@Ungeheuer I'd start with man udev.
Once upon a time a man page was considered "official" documentation.
 
man man
 
@Ungeheuer Seeing some stuff that looks like:
> KERNEL==”eth0″
I assume that's not intentional. Looks like an encoding gone horribly wrong.
 
@FaheemMitha I checked that already, and udevadm, and systemd-udevd.service. They don't cover any environment variables like ID_CDROM, DISK_MEDIA_CHANGE, ID_CDROM_MEDIA_STATE, ID_REVISION, ID_ATA_FEATURE_SET_PM, etc.
I'm assuming that these are then not officially documented environment variables an d I'll need to dig through udev rules that set these values to figure out what they're for.
 
@Ungeheuer If they aren't documented, they might go away. Where did you get those names from?
 
@FaheemMitha hastebin.com/abugeqamax.bash. I checked to make sure some variables we had before still existed and acted the way the previous implementor expected them to. The env line logged a whole bunch of variables, and I'm trying to out things that are unhelpful from things that might be helpful.
 
8:16 PM
@Ungeheuer How do you know these variables have anything to do with udev?
 
@FaheemMitha Well, ID_CDROM, for example, is set in /lib/udev/rules.d/60-cdrom_id.rules, so it seems like that rule was pre-defined, and there are other rules in the same directory that test that variable.
Lol just realized there also a _=/usr/bin/env that's a dope variable name...
Doesn't look like anything else that got output will be useful. A lot sounds like hardware stuff, things we already know, and things that won't be useful.
Well, looks like everything I got out of env can also be printed by udevadm info --query=property --name=/dev/sr0
 
8:36 PM
@Kusalananda: +1 ${delim+-F "$delim"}
I would have done something like -F ${delim:-" "}
 
@Jesse_b That would have forced a space, while the default delimiter is any whitespace (and any number of consecutive of those).
You may want to try [[:blank:]]+ as a default if you don't like the ${...+...} syntax.
 
@Ungeheuer from the bash manpage:
   _      At  shell  startup,  set to the absolute pathname used to invoke
          the shell or shell script being executed as passed in the  envi‐
          ronment or argument list.  Subsequently, expands to the last ar‐
          gument to the previous simple  command  executed  in  the  fore‐
          ground,  after expansion.  Also set to the full pathname used to
          invoke each command executed and placed in the  environment  ex‐
          ported  to  that  command.   When  checking mail, this parameter
So, e.g., perl -E 'say $ENV{_}' would print something like /usr/bin/perl
(at least, if you're running it from bash)
 
9:16 PM
that actually is dope. Had no idea it was a thing. Thanks for learning me something new @derobert!
I mean, it could be a nicer name, but still, nice bit of information.
 

« first day (3113 days earlier)      last day (1824 days later) »