<div dir="ltr">Does your own system have /dev/watchdog? Mine does, but I'm in the <div>middle of a bunch of stuff so I'm not going to go poking at it. </div><div><br></div><div>Also, did you read this: <a href="https://www.kernel.org/doc/Documentation/watchdog/watchdog-api.txt">https://www.kernel.org/doc/Documentation/watchdog/watchdog-api.txt</a></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div>--</div>Wyatt Zacharias<div><br></div></div></div></div>
<br><div class="gmail_quote">On Mon, May 4, 2015 at 10:51 PM, Trevor Cordes <span dir="ltr"><<a href="mailto:trevor@tecnopolis.ca" target="_blank">trevor@tecnopolis.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 2015-05-04 Gilbert E. Detillieux wrote:<br>
> A read on a file in /dev will almost always trigger an action<br>
> (usually causing data to be read from a device, of course), but I<br>
<br>
</span>Hmm, that's a good point. I suppose a read on a device could "steal"<br>
the input another program was expecting.<br>
<br>
It's strange though, because now that I think about it, when I run grep<br>
-r /, I'm pretty sure it's not reading all the disk block files, etc,<br>
as it runs way too fast for that...<br>
<br>
Ah, I forgot I had this set as an alias to grep on every system I use:<br>
/bin/grep -s --devices=skip<br>
<br>
I just checked and this new Rackspace box indeed had my alias set!<br>
So the plot thickens! So it's two possibly bugs: why was grep even<br>
reading that watchdog device in the first place; and why did reading it<br>
trigger a reboot?<br>
<span class=""><br>
> can end up in symlink-induced loops. I'd also avoid going<br>
<br>
</span>I've never actually ended up in a symlink loop, but I can see how it<br>
would be easy to run into. I guess I don't use many dir symlinks on my<br>
systems.<br>
<br>
Or... I just RTFM and it looks like gnu grep solved the symlink problem<br>
already:<br>
<br>
-r, --recursive<br>
Read all files under each directory, recursively,<br>
following symbolic links only if they are on the command line. Note<br>
that if no file operand is given, grep<br>
searches the working directory. This is equivalent to<br>
the -d recurse option.<br>
<br>
-R, --dereference-recursive<br>
Read all files under each directory, recursively. Follow<br>
all symbolic links, unlike -r.<br>
<br>
So that explains why I've never hit a symlink loop: I've never used -R<br>
(capital).<br>
<br>
Ah, even better:<br>
-D ACTION, --devices=ACTION<br>
If an input file is a device, FIFO or socket, use ACTION<br>
to process it. By default, ACTION is read, which means that devices are<br>
read just as if they were ordinary<br>
files. If ACTION is skip, devices are silently skipped.<br>
<br>
So that means my -D skips every "weird" file. That means that I've<br>
definitely, for sure, hit some bugs here. There's absolutely nothing<br>
now that should stop anyone from safely doing a:<br>
<br>
grep -r -D skip /<br>
<br>
on any system with modern gnu grep.<br>
<br>
The main reason I want to be able to do grep -r / sometimes is that I<br>
need to find a string (like an IP address) that may be scattered<br>
literally anywhere on the fs. In the past when I say to myself "oh, it<br>
must only be in /etc or /var or /home", there ends up being some little<br>
file in /usr (not even /usr/local) or wherever that was changed ages ago<br>
for whatever reason to work around whatever problem, and it gets missed<br>
unless I just "grep the whole darn thing". And to ls / and go through<br>
the 10-15 items in my brain deciding if they are greppable or<br>
"system/non-greppable" takes time and is error/omission-prone, and to<br>
list each one on the command line is a pain. Now this would be easier<br>
with a shell like zsh that has "negative globs" where I could specify<br>
"* except /dev /sys" (ie just make an "exclude" list, not an include<br>
list), but my beloved tcsh doesn't have that and I'm not ready to switch<br>
to zsh yet. And like I said before, each UNIX has its own different<br>
set of "don't grep this" dirs, and they change over time (even in<br>
Linux), so making a "one-alias fits all" is a non-solution.<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Roundtable mailing list<br>
<a href="mailto:Roundtable@muug.mb.ca">Roundtable@muug.mb.ca</a><br>
<a href="http://www.muug.mb.ca/mailman/listinfo/roundtable" target="_blank">http://www.muug.mb.ca/mailman/listinfo/roundtable</a><br>
</div></div></blockquote></div><br></div>