Vulnerability Development mailing list archives

Re: tail -f to a dir


From: sinster () DARKWATER COM (Jon Paul, Nollmann)
Date: Wed, 12 Jul 2000 22:23:25 -0700


Sprach Dino Amato <slayer67 () APK NET>:
I do not remember this being mentioned, but if it has sorry.
I was playing today and I did a "tail -f /home/mydir" on RH 6.2
and I get:

tail: /home/mydir: Is a directory
tail: tail.c:718: recheck: Assertion `valid_file_spec (f)' failed.
Abort (core dumped)

This is debugging code.  Whoever wrote the tail program that you ran
on redhat left a bunch of assert() statements in the code.  It's
a matter of debate in the UNIX world as to whether or not assert()
statements should be left in production code, a lot like the debate
as to whether or not production binaries should be compiled -g or
not.  No need to get into either debate here.

The point is that on line 718 of tail.c, there is a line that says:
        assert(valid_file_spec(f));
I got that from the error message.  When the argument to assert() is
0, it makes the binary dump core through some system-specific method.
If you have your coredump size limit set to 0, then you don't get a
core file, but the program still crashes.  It's a safety valve.

[...]
Then I tried it on Solaris 2.6 and it actually spit the contents of the =
dir. in binary form, but when it was done - it went back to a prompt.

For all UNIX systems, directories are just another kind of file.  It just
happens to be a file that contains a list of inode numbers and file names.
What you see is the result of blindly doing an open() on a directory,
and dumping the contents to stdout.

Now when I do a "strings" on the core I get the info for who wrote tail =
(Paul Rubin, David MacKenzie, Ian Lance Taylor, and Jim Meyering 2.0a) =
and other tail related things, then at end I see my environment.

Standard core file.  Contains all the strings of the executable.  I bet
if you did a
        % tail -h
or maybe
        % tail --help
you'd also get the names of the authors.

--
Jon Paul Nollmann ne' Darren Senn                      sinster () balltech net
Unsolicited commercial email will be archived at $1/byte/day.
Rather let the crime of the guilty go unpunished than condemn the innocent
                                              Justinian I, Law Code, AD 536



Current thread: