From be66f4f60797dabe551390bd1956162c3b7bb2a6 Mon Sep 17 00:00:00 2001 From: Tom Mortensen Date: Sat, 16 Jul 2016 13:07:07 -0700 Subject: [PATCH] Correctly handle symlink location display when browsing user share. Had to change the name of our shfs location extended attributes: user.LOCATION -> system.LOCATION user.LOCATIONS -> system.LOCATIONS --- plugins/dynamix.vm.manager/scripts/qemu.php | 2 +- plugins/dynamix/Browse.page | 2 +- plugins/dynamix/include/Helpers.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/dynamix.vm.manager/scripts/qemu.php b/plugins/dynamix.vm.manager/scripts/qemu.php index 1ee5390fe..1f18cb3f2 100755 --- a/plugins/dynamix.vm.manager/scripts/qemu.php +++ b/plugins/dynamix.vm.manager/scripts/qemu.php @@ -14,7 +14,7 @@ function detect_user_share(&$arg) { $arg = preg_replace_callback('|(/mnt/user/[^,]+\.[^,\s]*)|', function($match) { if (is_file($match[0])) { // resolve the actual disk or cache backing device for this user share path - $realdisk = trim(shell_exec("getfattr --absolute-names --only-values -n user.LOCATION ".escapeshellarg($match[0])." 2>/dev/null")); + $realdisk = trim(shell_exec("getfattr --absolute-names --only-values -n system.LOCATION ".escapeshellarg($match[0])." 2>/dev/null")); if (!empty($realdisk)) { $replacement = str_replace('/mnt/user/', "/mnt/$realdisk/", $match[0]); diff --git a/plugins/dynamix/Browse.page b/plugins/dynamix/Browse.page index ba936831c..84502fef0 100644 --- a/plugins/dynamix/Browse.page +++ b/plugins/dynamix/Browse.page @@ -35,7 +35,7 @@ function sort_by($field, $opt, $show_disk) { 'fext' => strtolower($info['extension']), 'size' => $attr[2], 'time' => $attr[3], - 'disk' => $show_disk?my_disk(exec("shopt -s dotglob ; getfattr --absolute-names --only-values -n user.LOCATIONS ".escapeshellarg($attr[1]))):''); + 'disk' => $show_disk?my_disk(exec("shopt -s dotglob ; getfattr --no-dereference --absolute-names --only-values -n system.LOCATIONS ".escapeshellarg($attr[1]))):''); } // sort by input 'field' if ($field=='name') { diff --git a/plugins/dynamix/include/Helpers.php b/plugins/dynamix/include/Helpers.php index adc64448f..4fd69cdd9 100644 --- a/plugins/dynamix/include/Helpers.php +++ b/plugins/dynamix/include/Helpers.php @@ -228,7 +228,7 @@ function autov($file) { } function transpose_user_path($path) { if (strpos($path, '/mnt/user/') === 0 && file_exists($path)) { - $realdisk = trim(shell_exec("getfattr --absolute-names --only-values -n user.LOCATION ".escapeshellarg($path)." 2>/dev/null")); + $realdisk = trim(shell_exec("getfattr --absolute-names --only-values -n system.LOCATION ".escapeshellarg($path)." 2>/dev/null")); if (!empty($realdisk)) $path = str_replace('/mnt/user/', "/mnt/$realdisk/", $path); }