summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauri Aarnio <Lauri.Aarnio@iki.fi>2008-10-27 12:28:49 +0200
committerLauri Leukkunen <lle@rahina.org>2008-11-02 18:59:54 +0200
commit5c3432418c315c24f738e3146a079098047c7f0c (patch)
treeca0e7d4db4bbaacf6e2557945771c608a3f8ac96
parent9a31deda122de170dbd3050ffd4d82ad1d86c893 (diff)
sb2 command: added option -r (disables reverse mapping of paths) - reverse mapping seemed to cause trouble with gcc. Although that problem was fixed by my previous patch, reverse mapping may have other side-effects as well. This new "-r" option is useful for debugging such problems.
-rw-r--r--docs/sb2.16
-rwxr-xr-xutils/sb217
2 files changed, 18 insertions, 5 deletions
diff --git a/docs/sb2.1 b/docs/sb2.1
index 8a992b9..f24597b 100644
--- a/docs/sb2.1
+++ b/docs/sb2.1
@@ -3,7 +3,7 @@
sb2 \- crosscompiling environment
.SH SYNOPSIS
.B sb2
-[ \-R ] [ \-v ] [ \-d ] [ \-h ] [ \-t TARGET ] [ \-e ] [ \-m MODE ] [ -s DIRECTORY] [command] [arguments] [...]
+[ \-r ] [ \-R ] [ \-v ] [ \-d ] [ \-h ] [ \-t TARGET ] [ \-e ] [ \-m MODE ] [ -s DIRECTORY] [command] [arguments] [...]
.SH DESCRIPTION
.B sb2
Runs command in scratchbox2. If no command is given, a bash shell
@@ -43,6 +43,10 @@ Join a persistent session.
\-D file
Delete a persistent session. Warning: this does not
check if the session is still in use!
+.TP
+\-r
+Don't create reverse mapping rules: functions like getcwd() and realpath()
+will always return the real path.
.SH ENVIRONMENT
There are quite many environment variables being used. Since sb2 is still
diff --git a/utils/sb2 b/utils/sb2
index 65209d9..59e220f 100755
--- a/utils/sb2
+++ b/utils/sb2
@@ -29,6 +29,7 @@ Options:
-s DIRECTORY load mapping scripts from alternative location
-Q BUGLIST emulate bugs of the old scratchbox 1 (BUGLIST consists of
letters: 'x' enables exec permission checking bug emulation)
+ -r do not create reverse mapping rules
-R use simulated root permissions (currently activates
"fakeroot" for this functionality)
-p Preserve session directories (including the directory
@@ -579,8 +580,9 @@ fi
SBOX_DIR=$(readlink -f $(dirname $(readlink -f $my_path))/..)
SBOX_WORKDIR=$(readlink -f $PWD)
SBOX_FAKEROOT_PREFIX=""
+SBOX_CREATE_REVERSE_RULES="y"
-while getopts vdht:em:s:L:Q:pM:ZRS:J:D: foo
+while getopts vdht:em:s:L:Q:pM:ZrRS:J:D: foo
do
case $foo in
(v) version ;;
@@ -597,6 +599,7 @@ do
(s) SBOX_LUA_SCRIPTS=$OPTARG;;
(p) SBOX_SESSION_NO_CLEANUP="y";;
(Z) SBOX_OPT_Z_NO_LD_SO_EXEC="y";;
+ (r) SBOX_CREATE_REVERSE_RULES="n";;
(R) SBOX_FAKEROOT_PREFIX="fakeroot";;
(S) SBOX_WRITE_SESSION_INFO_TO_FILE=$OPTARG ;;
(J) SBOX_JOIN_SESSION_FILE=$OPTARG ;;
@@ -750,9 +753,15 @@ export LD_LIBRARY_PATH
# ------------
# Now everything is ready, programs can be executed in SB2'ed environment.
# Create reverse mapping rules before starting the actual command (or shell)
-sb2-monitor -L $SBOX_LIBSB2 -- $SBOX_DIR/bin/sb2-show \
- execluafile $SBOX_SESSION_DIR/lua_scripts/create_reverse_rules.lua \
- >$SBOX_SESSION_DIR/rev_rules.lua
+if [ "$SBOX_CREATE_REVERSE_RULES" == "y" ]
+then
+ sb2-monitor -L $SBOX_LIBSB2 -- $SBOX_DIR/bin/sb2-show \
+ execluafile $SBOX_SESSION_DIR/lua_scripts/create_reverse_rules.lua \
+ >$SBOX_SESSION_DIR/rev_rules.lua
+else
+ echo "-- Reverse rules disabled by command line option -r" \
+ >$SBOX_SESSION_DIR/rev_rules.lua
+fi
# ------------