The "torsocks on" subcommand exports the LD_PRELOAD (Linux) or DYLD_INSERT_LIBRARIES (OSX), but as the torsocks script finishes in bash the exports are lost, as the control returns to the parent process (the bash shell) of the torsocks script.
The easiest fix is to start a new shell from the "torsocks on" subcommand execution.
Oscar
Trac: Username: okoeroo
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items 0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items 0
Link issues together to show that they're related.
Learn more.
This patch is tested to work against the current git HEAD and 1.2 tag on OSX 10.6 and Ubuntu 12.10. On both installation I've tested this using a bash, dash and zsh. Also verified on dash and zsh that this problem exists.
In all cases the oneliner fix solves the problem for this subcommand. After all, this is just how shells should behave with exported environment variables by spawning a new shell of whatever /bin/sh points to.
The SHELL default export doesn't exist on most shells. I don't understand why this is set to be the default.
You just broke the correct usage of torsocks on for everyone who bothered to RTFM or RTFS.
From the torsocks script:
# The second form allows for torsocks(8) to be switched on and off for a# session (that is, it adds and removes torsocks from the LD_PRELOAD environment# variable). This form must be _sourced_ into the user's existing session# (and will only work with bourne shell users):## . /usr/bin/torsocks on# telnet www.foo.org # . /usr/bin/torsocks off# # Or# # source /usr/bin/torsocks on# telnet www.foo.org# source /usr/bin/torsocks off## The third form creates a new shell with LD_PRELOAD set and is achieved# simply by running the script with no arguments # # /usr/bin/torsocks## When finished the user can simply terminate the shell with 'exit'
From the torsocks(1) man page:
[on|off] this option adds or removes torsocks(8) from the LD_PRELOAD environment variable. When torsocks(8) is in this variable all executed applications are automatically socksified. If you want to use this function, you HAVE to source the shell script from yours, like this: "source /usr/bin/torsocks" or ". /usr/bin/tor‐ socks" Example: ". torsocks on" -- add the torsocks lib to LD_PRELOAD ". torsocks off" -- remove the torsocks lib from LD_PRELOAD
<without any argument> create a new shell with LD_PRELOAD including torsocks(8).
Trac: Status: closed to reopened Resolution: fixed toN/A