Ted, On Tuesday 30 November 2004 00:41, Ted Harding wrote:
...
More seriously, there's /etc/magic, or /usr/share/magic (depending on the distribution), which contains several entries allowing the true file type to be identified from the presence of characteristic byte sequences (used by the 'file' command -- see "man file").
However, even this is not guaranteed to be perfect.
Well, the "file" program works and given a sufficiently comprehensive and correct magic file (or files) will correctly identify files to which it is applied. However, there is always the potential problem of files that don't have sufficiently unambiguous signatures to be reliably detected.
The perfect answer is for the user to know what type an individual file really is, and invoke whatever command the user wants to apply to that file (which may differe from occasion to occasion for the same file). In other words, use the command line in a discriminating manner!
I think you're missing the point. There are some Web sites (SourceForge comes to mind) where there's a download link whose URL ends in, say, ".rpm" but which does not actually produce an RPM file (typically that URL includes a query segment and the ".rpm" is actually an argument to the query). Instead, it sends the browser (or should send the browser) to an secondary download page where the user selects the mirror from which the actual file will be downloaded. If the browser uses the URL's suffix to determine the dispensation of the returned data stream, whether because it's a poorly written browser or because the server does not include the MIME type of the data it's returning, then the browser will almost certainly not take the correct action when opening such a link. Using "SHIFT-click" or "right-click" to access a context menu and force a "save link target" action won't work, either, because that will just save the HTML of the secondary download page.
Best wishes to all, Ted.
Randall Schulz