Bug 66405 - IndexIgnore should not describe its argument as a shell-style wildcard expression
Summary: IndexIgnore should not describe its argument as a shell-style wildcard expres...
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Documentation (show other bugs)
Version: 2.4.54
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: HTTP Server Documentation List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-30 21:42 UTC by metaed
Modified: 2022-12-30 22:13 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description metaed 2022-12-30 21:42:51 UTC
The documentation for the IndexIgnore directive of module mod_autoindex describes each argument as "a shell-style wildcard expression or full filename". Describing the argument that way wrongly tells the user that its filename patterns work like shell filename patterns. They don't.

The documentation should describe the actual syntax and semantics of the argument. And because its behavior is different from, but confusingly similar to, shell-style filename patterns, it should also highlight the differences.

    *~

This expression matches the filename '.example~' in httpd, but not in a shell. A shell requires the '.' at the start of a filename to be matched explicitly, and has for more than 40 years.

    .[abcde]*

This expression matches the filename '.example~' in a shell, but not in httpd. The directive does not support bracket expressions. Shell filename patterns have supported them for more than 40 years.

The directive documentation is silent on what happens when the argument contains a '/' (a full or partial pathname). There are people in the field using expressions such as

    */.??*

I have no idea what httpd might do with such an argument. This should be covered in the documentation.

Here is a draft rewrite that addresses part of this. Because I don't know the semantics of '/' in the argument, I did not address that.

"The 'IndexIgnore' directive adds to the list of files to hide when listing a directory. 'File' is a full filename, which can contain the '?' and '*' wildcard characters. The '?' matches any single character. The '*' matches any string of characters, even an empty string. When 'File' contains wildcard characters, all matching filenames are hidden.

"Users familiar with standard Unix filename patterns should carefully note the difference. The 'IndexIgnore' directive does not recognize bracketed character classes. And the standard Unix filename pattern requires a '.' at the start of a filename to be matched by an explicit '.' in the pattern, while the 'IndexIgnore' directive does not."
Comment 1 metaed 2022-12-30 22:13:31 UTC
Also, it could be documented that the filename pattern semantics make it impossible to ignore hidden filenames without also ignoring '..' (Parent Directory). At best you can ignore hidden filenames three characters or longer using the filename pattern

    .??*

To get the desired effect in a shell, you would ignore:

    .[!.]*

and

    ..?*

But as discussed in the original bug report there is no support for bracket expressions.