unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* sh-script.el and magic numbers
@ 2003-01-19  3:24 Luc Teirlinck
  2003-01-19 12:47 ` Ehud Karni
  0 siblings, 1 reply; 21+ messages in thread
From: Luc Teirlinck @ 2003-01-19  3:24 UTC (permalink / raw)
  Cc: gmorris+mail

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.

Sincerely,

Luc.

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2003-01-23  8:00 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-19  3:24 sh-script.el and magic numbers Luc Teirlinck
2003-01-19 12:47 ` Ehud Karni
2003-01-19 23:48   ` Glenn Morris
2003-01-20  7:59     ` Ehud Karni
2003-01-21  0:45       ` Luc Teirlinck
2003-01-21 10:49         ` Glenn Morris
2003-01-21 15:30           ` Luc Teirlinck
2003-01-21 15:44             ` Glenn Morris
2003-01-21 16:04               ` Luc Teirlinck
2003-01-21 17:23               ` Luc Teirlinck
2003-01-21 23:51                 ` Luc Teirlinck
2003-01-23  8:00                   ` Richard Stallman
2003-01-22  0:26                 ` Luc Teirlinck
2003-01-21 16:54           ` Kai Großjohann
2003-01-21 19:29             ` Luc Teirlinck
2003-01-21 20:00               ` Kai Großjohann
2003-01-22  8:41               ` Kai Großjohann
2003-01-22 14:18                 ` Luc Teirlinck
2003-01-22 20:51                   ` Luc Teirlinck
2003-01-23  1:12                   ` Kevin Rodgers
2003-01-20 16:45   ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).