[tbb-bugs] #13770 [Tor Browser]: BusyBox-style bundling of Go programs can save space
Tor Bug Tracker & Wiki
blackhole at torproject.org
Sat Nov 15 20:17:58 UTC 2014
#13770: BusyBox-style bundling of Go programs can save space
-----------------------------+----------------------
Reporter: dcf | Owner: tbb-team
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: Tor Browser | Version:
Resolution: | Keywords:
Actual Points: | Parent ID:
Points: |
-----------------------------+----------------------
Comment (by yawning):
Hey, that's really neat.
Replying to [comment:2 dcf]:
> On linux and mac, we can use symbolic links to the executable. I don't
know what is done on Windows. Maybe batch files, or stub programs that
change argv[0] and then exec?
NTFS kind of sort of has symlinks but assuming that the target filesystem
is NTFS instead of FAT32/exFAT will end in tears.
How about adding code to the begining of `main()` that:
* Looks at `os.Args[1]` for `--progname=<name>` (Do this manually, and
not with the flag package.)
* If present (and `name` in `progName`), do something like:
{{{
// Rewrite argv[0], and strip out progname from the arguments, so
that using the
// 'flag' package doesn't break.
newArgs := make([]string, 0, 1 + len(os.Args) - 2)
newArgs = append(newArgs, progName)
if len(os.Args) > 2 {
newArgs = append(newArgs, os.Args[2:]...)
}
os.Args = newArgs
}}}
Edit the Windows torrc as appropriate. It's a bit kludgey, but it
probably beats batchfiles and stub executables, and it's relatively
robust, and having that there is relatively harmless across all platforms
(assuming that missing argument is treated as a non-fatal error).
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/13770#comment:4>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tbb-bugs
mailing list