[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sh-script.el and magic numbers

From: Luc Teirlinck
Subject: sh-script.el and magic numbers
Date: Sat, 18 Jan 2003 21:24:03 -0600 (CST)

As I mentioned in an earlier report, there seems to be quite some
evidence that sh-script.el assumes, at several places and in several
ways, that shell scripts start with a magic number (#! line), unless
it is a special standard configuration file, obviously intended to be
sourced, style .bashrc.  (The concrete definition being "matching
`executable-magicless-file-regexp'".)  Even in that case sh-script.el
seems to assume the file to start with some kind of comment.  The only
person who responded to my earlier report (Glenn Morris) seemed to
believe that these assumptions should not be made.

There are at least three separate problems (one bug, reported before,
and two inconveniences) associated with not following these
conventions.  Clearly I am not going to even describe the other two
problems (inconveniences rather than real bugs) if it is decided that
sh-scripts.el's assumptions are perfectly reasonable, since in that
case all these "problems" are irrelevant.

So, is there a policy concerning whether or not we care about files
not following the above conventions?  If there is not, should we have
a discussion or is the answer "obvious"?

Glenn's argument is that some files are intended to be sourced, not
executed, which, of course, is obvious.  My sysadmin seems to defend
the conventions, his argument being that a magic number does no harm,
even if the file is to be sourced and indicates to several facilities
(including sh-mode) what shell the script is written for.  He does
put magic comments in .bashrc and similar files.  My Red Hat provided
.bashrc contains no magic number, but seems to very deliberately start
with a comment (which means it is OK in as far as sh-script.el goes):
# .bashrc

One argument against the conventions, in addition to Glenn's earlier
argument, might be that it is possible to use special history files
that look very much like shell-scripts and interactively C-o (in
Readline) one's way through them.  One may want to put such files in
sh-mode, without starting them with a magic number.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]