From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH OSSTEST 1/2] uboot: use "readlink -f" Date: Fri, 27 Mar 2015 09:28:39 +0000 Message-ID: <1427448519.13935.73.camel@citrix.com> References: <1427197552-29042-1-git-send-email-wei.liu2@citrix.com> <1427197552-29042-2-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YbQZI-0008WR-Dj for xen-devel@lists.xenproject.org; Fri, 27 Mar 2015 09:28:44 +0000 In-Reply-To: <1427197552-29042-2-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: xen-devel@lists.xenproject.org, ian.jackson@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On Tue, 2015-03-24 at 11:45 +0000, Wei Liu wrote: > If the path is not a symlink, readlink by default returns empty string. > Use "-f" to always return canonical path. This fixes the problem that > xenpolicy file not getting loaded (because it is not a symlink). > > Also change another spot that calls readlink to get xen binary path in > case in the future we decide to not use symlink. Unfortunately this has unexpectedly made things worse. See: http://www.chiark.greenend.org.uk/~xensrcts/logs/36757/ The issue is that readlink -f returns the full absolute path, so given $ ls /boot/xen* xen -> xen-X.Y xen-X.Y Then: $ readlink /boot/xen xen-X.Y $ readlink -f /boot/xen /boot/xen-X.Y This breaks because on these systems /boot is a separate partition, so from the bootloaders point of view we need to be accessing /xen-X.Y not /boot/xen-X.Y. I don't know of an easy way to get the path of a file relative to the filesystem root which contains it. So I would propose to drop the second hunk and the second paragraph of the commit message and to make the first hunk simply "flaskpolicy=$flaskpolicy" (rather than unescaping the usages, this will make it easier to change in the future). I think that resubmission will end up being to the new colo at this point. > > Signed-off-by: Wei Liu > --- > Osstest/Debian.pm | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm > index 6784024..b829878 100644 > --- a/Osstest/Debian.pm > +++ b/Osstest/Debian.pm > @@ -162,7 +162,7 @@ sub setupboot_uboot ($$$$) { > $flask_commands = < > setenv flask_policy_addr_r 0x1200000 > -flaskpolicy=`readlink /boot/$flaskpolicy` > +flaskpolicy=`readlink -f /boot/$flaskpolicy` > ext2load scsi 0 \\\${flask_policy_addr_r} \$flaskpolicy > fdt mknod /chosen module\@2 > fdt set /chosen/module\@2 compatible "xen,xsm-policy" "xen,multiboot-module" > @@ -227,7 +227,7 @@ fi > cp -n /boot/boot.xen /boot/boot.xen.bak > cp -n /boot/boot.scr.xen /boot/boot.scr.xen.bak > > -xen=`readlink /boot/$xen` > +xen=`readlink -f /boot/$xen` > > cat >/boot/boot.xen < ${load_dtb}