Merge "Update chat for new calling conventions"
diff --git a/Makefile b/Makefile
index dcf827b..585b920 100644
--- a/Makefile
+++ b/Makefile
@@ -105,7 +105,7 @@
 deploy-staging: build-web-assets
 	git rev-parse --verify HEAD >> build/version
 	gcloud config set project vanadium-staging
-	gsutil -m rsync -d -r build gs://staging.chat.v.io
+	gsutil -m rsync -d -r build gs://chat.staging.v.io
 
 node_modules: package.json
 	npm prune
@@ -225,11 +225,11 @@
 	make test-web-runner
 endif
 
-# Note: runner.js sets the NAMESPACE_ROOT and PROXY_ADDR env vars for the
+# Note: runner.js sets the V23_NAMESPACE and PROXY_ADDR env vars for the
 # spawned test subprocess; we specify "make test-web-runner" as the test
 # command so that we can then reference these vars in the Vanadium extension
 # and our prova command.
-test-web-runner: APP_FRAME := "./build/index.html?mtname=$(NAMESPACE_ROOT)"
+test-web-runner: APP_FRAME := "./build/index.html?mtname=$(V23_NAMESPACE)"
 test-web-runner: VANADIUM_JS := $(VANADIUM_ROOT)/release/javascript/core
 test-web-runner: BROWSER_OPTS := --options="--load-extension=$(VANADIUM_JS)/extension/build-test/,--ignore-certificate-errors,--enable-logging=stderr" $(BROWSER_OPTS)
 test-web-runner:
diff --git a/README.md b/README.md
index 5d0f3e9..74936bf 100644
--- a/README.md
+++ b/README.md
@@ -183,7 +183,7 @@
 In order for the chat client to talk to the mounttable and proxy servers, you
 will need to get an identity from the identity server:
 
-    export VEYRON_CREDENTIALS=/tmp/vanadium-credentials
+    export V23_CREDENTIALS=/tmp/vanadium-credentials
     $VANADIUM_ROOT/release/go/bin/principal seekblessings
 
 Then run the binary and pass in the veyron.namespace.root and veyron.proxy
diff --git a/clients/shell/src/chat/channel.go b/clients/shell/src/chat/channel.go
index 0dbbb48..b823f71 100644
--- a/clients/shell/src/chat/channel.go
+++ b/clients/shell/src/chat/channel.go
@@ -39,8 +39,8 @@
 	"v.io/v23/options"
 	"v.io/v23/rpc"
 	"v.io/v23/security"
+	"v.io/v23/security/access"
 	mt "v.io/v23/services/mounttable"
-	"v.io/v23/services/security/access"
 
 	_ "v.io/x/ref/profiles/roaming"
 
diff --git a/clients/shell/src/chat/channel_test.go b/clients/shell/src/chat/channel_test.go
index e9fbc8c..52041fa 100644
--- a/clients/shell/src/chat/channel_test.go
+++ b/clients/shell/src/chat/channel_test.go
@@ -61,8 +61,6 @@
 	if err != nil {
 		t.Fatalf("failed to start root mount table: %s", err)
 	}
-	sh.Forget(rootMT)
-
 	rootMT.ExpectVar("PID")
 	rootName := rootMT.ExpectVar("MT_NAME")
 
@@ -70,9 +68,6 @@
 		if err := sh.Cleanup(nil, nil); err != nil {
 			t.Fatalf("failed to cleanup shell: %s", rootMT.Error())
 		}
-		if err := rootMT.Shutdown(nil, nil); err != nil {
-			t.Fatalf("failed to shutdown root mounttable: %s", rootMT.Error())
-		}
 	}
 }
 
diff --git a/clients/shell/src/chat/vdl/chat.vdl.go b/clients/shell/src/chat/vdl/chat.vdl.go
index 7351307..db5c5f6 100644
--- a/clients/shell/src/chat/vdl/chat.vdl.go
+++ b/clients/shell/src/chat/vdl/chat.vdl.go
@@ -28,31 +28,17 @@
 }
 
 // ChatClient returns a client stub for Chat.
-func ChatClient(name string, opts ...rpc.BindOpt) ChatClientStub {
-	var client rpc.Client
-	for _, opt := range opts {
-		if clientOpt, ok := opt.(rpc.Client); ok {
-			client = clientOpt
-		}
-	}
-	return implChatClientStub{name, client}
+func ChatClient(name string) ChatClientStub {
+	return implChatClientStub{name}
 }
 
 type implChatClientStub struct {
-	name   string
-	client rpc.Client
-}
-
-func (c implChatClientStub) c(ctx *context.T) rpc.Client {
-	if c.client != nil {
-		return c.client
-	}
-	return v23.GetClient(ctx)
+	name string
 }
 
 func (c implChatClientStub) SendMessage(ctx *context.T, i0 string, opts ...rpc.CallOpt) (err error) {
 	var call rpc.ClientCall
-	if call, err = c.c(ctx).StartCall(ctx, c.name, "SendMessage", []interface{}{i0}, opts...); err != nil {
+	if call, err = v23.GetClient(ctx).StartCall(ctx, c.name, "SendMessage", []interface{}{i0}, opts...); err != nil {
 		return
 	}
 	err = call.Finish()
diff --git a/clients/web/js/channel.js b/clients/web/js/channel.js
index 604252b..d069336 100644
--- a/clients/web/js/channel.js
+++ b/clients/web/js/channel.js
@@ -9,7 +9,7 @@
 var inherits = require('inherits');
 var path = require('path');
 
-var access = require('vanadium/src/gen-vdl/v.io/v23/services/security/access');
+var access = require('vanadium/src/gen-vdl/v.io/v23/security/access');
 var naming = require('vanadium').naming;
 var noop = require('./noop');
 var ServiceVdl = require('./chat/vdl');
diff --git a/tools/shell.sh b/tools/shell.sh
index b5d9b59..d55c678 100755
--- a/tools/shell.sh
+++ b/tools/shell.sh
@@ -13,9 +13,9 @@
 set -u
 
 TMPDIR="${TMPDIR-/tmp}"
-VEYRON_SHELL_TMP_DIRS=${VEYRON_SHELL_TMP_DIRS-$(mktemp "${TMPDIR}/XXXXXXXX")}
-VEYRON_SHELL_TMP_FILES=${VEYRON_SHELL_TMP_FILES-$(mktemp "${TMPDIR}/XXXXXXXX")}
-VEYRON_SHELL_TMP_PIDS=${VEYRON_SHELL_TMP_PIDS-$(mktemp "${TMPDIR}/XXXXXXXX")}
+V23_SHELL_TMP_DIRS=${V23_SHELL_TMP_DIRS-$(mktemp "${TMPDIR}/XXXXXXXX")}
+V23_SHELL_TMP_FILES=${V23_SHELL_TMP_FILES-$(mktemp "${TMPDIR}/XXXXXXXX")}
+V23_SHELL_TMP_PIDS=${V23_SHELL_TMP_PIDS-$(mktemp "${TMPDIR}/XXXXXXXX")}
 
 trap shell::at_exit INT TERM EXIT
 
@@ -29,10 +29,10 @@
 # for example, to garbage collect any temporary files and directories
 # created by invocations of shell::tmp_file and shell:tmp_dir.
 shell::at_exit() {
-  # If the variable VEYRON_SHELL_CMD_LOOP_AT_EXIT is non-empty, accept commands
+  # If the variable V23_SHELL_CMD_LOOP_AT_EXIT is non-empty, accept commands
   # from the user in a command loop.  This can preserve the state in the logs
   # directories while the user examines them.
-  case "${VEYRON_SHELL_CMD_LOOP_AT_EXIT-}" in
+  case "${V23_SHELL_CMD_LOOP_AT_EXIT-}" in
   ?*)
     local cmdline
     set +u
@@ -45,16 +45,16 @@
   esac
   # Unset the trap so that it doesn't run again on exit.
   trap - INT TERM EXIT
-  for pid in $(cat "${VEYRON_SHELL_TMP_PIDS}"); do
+  for pid in $(cat "${V23_SHELL_TMP_PIDS}"); do
     sudo -u "${SUDO_USER}" kill "${pid}" &> /dev/null || true
   done
-  for tmp_dir in $(cat "${VEYRON_SHELL_TMP_DIRS}"); do
+  for tmp_dir in $(cat "${V23_SHELL_TMP_DIRS}"); do
      sudo -u "${SUDO_USER}" rm -rf "${tmp_dir}" &>/dev/null
   done
-  for tmp_file in $(cat "${VEYRON_SHELL_TMP_FILES}"); do
+  for tmp_file in $(cat "${V23_SHELL_TMP_FILES}"); do
      sudo -u "${SUDO_USER}" rm -f "${tmp_file}" &>/dev/null
   done
-   sudo -u "${SUDO_USER}" rm -f "${VEYRON_SHELL_TMP_DIRS}" "${VEYRON_SHELL_TMP_FILES}" "${VEYRON_SHELL_TMP_PIDS}" &>/dev/null
+   sudo -u "${SUDO_USER}" rm -f "${V23_SHELL_TMP_DIRS}" "${V23_SHELL_TMP_FILES}" "${V23_SHELL_TMP_PIDS}" &>/dev/null
 }
 
 # shell::kill_child_processes kills all child processes.
@@ -136,7 +136,7 @@
 #   local -R TMP_DIR=$(shell::tmp_dir)
 shell::tmp_dir() {
   local -r RESULT=$(mktemp -d "${TMPDIR}/XXXXXXXX")
-  echo "${RESULT}" >> "${VEYRON_SHELL_TMP_DIRS}"
+  echo "${RESULT}" >> "${V23_SHELL_TMP_DIRS}"
   echo "${RESULT}"
 }
 
@@ -146,7 +146,7 @@
 #   local -R TMP_FILE=$(shell::tmp_file)
 shell::tmp_file() {
   local -r RESULT=$(mktemp "${TMPDIR}/XXXXXXXX")
-  echo "${RESULT}" >> "${VEYRON_SHELL_TMP_FILES}"
+  echo "${RESULT}" >> "${V23_SHELL_TMP_FILES}"
   echo "${RESULT}"
 }
 
@@ -170,7 +170,7 @@
     "$@" > "${STDOUT}" 2> "${STDERR}" &
   fi
   local -r SERVER_PID=$!
-  echo "${SERVER_PID}" >> "${VEYRON_SHELL_TMP_PIDS}"
+  echo "${SERVER_PID}" >> "${V23_SHELL_TMP_PIDS}"
   echo "${SERVER_PID}"
 
   for i in $(seq 1 "${TIMEOUT}"); do