[stgt] [PATCH] make sure that scripts/tgt-setup-lun is started by the proper shell

Bart Van Assche bart.vanassche at gmail.com
Sat Jul 3 13:16:56 CEST 2010


There is a small bug in scripts/tgt-setup-lun, which may cause it to be
started by the wrong interpreter: if the "#!" sequence appears in a shell
script, this sequence must be at the top of the script.

A quote from the execl() man page from the The Open Group Base
Specifications Issue 6
(http://www.opengroup.org/onlinepubs/009695399/functions/execl.html):

  Another way that some historical implementations handle shell scripts is
  by recognizing the first two bytes of the file as the character string "#!"
  and using the remainder of the first line of the file as the name of the
  command interpreter to execute.

Signed-off-by: Bart Van Assche <bart.vanassche at gmail.com>

--- scripts/tgt-setup-lun.orig	2010-07-03 12:59:39.000000000 +0200
+++ scripts/tgt-setup-lun	2010-07-03 13:00:27.000000000 +0200
@@ -1,3 +1,5 @@
+#!/bin/bash
+
 # LUN assignment script
 #
 # Copyright (C) 2007 Erez Zilber <erezz at voltaire.com>
@@ -17,8 +19,6 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 # 02110-1301 USA

-#!/bin/bash
-
 usage()
 {
 	name=$(basename $0);
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list