Commit graph

1939 commits

Author SHA1 Message Date
Andrei Borzenkov
64440daa21 util/setup: fix memory leak.
Found by: Coverity scan.
2015-01-26 23:04:09 +03:00
Vladimir Serbinenko
11eed6abce util/misc.c: Check ftello return value.
Found by: Coverity scan.
2015-01-26 09:56:24 +01:00
Vladimir Serbinenko
5d61a6a612 grub-macbless: Fix resource leak.
Found by: Coverity scan.
2015-01-26 09:55:58 +01:00
Vladimir Serbinenko
3c6384832b grub-install: Fix memory leak.
Found by: Coverity scan.
2015-01-26 09:55:30 +01:00
Vladimir Serbinenko
c3f5230597 grub-install-common: Fix sizeof usage.
Found by: Coverity scan.
2015-01-26 09:54:50 +01:00
Vladimir Serbinenko
866f469683 util/getroot: Add missing grub_disk_close.
Found by: Coverity scan.
2015-01-26 09:54:14 +01:00
Vladimir Serbinenko
eeea31b220 util/grub-mkrescue.c: Always include part_msdos and part_gpt on EFI.
When booted from stick, EFI would use GPT partition and our root
device detection algortihm depends on GRUB's ability to see the same
partitions. Hence include msdos and gpt partmap modules on EFI even when
they're not needed to access root filesystem.
2015-01-24 17:45:16 +01:00
Andrei Borzenkov
cdae5bf208 Avoid use of non-portable echo -n in grub-mkconfig
util/grub-mkconfig_lib.in(version_test_gt): "echo -n" is not really needed,
final newline is stripped by command substitution.

util/grub.d/10_kfreebsd.in, util/grub.d/10_linux.in,
util/grub.d/20_linux_xen.in: change how list is built, to avoid echo -n
completely.

util/grub.d/30_os-prober.in: add spaces to printed line directly

Closes 43668.
2014-12-07 14:56:17 +03:00
Andrei Borzenkov
740c08ed2f Use ssize_t for grub_util_fd_read result
Fixes commit 0415dbe28f.
2014-11-28 21:43:07 +03:00
Andrei Borzenkov
0415dbe28f grub-install-common: avoid out of bound access when read failed
Check that modinfo.sh could be read successfully; abort on error. Avoids
potential out-of-bound array access.

CID: 73819
2014-11-28 20:45:27 +03:00
Andrei Borzenkov
478b567520 grub-mkstandalone: out of bound access to tar header magic
Magic size is 6 bytes and we copied 7 bytes in it.

CID: 73587, 73888
Closes bug 43690
2014-11-28 20:39:22 +03:00
Andrey Borzenkov
954fe77163 cleanup: grub_cpu_to_XXX_compile_time for constants
This tries to catch all cases where grub_cpu_to_XXX was used for constant
expressions (including sizeof).
2014-09-22 20:47:10 +04:00
Andrey Borzenkov
c291f47b2c Fix typo (gettext_print instead of gettext_printf) 2014-08-14 21:02:31 +04:00
Colin Watson
0901e7855f Fix an infinite loop in grub-mkconfig
* util/grub.d/10_hurd.in: Make kernel list progression not fail on
kernels whose paths contain regex metacharacters.
* util/grub.d/10_kfreebsd.in: Likewise.
* util/grub.d/10_linux.in: Likewise.
* util/grub.d/20_linux_xen.in: Likewise.

Reported by: Heimo Stranner.
2014-07-08 23:54:30 +01:00
Glenn Washburn
fa33530870 * util/grub-install.c: Fix handling of --disk-module. 2014-06-22 01:45:11 +02:00
Trevor Woerner
87de66d9d8 * util/grub-gen-asciih.c (add_glyph): Fix uninitialised variable. 2014-06-21 20:26:47 +02:00
Colin Watson
3a310e842f Tolerate devices with no filesystem UUID returned by os-prober
* util/grub.d/30_os-prober.in: Tolerate devices with no filesystem
UUID.  Other parts of grub-mkconfig tolerate these, they were
previously allowed here up to commit
55e706c918, and they can arise in
practice when the system has active LVM snapshots.
Fixes Ubuntu bug #1287436.
2014-04-10 16:54:33 +01:00
Colin Watson
24024dac7f Fix partmap, cryptodisk, and abstraction handling in grub-mkconfig.
Commit 588744d0dc caused grub-mkconfig
no longer to be forgiving of trailing spaces on grub-probe output
lines, which among other things means that util/grub.d/10_linux.in
no longer detects LVM.  To fix this, make grub-probe's output
delimiting more consistent.  As a bonus, this improves the coverage
of the -0 option.

Fixes Debian bug #735935.

* grub-core/disk/cryptodisk.c
(grub_util_cryptodisk_get_abstraction): Add a user-data argument.
* grub-core/disk/diskfilter.c (grub_diskfilter_get_partmap):
Likewise.
* include/grub/cryptodisk.h (grub_util_cryptodisk_get_abstraction):
Update prototype.
* include/grub/diskfilter.h (grub_diskfilter_get_partmap): Likewise.
* util/grub-install.c (push_partmap_module, push_cryptodisk_module,
probe_mods): Adjust for extra user-data arguments.
* util/grub-probe.c (do_print, probe_partmap, probe_cryptodisk_uuid,
probe_abstraction): Use configured delimiter.  Update callers.
2014-03-31 14:48:46 +01:00
Colin Watson
9b35fe819f Fix grub-probe -0 option
* util/grub-probe,c (options): Make -0 work again (broken by
conversion to argp).
(main): Simplify logic.
2014-03-31 13:51:17 +01:00
Vladimir Serbinenko
006c78f378 * util/grub-mkrescue.c: Build fix for argp.h with older gcc. 2014-02-03 14:35:51 +01:00
Vladimir Serbinenko
511ece7ceb * util/grub-mkfont.c: Build fix for argp.h with older gcc. 2014-02-03 14:34:27 +01:00
Vladimir Serbinenko
ba424f37a9 * util/grub-mkfont.c: Downgrade warnings about unhandled features
to debug.
2014-01-29 23:41:48 +01:00
Andrey Borzenkov
5ae584c0b0 fix Mingw W64-32 cross compile failure due to printf redefinition in libintl.h
In file included from util/misc.c:36:0:
./include/grub/emu/misc.h:56:1: error: 'libintl_printf' is an unrecognized format function type [-Werror=format=]
 char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))) WARN_UNUSED_RESULT;
 ^
./include/grub/emu/misc.h:58:1: error: 'libintl_printf' is an unrecognized format function type [-Werror=format=]

The reason is libintl.h which redefines printf as libintl_printf. The problem
is not present in native MinGW build which avoids redefinition.  Use
(format (__printf__) instead which is valid replacement in GCC.

v2: add grub-core/lib/libgcrypt/src/g10lib.h
v3: modify g10lib.h during import
2014-01-25 21:49:41 +04:00
Andrey Borzenkov
1440b7ebae do not set default prefix in grub-mkimage
Default prefix is likely wrong on Unix and completely wrong on Windows.
Let caller set it explicitly to avoid any ambiguity.
2014-01-25 19:54:51 +04:00
Vladimir Serbinenko
61c8482b20 Fix several translatable strings.
Suggested by: D. Prévot.
2014-01-24 18:20:27 +01:00
Vladimir Serbinenko
95cd131ea0 * util/grub-install.c: List available targets. 2014-01-24 18:09:25 +01:00
Colin Watson
d08059309f * util/grub-install.c (write_to_disk): Add an info message. 2014-01-23 12:05:36 +00:00
Vladimir Serbinenko
b204b718cc * util/grub-install.c: Fix a typo. 2014-01-18 20:02:51 +01:00
Vladimir Serbinenko
ae80f31270 * util/grub-mount.c: Extend GCC warning workaround to grub-mount. 2014-01-18 16:43:29 +01:00
Colin Watson
ff66b8e7d8 Prefer more portable test(1) constructs
* util/grub.d/00_header.in (make_timeout): Use && rather than test
-a.
* util/grub.d/10_windows.in: Likewise.
* util/grub.d/10_netbsd.in (netbsd_load_fs_module): Use || rather
than test -o.
* util/grub.d/30_os-prober.in: Use && rather than test -a, and ||
rather than test -o.
2014-01-17 15:29:43 +00:00
Andrey Borzenkov
0776112c53 add part_apple to EFI rescue image to fix missing prefix
On Mac rescue image is booted from HFS+ partition, so bootpath looks like
/ACPI(a0341d0,0)/PCI(1,1f)/ATAPI(0,0,0)/HD(3,5d1,ca3,0000000000000000,20,0)/EndEntire

grub fails to find device for this path because it cannot scan partition
table. The simplest fix is to add part_apple by default.
2014-01-12 15:29:21 +04:00
Andrey Borzenkov
e7cfa8d5e1 Change grub-mkrescue to use bootaa64.efi too
Also add ChangeLog entry for previous change.
2014-01-07 20:34:25 +04:00
Andrey Borzenkov
c9e839e2ca use {grub,boot}aa64.efi for boot images on AArch64
According to UEFI 2.4 specification, default boot file name on AArch64
is BOOTAA64.EFI (3.4.1.1 Removable Media Boot Behavior). Also set default
GRUB image name to grubaa64.efi to match it.
2014-01-07 10:38:54 +04:00
Andrey Borzenkov
46f8d358ef * util/grub-probe.c: Improve help message and simplify list handling. 2013-12-24 20:30:16 +01:00
Vladimir Serbinenko
faf4a65e1e Revert grub-file usage in grub-mkconfig. 2013-12-24 17:47:27 +01:00
Andrey Borzenkov
569766e49b * util/grub.d/00_header.in: Improve compatibility with old config. 2013-12-24 17:26:05 +01:00
Vladimir Serbinenko
e88f0420b9 Make grub_util_devmapper_part_to_disk and grub_util_find_partition_start
follow the same algorithm to avoid method mismatch. Don't assume
	DMRAID- UUID to mean full disk but instead check that mapping is linear.
2013-12-24 14:16:57 +01:00
Vladimir Serbinenko
808e97c4e7 ARM64 support for grub-mkrescue. 2013-12-23 18:17:09 +01:00
Vladimir Serbinenko
e388db904c Install modinfo.sh to keep build information around. 2013-12-23 18:17:09 +01:00
Vladimir Serbinenko
a4d610026f ARM64 grub-file and grub-mkconfig support. 2013-12-23 18:17:09 +01:00
Andrey Borzenkov
77ec462a56 grub-mkconfig: fix Xen platform conditions 2013-12-22 23:47:26 +04:00
Andrey Borzenkov
3bf2db8959 split grub-mkresecue help text to facilitate translations
Split single string in help message into several strings used before in shell
grub-mkrescue to minimize changes to existing translations.

Reported by Benno Schulenberg
2013-12-22 22:51:54 +04:00
Lars Wendler
3deedfc033 * util/grub-mkconfig.in: Skip non-executable files. 2013-12-22 16:38:28 +01:00
Vladimir Serbinenko
ca3e20886e Build fixes for argp.h with older gcc. 2013-12-21 18:08:25 +01:00
Vladimir Serbinenko
27db1a9b64 * util/grub-glue-efi.c: Use "universal binary" rather "fat binary"
in strings.

	Suggested by: David Prévot.
2013-12-21 16:12:24 +01:00
Vladimir Serbinenko
ae558c2ccf Enable -Wformat=2 if it's supported. 2013-12-21 15:28:28 +01:00
Vladimir Serbinenko
74763e9615 * util/misc.c (grub_util_get_image_size): Check for overflow. 2013-12-21 14:28:14 +01:00
Vladimir Serbinenko
62ce03cf40 * util/import_gcry.py: Skip sample keys. 2013-12-21 14:07:42 +01:00
Vladimir Serbinenko
f4d70fd02b * util/misc.c (grub_qsort_strcmp): Don't discard const attribute. 2013-12-21 14:04:50 +01:00
Vladimir Serbinenko
579ee114b1 Add missing static qualifiers. 2013-12-21 13:50:13 +01:00