Skip to content

Commit

Permalink
use /usr/bin for gidmapper, (default secure_path for sudo does not in…
Browse files Browse the repository at this point in the history
…clude /usr/loca/bin
  • Loading branch information
ezrizhu committed Feb 20, 2024
1 parent ba6a906 commit d6c6269
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh

wget https://github.com/ezrizhu/gidmapper/releases/download/0.0.3/gidmapper -O /usr/local/bin/gidmapper
chmod +x /usr/local/bin/gidmapper
setcap 'CAP_SETGID=ep' /usr/local/bin/gidmapper
wget https://github.com/ezrizhu/gidmapper/releases/download/0.0.3/gidmapper -O /usr/bin/gidmapper
chmod +x /usr/bin/gidmapper
setcap 'CAP_SETGID=ep' /usr/bin/gidmapper
2 changes: 1 addition & 1 deletion test/gidmapping.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TRY_TOP="${TRY_TOP:-$(git rev-parse --show-toplevel --show-superproject-working-
TRY="$TRY_TOP/try"

control=$(id -G)
testing=$("$TRY" id -G)
testing=$("$TRY" id -G 2>/dev/null)

if [ "$control" = "$testing" ]
then
Expand Down
5 changes: 2 additions & 3 deletions test/missing_unionfs_mergerfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@ try_workspace="$(mktemp -d)"
cd "$try_workspace" || return 9

new_bin_dir="$(mktemp -d)"
mkdir -p "$new_bin_dir/usr/local"
mkdir "$new_bin_dir/usr"
# -s makes symlinks
cp -rs /usr/bin "$new_bin_dir/usr/bin"
cp -rs /usr/local/bin "$new_bin_dir/usr/local/bin"

# Delete mergerfs and unionfs and set the new PATH to the temporary directory
rm -f "$new_bin_dir/usr/bin/mergerfs" 2>/dev/null
rm -f "$new_bin_dir/usr/bin/unionfs" 2>/dev/null

echo hi >expected
PATH="$new_bin_dir/usr/bin:$new_bin_dir/usr/local/bin" "$TRY" -y "echo hi" >target 2>/dev/null || return 1
PATH="$new_bin_dir/usr/bin" "$TRY" -y "echo hi" >target 2>/dev/null || return 1
diff -q expected target || return 2

0 comments on commit d6c6269

Please sign in to comment.