Skip to contentSkip to conversation

execve man page

DISCUSSION Valery Reznic 2 participants 2 messages Mar 21, 2010 – Apr 21, 2016 1 message not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

Hi, somewhere between Fedora 8 and Fedora 12 (2.6.31.5-127.fc12) execve system call was changed to accept script interpreter that interpreter itself. But man execve still said:
-----------------------------------------------------
Interpreter scripts
An interpreter script is a text file that has execute permission enabled and whose first line is of the form:

#! interpreter [optional-arg]

The interpreter must be a valid pathname for an executable which is NOT ITSELF A SCRIPT.
-----------------------------------------------------
It's a bit out of date now.

Regards,
Valery

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 485015.29084.qm-3jHsvP0p17GZZBmlwP4mLPu2YVrzzGjVVpNB7YpNyf8@public.gmane.org

#2 lore raw

Hello Valery,

Quoted 8 lines · Valery Reznic

Hi, somewhere between Fedora 8 and Fedora 12 (2.6.31.5-127.fc12) execve system call was changed to accept script interpreter that interpreter itself. But man execve still said:
-----------------------------------------------------
Interpreter scripts
An interpreter script is a text file that has execute permission enabled and whose first line is of the form:

Quoted 6 lines

#! interpreter [optional-arg]

The interpreter must be a valid pathname for an executable which is NOT ITSELF A SCRIPT.
-----------------------------------------------------
It's a bit out of date now.

So, some much delayed checking confirmed what you say. I applied the patch below.

Cheers,

Michael

man2/execve.2 +16 -2
@@ -273,8 +273,7 @@ permission enabled and whose first line is of the form:
 
 The
 .I interpreter
-must be a valid pathname for an
-executable which is not itself a script.
+must be a valid pathname for an executable file.
 If the
 .I filename
 argument of
@@ -302,6 +301,13 @@ For portable use,
 .I optional-arg
 should either be absent, or be specified as a single word (i.e., it
 should not contain white space); see NOTES below.
+
+Since Linux 2.6.28,
+.\" commit bf2a9a39639b8b51377905397a5005f444e9a892
+the kernel permits the interpreter of a script to itself be a script.
+This permission is recursive, up to a limit of four recursions,
+so that the interpreter may be a script which is interpreted by script,
+and so on.
 .SS Limits on size of arguments and environment
 Most UNIX implementations impose some limit on the total size
 of the command-line argument
@@ -426,6 +432,14 @@ Too many symbolic links were encountered in resolving
 .I filename
 or the name of a script or ELF interpreter.
 .TP
+.B ELOOP
+The maximum recursion limit was reached during recursive script
+interpretation (see "Interpreter scripts", above).
+Before Linux 3.8,
+.\" commit d740269867021faf4ce38a449353d2b986c34a67
+the error produced for this case was
+.BR ENOEXEC .
+.TP
 .B EMFILE
 The per-process limit on the number of open file descriptors has been reached.
 .TP
Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html