FreeBSD Bugzilla – Attachment 102013 Details for
Bug 141678
[patch] A minor enhancement to how /etc/rc.d/jail determines mount points used in jails
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 2.02 KB, created by
Markiyan Kushnir
on 2009-12-16 12:40:00 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Markiyan Kushnir
Created:
2009-12-16 12:40:00 UTC
Size:
2.02 KB
patch
obsolete
>--- etc/rc.subr 2009-12-16 12:46:34.000000000 +0200 >+++ etc/rc.subr.mkushnir 2009-12-16 14:18:16.000000000 +0200 >@@ -1,5 +1,5 @@ > # $NetBSD: rc.subr,v 1.67 2006/10/07 11:25:15 elad Exp $ >-# $FreeBSD: src/etc/rc.subr,v 1.88.2.7 2009/12/15 23:05:16 dougb Exp $ >+# $FreeBSD$ > # > # Copyright (c) 1997-2004 The NetBSD Foundation, Inc. > # All rights reserved. >@@ -738,7 +738,7 @@ > if [ -n "$_nice" ]; then > if [ -z "$_user" ]; then > _doit="sh -c \"$_doit\"" >- fi >+ fi > _doit="nice -n $_nice $_doit" > fi > fi >@@ -1063,7 +1063,7 @@ > esac > done > } >- >+ > # > # load_rc_config_var name var > # Read the rc.conf(5) var for name and set in the >@@ -1702,6 +1702,48 @@ > return 0 > } > >+# normalize_path() >+# Removes excess components from the file path: >+# - single dots, double dots, multiple consecutive slashes >+# are correctly collapsed >+# Correctly handles spaces in the path components. >+# >+normalize_path() >+{ >+ echo ${1} | awk '{ >+ res = ""; >+ split($0, pieces, "/"); >+ ii = 0; >+ len = length(pieces); >+ for (i = 1; i <= len; i++) { >+ if (pieces[i] == "") { >+ if (i == 1) { >+ # absolute path >+ res = "/"; >+ } >+ } else if (pieces[i] == ".") { >+ # ignoring dot >+ } else if (pieces[i] == "..") { >+ # unwind the path one step >+ if (ii > 0) { >+ delete tmp[ii-1]; >+ ii--; >+ } >+ } else { >+ tmp[ii] = pieces[i]; >+ ii++; >+ } >+ } >+ for (i = 0; i < length(tmp); i++) res = res tmp[i] "/"; >+ # remove trailing slash from the result >+ if (length(res) != 1) { >+ sub("/$", "", res); >+ } >+ print res; >+}' >+} >+ > fi > >+ > _rc_subr_loaded=: >--- etc/rc.d/jail 2009-12-16 13:34:53.000000000 +0200 >+++ etc/rc.d/jail.mkushnir 2009-12-16 13:35:18.000000000 +0200 >@@ -1,6 +1,6 @@ > #!/bin/sh > # >-# $FreeBSD: src/etc/rc.d/jail,v 1.44 2009/11/02 09:56:46 remko Exp $ >+# $FreeBSD$ > # > > # PROVIDE: jail >@@ -237,7 +237,7 @@ > > _dir=$1 > >- _dir=`echo $_dir | sed -Ee 's#//+#/#g' -e 's#/$##'` >+ _dir="`normalize_path \"${_dir}\"`" > [ ! -d "${_dir}" ] && return 1 > _dir2=`df ${_dir} | tail +2 | awk '{ print $6 }'` > [ "${_dir}" = "${_dir2}" ]
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 141678
: 102013