Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Nov 1998 10:14:17 +0100 (MET)
From:      Luigi Rizzo <luigi@labinfo.iet.unipi.it>
To:        hackers@FreeBSD.ORG
Subject:   64 char limit for #!/ command interpreters ?
Message-ID:  <199811270914.KAA11281@labinfo.iet.unipi.it>

next in thread | raw e-mail | index | archive | help
Hi,

I use to put in my MagicPoint presentations a first line of the form

	#!/usr/local/bin/mgp ...bla bla bla...

so that the interpreter is invoked automatically on the presentation
file. Not without surprise, i just noticed that the process fails if
the first line is longer than 64 characters (this is on 2.2.6).

The limit is apparently in /sys/kern/imgact_shell.c:

#define MAXSHELLCMDLEN  64

Now, any idea why the limit is so small, and is there any danger to
raise it to a much larger value such as 256 or so ?

The reason i am asking is because this mechanism becomes more useful as
the number of parameters increases... (and i happen to have hit the
limit!)

I think i know why the limit is there -- to avoid that some arbitrary
binary file can be mistaken for a shell script with an interpreter
name if an newline is not found "soon". Still, as we can have a
pathname up to 1KB (PATH_MAX in syslimits.h) the 64byte constraint
seems a bit inconsistent...

	luigi
-----------------------------+--------------------------------------
Luigi Rizzo                  |  Dip. di Ingegneria dell'Informazione
email: luigi@iet.unipi.it    |  Universita' di Pisa
tel: +39-50-568533           |  via Diotisalvi 2, 56126 PISA (Italy)
fax: +39-50-568522           |  http://www.iet.unipi.it/~luigi/
_____________________________|______________________________________

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811270914.KAA11281>