The following reply was made to PR general/3630; it has been noted by GNATS.
From: "Paul J. Reder" <[EMAIL PROTECTED]>
To: Apache bug list <[EMAIL PROTECTED]>
Cc: Subject: Re:general/3630: File list shows bomb icon for any file "*core"
Date: Tue, 25 May 1999 22:22:25 -0400
The long and short of the answer is that this is a side effect of the code
working as designed.
There is good reason for it to work this way and the "core" file side effect
cannot be eliminated
without putting special purpose "core" code into general purpose indexing code
or removing otherwise
useful function.
The mod_autoindex code is written to allow a user to specify the use of an
icon other than the
default folder icon for directories. If you wanted to create a special
"folder" icon that showed a
folder with a movie frame on it to use for a folder of type *.movies
containing all your quicktime
movies you can do that (AddIcon /icons/moviefolder.gif .movies). The code that
causes the "problem"
that you describe is in the file apache/src/modules/standard/mod_autoindex.c
in the function
make_autoindex_entry around line 940 (the "offending" lines follow):
if (S_ISDIR(rr->finfo.st_mode)) {
if (!(p->icon = find_icon(d, rr, 1))) {
p->icon = find_default_icon(d, "^^DIRECTORY^^");
}
if (!(p->alt = find_alt(d, rr, 1))) {
p->alt = "DIR";
}
p->size = -1;
p->name = ap_pstrcat(r->pool, name, "/", NULL);
}
else {
p->icon = find_icon(d, rr, 0);
p->alt = find_alt(d, rr, 0);
p->size = rr->finfo.st_size;
}
This code will first check if the entry is a directory. If it is not, it
follows the normal
find_icon lookup (find_icon then find_alt). If it is a directory, it first
does a find_icon (where
it would find the ".movies" match or in this case the "core" match). If it
doesn't find a specific
match then it loads the default directory folder icon. Regardless of the
selected icon, the index
entry will still behave as a directory when clicked on.
You have stumbled on a side effect of the pre-specified "core" entry in the
icon list. Since "core"
is the full file name (no extension to match) it does not contain a ".". This
allows it to match any
text ending in "core" (i.e.. "mscore"). You won't normally run into this
problem because all of the
other default values are specified as ".something" and most people don't
specify directories with
".XXX" extensions that match normal file types (like ".tar").
So I hope you can see that there really isn't anything that can be done about
this.
Perhaps in the future the AddIcon entries can be changed to a regular
expression that (in this case)
would say something like:
AddIcon /icon/bomb.gif (eq("core") && !(DIRECTORY))
but that isn't the way it works today.
--
Paul J. Reder
--------- from Red Hat Linux fortunes -----------------------------
... Any resemblance between the above views and those of my employer,
my terminal, or the view out my window are purely coincidental. Any
resemblance between the above and my own views is non-deterministic. The
question of the existence of views in the absence of anyone to hold them
is left as an exercise for the reader. The question of the existence of
the reader is left as an exercise for the second god coefficient. (A
discussion of non-orthogonal, non-integral polytheism is beyond the scope
of this article.)