xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@eu.citrix.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH 1 of 3 RESEND] libxl: Look for bootloader in libexec path
Date: Wed, 9 May 2012 15:01:01 +0100	[thread overview]
Message-ID: <4FAA789D.4080905@eu.citrix.com> (raw)
In-Reply-To: <1336570788.25514.117.camel@zakaz.uk.xensource.com>

On 09/05/12 14:39, Ian Campbell wrote:
> I think since libxl uses execvp the first two are handled by path
> expansion, the next two are what you are adding (so has priority over
> $PATH in your patch, which I think is OK) and the last one is irrelevant
> in this context (xend uses the same function for other contexts).
>
> However in order to not differ on the first two execvp needs to be given
> the opportunity to search the path, which means that you need to check
> of your newly constructed bootloader exists, and if it doesn't then try
> and continue with the relative path not the absolute one.
>
> Also since this patch comes before the rename+symlink patch as it stands
> this patch will temporarily break people who just have "pygrub" without
> a path in their config.
Ah, I didn't realize that xl would already search the path (via execvp).

I think it should be pretty straightforward to add a check for 
existence, and if not fall back to letting execvp search the path.

If I do that, arguably this patch would still come first in the series?  
Not that it matters much, really.

  -George

>
> Ian.
>
>> Signed-off-by: George Dunlap<george.dunlap@eu.citrix.com>
>>
>> diff -r 8a86d841e6d4 -r e43157a86933 tools/libxl/libxl_bootloader.c
>> --- a/tools/libxl/libxl_bootloader.c	Tue May 08 13:36:24 2012 +0200
>> +++ b/tools/libxl/libxl_bootloader.c	Wed May 09 11:38:50 2012 +0100
>> @@ -333,6 +333,7 @@ int libxl_run_bootloader(libxl_ctx *ctx,
>>
>>       char tempdir_template[] = "/var/run/libxl/bl.XXXXXX";
>>       char *tempdir;
>> +    const char *bootloader = NULL;
>>
>>       char *dom_console_xs_path;
>>       char dom_console_slave_tty_path[PATH_MAX];
>> @@ -397,6 +398,13 @@ int libxl_run_bootloader(libxl_ctx *ctx,
>>           goto out_close;
>>       }
>>
>> +    bootloader = libxl__abs_path(gc, info->u.pv.bootloader,
>> +                                 libxl__libexec_path());
>> +    if ( bootloader == NULL ) {
>> +        rc = ERROR_NOMEM;
>> +        goto out_close;
>> +    }
>> +
>>       /*
>>        * We need to present the bootloader's tty as a pty slave that xenconsole
>>        * can access.  Since the bootloader itself needs a pty slave,
>> @@ -417,7 +425,7 @@ int libxl_run_bootloader(libxl_ctx *ctx,
>>       dom_console_xs_path = libxl__sprintf(gc, "%s/console/tty", libxl__xs_get_dompath(gc, domid));
>>       libxl__xs_write(gc, XBT_NULL, dom_console_xs_path, "%s", dom_console_slave_tty_path);
>>
>> -    pid = fork_exec_bootloader(&bootloader_fd, info->u.pv.bootloader, args);
>> +    pid = fork_exec_bootloader(&bootloader_fd, bootloader, args);
>>       if (pid<  0) {
>>           goto out_close;
>>       }
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xen.org
>> http://lists.xen.org/xen-devel
>

  reply	other threads:[~2012-05-09 14:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-09 10:51 [PATCH 0 of 3 RESEND] tools: Move bootloaders to libexec directory George Dunlap
2012-05-09 10:51 ` [PATCH 1 of 3 RESEND] libxl: Look for bootloader in libexec path George Dunlap
2012-05-09 13:39   ` Ian Campbell
2012-05-09 14:01     ` George Dunlap [this message]
2012-05-09 10:51 ` [PATCH 2 of 3 RESEND] tools: Install pv bootloaders in libexec rather than /usr/bin George Dunlap
2012-05-09 13:41   ` Ian Campbell
2012-05-09 10:51 ` [PATCH 3 of 3 RESEND] libxl: Warn that /usr/bin/pygrub is deprecated George Dunlap
2012-05-09 13:43   ` Ian Campbell
2012-05-09 14:48     ` George Dunlap
2012-05-10 11:36       ` Ian Jackson
2012-05-10 11:37         ` George Dunlap
2012-05-10 11:44         ` Tim Deegan
2012-05-10 11:47           ` George Dunlap
2012-05-10 12:10             ` Tim Deegan
2012-05-10 13:15           ` Ian Jackson
2012-05-10 13:20             ` Tim Deegan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FAA789D.4080905@eu.citrix.com \
    --to=george.dunlap@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).