Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | #!/bin/sh |
michael@0 | 2 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 5 | |
michael@0 | 6 | # |
michael@0 | 7 | # Stupid wrapper to avoid win32 dospath/cygdrive issues |
michael@0 | 8 | # Try not to spawn programs from within this file. If the stuff in here looks royally |
michael@0 | 9 | # confusing, see bug: http://bugzilla.mozilla.org/show_bug.cgi?id=206643 |
michael@0 | 10 | # and look at the older versions of this file that are easier to read, but |
michael@0 | 11 | # do basically the same thing |
michael@0 | 12 | # |
michael@0 | 13 | |
michael@0 | 14 | prog=$1 |
michael@0 | 15 | shift |
michael@0 | 16 | if test -z "$prog"; then |
michael@0 | 17 | exit 0 |
michael@0 | 18 | fi |
michael@0 | 19 | |
michael@0 | 20 | # If $CYGDRIVE_MOUNT was not set in configure, give $mountpoint the results of mount -p |
michael@0 | 21 | mountpoint=$CYGDRIVE_MOUNT |
michael@0 | 22 | if test -z "$mountpoint"; then |
michael@0 | 23 | mountpoint=`mount -p` |
michael@0 | 24 | if test -z "$mountpoint"; then |
michael@0 | 25 | print "Cannot determine cygwin mount points. Exiting" |
michael@0 | 26 | exit 1 |
michael@0 | 27 | fi |
michael@0 | 28 | fi |
michael@0 | 29 | |
michael@0 | 30 | # Delete everything but "/cygdrive" (or other mountpoint) from mount=`mount -p` |
michael@0 | 31 | mountpoint=${mountpoint#*/} |
michael@0 | 32 | mountpoint=/${mountpoint%%[!A-Za-z0-9_]*} |
michael@0 | 33 | mountpoint=${mountpoint%/} |
michael@0 | 34 | |
michael@0 | 35 | args="" |
michael@0 | 36 | up="" |
michael@0 | 37 | if test "${prog}" = "-up"; then |
michael@0 | 38 | up=1 |
michael@0 | 39 | prog=${1} |
michael@0 | 40 | shift |
michael@0 | 41 | fi |
michael@0 | 42 | |
michael@0 | 43 | process=1 |
michael@0 | 44 | |
michael@0 | 45 | # Convert the mountpoint in parameters to Win32 filenames |
michael@0 | 46 | # For instance: /cygdrive/c/foo -> c:/foo |
michael@0 | 47 | for i in "${@}" |
michael@0 | 48 | do |
michael@0 | 49 | if test "${i}" = "-wrap"; then |
michael@0 | 50 | process=1 |
michael@0 | 51 | else |
michael@0 | 52 | if test "${i}" = "-nowrap"; then |
michael@0 | 53 | process= |
michael@0 | 54 | else |
michael@0 | 55 | if test -n "${process}"; then |
michael@0 | 56 | if test -n "${up}"; then |
michael@0 | 57 | pathname=${i#-I[a-zA-Z]:/} |
michael@0 | 58 | if ! test "${pathname}" = "${i}"; then |
michael@0 | 59 | no_i=${i#-I} |
michael@0 | 60 | driveletter=${no_i%%:*} |
michael@0 | 61 | i=-I${mountpoint}/${driveletter}/${pathname} |
michael@0 | 62 | fi |
michael@0 | 63 | else |
michael@0 | 64 | eval 'leader=${i%%'${mountpoint}'/[a-zA-Z]/*}' |
michael@0 | 65 | if ! test "${leader}" = "${i}"; then |
michael@0 | 66 | eval 'pathname=${i#'${leader}${mountpoint}'/[a-zA-Z]/}' |
michael@0 | 67 | eval 'no_mountpoint=${i#'${leader}${mountpoint}'/}' |
michael@0 | 68 | driveletter=${no_mountpoint%%/*} |
michael@0 | 69 | i=${leader}${driveletter}:/${pathname} |
michael@0 | 70 | fi |
michael@0 | 71 | fi |
michael@0 | 72 | fi |
michael@0 | 73 | |
michael@0 | 74 | args="${args} ${i}" |
michael@0 | 75 | fi |
michael@0 | 76 | fi |
michael@0 | 77 | done |
michael@0 | 78 | |
michael@0 | 79 | exec $prog $args |