[PATCH] Write grub-mkimage output in a safer way
* util/grub-mkimage.c (main): If asked to write to an output file rather than stdout, open FILE.new and rename it into place at the end. This is safer in the event of a failure in the middle. --- ChangeLog | 6 ++ util/grub-mkimage.c | 12 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 37184be..4304182 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-12-11 Colin Watson cjwat...@ubuntu.com + + * util/grub-mkimage.c (main): If asked to write to an output file + rather than stdout, open FILE.new and rename it into place at the + end. This is safer in the event of a failure in the middle. + 2013-12-11 Vladimir Serbinenko phco...@gmail.com * grub-core/kern/ia64/dl.c (grub_arch_dl_relocate_symbols): Add checks diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c index 0243741..a5b40b3 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -232,6 +232,7 @@ main (int argc, char *argv[]) { FILE *fp = stdout; struct arguments arguments; + char *output_new = NULL; grub_util_host_init (argc, argv); @@ -260,7 +261,8 @@ main (int argc, char *argv[]) if (arguments.output) { - fp = grub_util_fopen (arguments.output, wb); + output_new = xasprintf (%s.new, arguments.output); + fp = grub_util_fopen (output_new, wb); if (! fp) grub_util_error (_(cannot open `%s': %s), arguments.output, strerror (errno)); @@ -292,7 +294,13 @@ main (int argc, char *argv[]) free (arguments.dir); if (arguments.output) -free (arguments.output); +{ + if (grub_util_rename (output_new, arguments.output) 0) + grub_util_error (_(cannot rename the file %s to %s), +output_new, arguments.output); + free (output_new); + free (arguments.output); +} return 0; } -- 1.8.4.4 ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [Xen-devel] pvgrub2 is merged
I can't confirm for 100% now, but I'll be 90-95% at FOSDEM and if I'll be ther I'm ok to give a talk. Is this offer still on the table? On 14.11.2013 09:37, Ian Campbell wrote: On Wed, 2013-11-13 at 19:25 +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote: On 13.11.2013 17:36, Ian Campbell wrote: On Sat, 2013-11-09 at 21:52 +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote: Hello, all. pvgrub2 has just became part of upstream grub as ports i386-xen and x86_64-xen. http://git.savannah.gnu.org/cgit/grub.git I was just talking to some folks here and we thought this might make an interesting topic for a talk at fosdem e.g. in the virt and iaas room. http://lists.xen.org/archives/html/xen-devel/2013-10/msg01824.html http://www.xenproject.org/about/events/viewevent/74-fosdem-2014-virtualization-and-iaas-devroom.html I guess you have some interesting war stories from doing a pv port and all the kexec/launching stuff? Yes, I can give a talk. Even though it's not clear to me what yet what the contents will be. AFAICT you did this port with only a pretty minimal amount of input from Xen developers, xen-devel, etc which is pretty impressive. I thought you might have some interesting insights into some of the murkier corners of the Xen PV architecture, things that were easier/harder than expected, perhaps some general thoughts or advice on doing a PV OS port etc. Does giving a talk gives right to stay at student campus there? (it's the case for some conferences but not all) I can't find the reference but I seem to remember seeing somewhere that fosdem offer neither travel not accommodation subsidies. Also, this is a devroom rather than main track. When I've given a devroom talk in the past it was never suggested to me, but I also never asked. Ian. signature.asc Description: OpenPGP digital signature ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [Xen-devel] pvgrub2 is merged
On Wed, 2013-12-11 at 12:47 +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote: I can't confirm for 100% now, but I'll be 90-95% at FOSDEM and if I'll be ther I'm ok to give a talk. Is this offer still on the table? I'm afraid the deadline for submissions has passed (IIRC it was 1 December, at least for the virt devroom). Ian. On 14.11.2013 09:37, Ian Campbell wrote: On Wed, 2013-11-13 at 19:25 +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote: On 13.11.2013 17:36, Ian Campbell wrote: On Sat, 2013-11-09 at 21:52 +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote: Hello, all. pvgrub2 has just became part of upstream grub as ports i386-xen and x86_64-xen. http://git.savannah.gnu.org/cgit/grub.git I was just talking to some folks here and we thought this might make an interesting topic for a talk at fosdem e.g. in the virt and iaas room. http://lists.xen.org/archives/html/xen-devel/2013-10/msg01824.html http://www.xenproject.org/about/events/viewevent/74-fosdem-2014-virtualization-and-iaas-devroom.html I guess you have some interesting war stories from doing a pv port and all the kexec/launching stuff? Yes, I can give a talk. Even though it's not clear to me what yet what the contents will be. AFAICT you did this port with only a pretty minimal amount of input from Xen developers, xen-devel, etc which is pretty impressive. I thought you might have some interesting insights into some of the murkier corners of the Xen PV architecture, things that were easier/harder than expected, perhaps some general thoughts or advice on doing a PV OS port etc. Does giving a talk gives right to stay at student campus there? (it's the case for some conferences but not all) I can't find the reference but I seem to remember seeing somewhere that fosdem offer neither travel not accommodation subsidies. Also, this is a devroom rather than main track. When I've given a devroom talk in the past it was never suggested to me, but I also never asked. Ian. ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [Xen-devel] pvgrub2 is merged
On 11.12.2013 12:51, Ian Campbell wrote: On Wed, 2013-12-11 at 12:47 +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote: I can't confirm for 100% now, but I'll be 90-95% at FOSDEM and if I'll be ther I'm ok to give a talk. Is this offer still on the table? I'm afraid the deadline for submissions has passed (IIRC it was 1 December, at least for the virt devroom). Ok, np Ian. On 14.11.2013 09:37, Ian Campbell wrote: On Wed, 2013-11-13 at 19:25 +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote: On 13.11.2013 17:36, Ian Campbell wrote: On Sat, 2013-11-09 at 21:52 +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote: Hello, all. pvgrub2 has just became part of upstream grub as ports i386-xen and x86_64-xen. http://git.savannah.gnu.org/cgit/grub.git I was just talking to some folks here and we thought this might make an interesting topic for a talk at fosdem e.g. in the virt and iaas room. http://lists.xen.org/archives/html/xen-devel/2013-10/msg01824.html http://www.xenproject.org/about/events/viewevent/74-fosdem-2014-virtualization-and-iaas-devroom.html I guess you have some interesting war stories from doing a pv port and all the kexec/launching stuff? Yes, I can give a talk. Even though it's not clear to me what yet what the contents will be. AFAICT you did this port with only a pretty minimal amount of input from Xen developers, xen-devel, etc which is pretty impressive. I thought you might have some interesting insights into some of the murkier corners of the Xen PV architecture, things that were easier/harder than expected, perhaps some general thoughts or advice on doing a PV OS port etc. Does giving a talk gives right to stay at student campus there? (it's the case for some conferences but not all) I can't find the reference but I seem to remember seeing somewhere that fosdem offer neither travel not accommodation subsidies. Also, this is a devroom rather than main track. When I've given a devroom talk in the past it was never suggested to me, but I also never asked. Ian. signature.asc Description: OpenPGP digital signature ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: Quick question?
On Tue, Dec 10, 2013 at 12:40:28PM +, Stojsavljevic, Zoran wrote: Version #5536. There isn't a direct equivalent of bzr revno in git (for what I've always felt are spurious reasons, but anyway). git describe --tags HEAD, or just the SHA-1 of the tip commit, are generally reasonable approaches depending on what you're trying to do. -- Colin Watson [cjwat...@ubuntu.com] ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [Xen-devel] pvgrub2 is merged
On mer, 2013-12-11 at 12:54 +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote: On 11.12.2013 12:51, Ian Campbell wrote: On Wed, 2013-12-11 at 12:47 +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote: I can't confirm for 100% now, but I'll be 90-95% at FOSDEM and if I'll be ther I'm ok to give a talk. Is this offer still on the table? I'm afraid the deadline for submissions has passed (IIRC it was 1 December, at least for the virt devroom). Ok, np So, what about writing a blog post about this, with, if you want, specific instructions on ho to test this? Both me and George asked this before... George specifically asked whether we could have it in time for one of the Xen 4.4 test days, which would really be ideal. Still, there is no real deadline this time... Even if it's after 4.4 will be out, we really would like to have something on the project blog. Up for it? :-) Thanks and Regards, Dario -- This happens because I choose it to happen! (Raistlin Majere) - Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems RD Ltd., Cambridge (UK) signature.asc Description: This is a digitally signed message part ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel