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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>

--- 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@xxxxxxxxxxxx>
@@ -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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux