docs/92342: Enjoin to use the sh exec statement in the Porter's Handbook

Jean-Yves Lefort jylefort at FreeBSD.org
Thu Jan 26 03:30:22 UTC 2006


>Number:         92342
>Category:       docs
>Synopsis:       Enjoin to use the sh exec statement in the Porter's Handbook
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-doc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 26 03:30:10 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Jean-Yves Lefort
>Release:        FreeBSD 6.0-RELEASE i386
>Organization:
>Environment:
System: FreeBSD jsite.lefort.net 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Wed Jan 25 19:57:13 CET 2006 jylefort at jsite.lefort.net:/usr/obj/usr/src/sys/JSITE i386
>Description:
A grammar/spelling review is recommended.
>How-To-Repeat:
>Fix:
Index: book.sgml
===================================================================
RCS file: /home/dcvs/doc/en_US.ISO8859-1/books/porters-handbook/book.sgml,v
retrieving revision 1.673
diff -u -r1.673 book.sgml
--- book.sgml	22 Jan 2006 23:20:29 -0000	1.673
+++ book.sgml	26 Jan 2006 03:25:20 -0000
@@ -9227,6 +9227,26 @@
 	  for their files.</para>
       </sect1>
 
+      <sect1 id="dads-sh-exec">
+	<title>Use the <function>exec</function> statement in wrapper scripts</title>
+
+	<para>If the port installs a shell script whose purpose is to launch
+	  another program, and if launching that program is the last action
+	  performed by the script, make sure to modify the script so that
+	  it launches the program using the <function>exec</function>
+	  statement, for instance:</para>
+
+	<programlisting>#!/bin/sh
+exec %%LOCALBASE%%/bin/java -jar %%DATADIR%%/foo.jar "$@"</programlisting>
+
+	<para>The <function>exec</function> statement replaces the shell
+	  process with the specified program. If <function>exec</function>
+	  is omitted, the shell process remains in memory while the
+	  program is executing, and needlessly consumes system
+	  resources.</para>
+
+      </sect1>
+
       <sect1 id="dads-uid-and-gids">
 	<title>UIDs and GIDs</title>
 
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-doc mailing list