Hi,

I forgot to attach the patch :/
diff -BurN debootstrap-1.0.1.orig/debootstrap debootstrap-1.0.1/debootstrap
--- debootstrap-1.0.1.orig/debootstrap	2007-07-31 18:55:45.595952859 +0200
+++ debootstrap-1.0.1/debootstrap	2007-07-31 19:02:39.113789274 +0200
@@ -262,6 +262,11 @@
   fi
 fi
 
+# Check for noexec or nodev mount option on target; see bug #233798
+if check_mount_options "$TARGET"; then
+    error 1 NOEXEC "cannot install into target '$TARGET' mounted with noexec or nodev"
+fi
+
 ###########################################################################
 
 if [ "$ARCH" != "" ]; then
diff -BurN debootstrap-1.0.1.orig/functions debootstrap-1.0.1/functions
--- debootstrap-1.0.1.orig/functions	2007-07-31 18:55:45.595952859 +0200
+++ debootstrap-1.0.1/functions	2007-07-31 19:04:27.118692637 +0200
@@ -925,6 +925,29 @@
 
 ################################################################### helpers
 
+# Return zero if filename is mounted on a mount point with the 'noexec'
+# or 'nodev' option. Else a non-zero code is returned.
+# Uses readlink, cat, grep, cut, dirname
+check_mount_options () {
+    local mtab=/proc/mounts
+    local T=`readlink -f -n -q "$1"`
+    while [ -n "$T" ]; do
+        if cat $mtab | grep -q " $T "; then
+            # found a mount point
+            local opts=`cat $mtab | grep " $T " | cut -d" " -f4`
+            if echo $opts | grep -E -q "no(dev|exec)"; then
+                return 0
+            fi
+            return 1
+        fi
+        if [ "x$T" = "x/" ]; then
+            break
+        fi
+        T=`dirname "$T"`
+    done
+    return 1
+}
+
 read_gpg_status () {
   badsig=
   unkkey=

Attachment: signature.asc
Description: This is a digitally signed message part.



Reply via email to