[kernel-xen] kernel-xen-3.9.7-1 packages available - TESTERS REQUIRED!
netwiz at crc.id.au
Thu Jun 27 11:55:07 EST 2013
On 27/06/2013 11:05 AM, Adi Pircalabu wrote:
> On 27-06-2013 10:44 AM, Steven Haigh wrote:
>> On 26/06/2013 2:57 PM, Adi Pircalabu wrote:
>>> On 26-06-2013 13:51 PM, Steven Haigh wrote:
>>>> This makes me think I should use something like:
>>>> GRUB_CONF=$(readlink -f /etc/grub.conf 2>/dev/null)
>>>> if [ -z $GRUB_CONF ]; then
>>>> if [ -f "/boot/grub/grub.conf" ]; then
>>> Problem here, $GRUB_CONF link can point to any other file, you don't
>>> test the value but you then test if /boot/grub/grub.conf exists and use
>>> it. In this case the symlink test is useless.
>> Not quite. The -z operator will check for a zero length string.
> Ah yes, you're correct, I was (mis)reading it the other way. Though your
> zero test doesn't cover the case when /etc/grub.conf is a symlink to a
> non-existent file. To add an additional safeguard you might look at
> using '-e' readlink(1) option, for which the manual states:
> -e, --canonicalize-existing
> canonicalize by following every symlink in every
> component of the given name recursively, all components must exist
> Here's a quick test I did with/without '-e':
> adi at adi:~$ ln -sf /nonexistent /tmp/nonexistent
> adi at adi:~$ stat /tmp/nonexistent
> File: ‘/tmp/nonexistent’ -> ‘/nonexistent’
> Size: 12 Blocks: 0 IO Block: 4096 symbolic link
> Device: fc00h/64512d Inode: 917682 Links: 1
> Access: (0777/lrwxrwxrwx) Uid: ( 1000/ adi) Gid: ( 1000/ adi)
> Access: 2013-06-27 10:52:27.408079496 +1000
> Modify: 2013-06-27 10:52:23.932261559 +1000
> Change: 2013-06-27 10:52:23.932261559 +1000
> Birth: -
> adi at adi:~$ ls -l /tmp/nonexistent
> lrwxrwxrwx 1 adi adi 12 Jun 27 10:52 /tmp/nonexistent -> /nonexistent
> adi at adi:~$ readlink /tmp/nonexistent
> adi at adi:~$ echo $?
> (Oops, non-zero length here and no error returned!)
> adi at adi:~$ readlink -e /tmp/nonexistent
> adi at adi:~$ echo $?
> (All good here)
> You can get a similar result by using '-L' flag for stat(1) command.
> What do you think?
I'd say you're probably onto something here. I'm currently building
3.9.7-5 with the following:
GRUB_CONF=$(readlink -n -e /etc/grub.conf 2>/dev/null)
if [ -z $GRUB_CONF ]; then
if [ -f "/boot/grub/grub.conf" ]; then
echo "No valid grub.conf found. You'll need to
fix this manually!"
echo "Adding Xen lines to $GRUB_CONF for
etc etc etc
-e, --canonicalize-existing canonicalize by following every symlink in
every component of the given name
all components must exist
-n, --no-newline do not output the trailing newline
While the new line may not have caused any issues, having a non-newline
terminated string returned is probably more expected behaviour for any
3.9.7-5 will hit the testing repo shortly...
Email: netwiz at crc.id.au
Phone: (03) 9001 6090 - 0412 935 897
Fax: (03) 8338 0299
More information about the kernel-xen