shithub: shithub

Download patch

ref: fb60863ef49fb154bd6246bb4d439dc6be255a10
parent: 8c6fec14a4bf9f15df24ddc9cdd365805f5d29d7
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Jan 3 23:20:19 EST 2022

all: prevent conflict with /$repo and /{rc,bin,lib,...}

prefix repo name with 'r.' to ensure that it can never
conflict with any other diretory we bind in.

--- a/common.rc
+++ b/common.rc
@@ -27,7 +27,9 @@
 fn repons {
 	mntgen
 	mntgen /mnt/mnt
-	gitfs=/mnt/$repo/.git/fs
+	dir=/mnt/r.$repo
+	repodir=$dir/.git
+	gitfs=/mnt/$dir/.git/fs
 	ramfs -m /mnt/tmp
 	bind /bin /mnt/bin
 	bind /rc /mnt/rc
@@ -34,9 +36,9 @@
 	bind /sys /mnt/sys
 	bind -c /env /mnt/env
 	bind /dev /mnt/dev
-	bind $1/$2 /mnt/$repo
+	bind $1/$2 $dir
 	bind /mnt /
-	cd /mnt/$repo
+	cd $dir
 	git/fs
 	mntgen /mnt/scratch
 	rfork m
--- a/feed
+++ b/feed
@@ -37,7 +37,6 @@
 dfmt='WW, DD MMM YYYY hh:mm:ss Z'
 
 repons $gituser $repo
-repodir=/mnt/$repo/.git
 if(! ref=`{resolveref $refname}){
 	echo '<b>invalid ref '$refname'</b>'
 	exit
--- a/files
+++ b/files
@@ -15,7 +15,6 @@
 refname=$3
 
 repons $gituser $repo
-repodir=/mnt/$repo/.git
 if(! ref=`{resolveref $refname}){
 	echo '<b>invalid ref '$refname'</b>'
 	exit
--- a/info
+++ b/info
@@ -14,7 +14,6 @@
 refname=$3
 
 repons $gituser $repo
-repodir=/mnt/$repo/.git
 if(! ref=`{resolveref $refname}){
 	echo '<b>invalid ref '$refname'</b>'
 	exit
--- a/log
+++ b/log
@@ -14,7 +14,6 @@
 refname=$3
 
 repons $gituser $repo
-repodir=/mnt/$repo/.git
 if(! ref=`{resolveref $refname}){
 	echo '<b>invalid ref '$refname'</b>'
 	exit
--- a/patch
+++ b/patch
@@ -14,5 +14,5 @@
 hash=$3
 
 repons $gituser $repo
-cd /mnt/$repo
+cd $dir
 git/export $hash
--- a/show
+++ b/show
@@ -14,7 +14,6 @@
 refname=$3
 
 repons $gituser $repo
-repodir=/mnt/$repo/.git
 if(! ref=`{resolveref $refname}){
 	echo '<b>invalid ref '$refname'</b>'
 	exit
@@ -38,7 +37,7 @@
 	<b>date:</b> '$date'
 	<pre id="commit">'$msg'</pre><br/>
 	</p>'
-cd /mnt/$repo
+cd $dir
 echo '	<div id="diff">'
 git/export $refname | htcat | difftohtml
 echo '	</div>