From 3cfe27cffe4edb9ca08624df6ab667d512f1ed0e Mon Sep 17 00:00:00 2001 From: Ani Sinha Date: Sun, 29 May 2022 22:21:20 +0530 Subject: [PATCH 1/3] compat: fix bug around indentation Indentation for an if condition was incorrect. Hence upon hitting the error conditional, the code was not returning the error the value. Fixed in this change by adding braces with the if conditional. This error was found when compiling with a newer version of gcc 9.4.0 on ubuntu 20.04.2. Signed-off-by: Ani Sinha --- rc/python/compat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rc/python/compat.c b/rc/python/compat.c index 6e2ea47..226c616 100644 --- a/rc/python/compat.c +++ b/rc/python/compat.c @@ -417,10 +417,10 @@ off_t lseek(int fd, off_t offset, int whence) { grub_file_t file; - if (fd >= 0 && fd < 3) + if (fd >= 0 && fd < 3) { grub_printf("Internal error: Python attempted to seek on stdin, stdout, or stderr.\n"); return (off_t)-1; - + } file = fd_to_file(fd); if (!file) return (off_t)-1; From 08dd543dd684e238b8a25d6a17cd46ff4aebbbb7 Mon Sep 17 00:00:00 2001 From: Ani Sinha Date: Tue, 31 May 2022 11:23:18 +0530 Subject: [PATCH 2/3] python: do not error out on incompatible function pointer casts In many cases, the callback function pointers in PyMethodDef definitions are cast to PyCFunction type where as their actual signature matches that of PyCFunctionWithKeywords type. This issue exists throughout in python 2.7 codebase in general. On newer compilers, this produces a compile time failure like the following: build/grub/grub-core/contrib/python/bitsmodule.c:558:16: error: cast between incompatible function types from 'PyObject * (*)(PyObject *, PyObject *, PyObject *)' {aka 'struct _object * (*)(struct _object *, struct _object *, struct _object *)'} to 'PyObject * (*)(PyObject *, PyObject *)' {aka 'struct _object * (*)(struct _object *, struct _object *)'} [-Werror=cast-function-type] 558 | {"get_xy", (PyCFunction)bits_get_xy, METH_KEYWORDS, "get_xy(term) -> (cursor_x, cursor_y)"}, Pass -Wno-cast-function-type in compiler cflags in order to suppress this failure. Signed-off-by: Ani Sinha --- rc/python/Makefile.core.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/python/Makefile.core.def b/rc/python/Makefile.core.def index 350d7b5..faed082 100644 --- a/rc/python/Makefile.core.def +++ b/rc/python/Makefile.core.def @@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. module = { name = python; cppflags = '-I$(top_srcdir)/contrib/python -I$(srcdir)/contrib-deps/python/Include -D_IEEE_LIBM -D__LITTLE_ENDIAN= -I$(srcdir)/contrib-deps/fdlibm $(CONTRIB_CPPFLAGS) -include contrib/acpica/acenv.h -DGRUB2 -DACPI_LIBRARY -I$(top_srcdir)/contrib/acpica -I$(srcdir)/contrib-deps/acpica/source/include -U__ELF__ -I$(srcdir)/contrib-deps/libffi/include -I$(srcdir)/contrib-deps/libffi/src/x86 -I$(srcdir)/contrib-deps/python/Modules/zlib'; - cflags = '$(CONTRIB_CFLAGS) -fshort-wchar -maccumulate-outgoing-args -Wno-empty-body -Wno-float-equal -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-missing-declarations -Wno-missing-format-attribute -Wno-missing-noreturn -Wno-missing-prototypes -Wno-nested-externs -Wno-old-style-definition -Wno-parentheses -Wno-redundant-decls -Wno-sign-compare -Wno-shadow -Wno-shift-negative-value -Wno-type-limits -Wno-undef -Wno-uninitialized -Wno-unused -Wno-unused-parameter -Wno-unused-value -Wno-unused-variable -Wno-write-strings'; + cflags = '$(CONTRIB_CFLAGS) -fshort-wchar -Wno-cast-function-type -maccumulate-outgoing-args -Wno-empty-body -Wno-float-equal -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-missing-declarations -Wno-missing-format-attribute -Wno-missing-noreturn -Wno-missing-prototypes -Wno-nested-externs -Wno-old-style-definition -Wno-parentheses -Wno-redundant-decls -Wno-sign-compare -Wno-shadow -Wno-shift-negative-value -Wno-type-limits -Wno-undef -Wno-uninitialized -Wno-unused -Wno-unused-parameter -Wno-unused-value -Wno-unused-variable -Wno-write-strings'; enable = i386_pc; enable = i386_efi; enable = x86_64_efi; From a2ef6593aaff7dfbf478688e25cf04703b83e5c8 Mon Sep 17 00:00:00 2001 From: Ani Sinha Date: Sat, 4 Jun 2022 15:35:48 +0530 Subject: [PATCH 3/3] updating submodule heads to point to my own fork All the bits specific submodules have been forked and this commit updates the top level bits repo to refer to these forks. Signed-off-by: Ani Sinha --- .gitmodules | 15 ++++++++++----- deps/fdlibm | 2 +- deps/grub | 2 +- deps/libffi | 2 +- deps/python | 2 +- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.gitmodules b/.gitmodules index 4659bda..49f925d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,20 +1,25 @@ [submodule "deps/acpica"] path = deps/acpica - url = ../acpica + url = git@github.com:ani-sinha/bits-acpica.git + branch = bits fetchRecurseSubmodules = true [submodule "deps/fdlibm"] path = deps/fdlibm - url = ../fdlibm + url = git@github.com:ani-sinha/bits-fdlibm.git + branch = bits fetchRecurseSubmodules = true [submodule "deps/grub"] path = deps/grub - url = ../grub + url = git@github.com:ani-sinha/bits-grub.git + branch = bits fetchRecurseSubmodules = true [submodule "deps/libffi"] path = deps/libffi - url = ../libffi + url = git@github.com:ani-sinha/bits-libffi.git + branch = bits fetchRecurseSubmodules = true [submodule "deps/python"] path = deps/python - url = ../python + url = git@github.com:ani-sinha/bits-python.git + branch = bits fetchRecurseSubmodules = true diff --git a/deps/fdlibm b/deps/fdlibm index dfd9eae..ca56e05 160000 --- a/deps/fdlibm +++ b/deps/fdlibm @@ -1 +1 @@ -Subproject commit dfd9eaed985332a1c3af98c2bab4004eea217d3d +Subproject commit ca56e05a3c588204629fc260bdae594863b588d7 diff --git a/deps/grub b/deps/grub index 4b61df1..5513cf5 160000 --- a/deps/grub +++ b/deps/grub @@ -1 +1 @@ -Subproject commit 4b61df16e89c3fcb999fadd0daf543c45688c5d5 +Subproject commit 5513cf56a7e094887e5664ad4313a6a1c45356fc diff --git a/deps/libffi b/deps/libffi index 22602de..dec9c9a 160000 --- a/deps/libffi +++ b/deps/libffi @@ -1 +1 @@ -Subproject commit 22602debdf49048c23da9a7f860ccbaa11cd1579 +Subproject commit dec9c9aa8951025db9ef921f21a3a196b0fff967 diff --git a/deps/python b/deps/python index 2e41220..b323733 160000 --- a/deps/python +++ b/deps/python @@ -1 +1 @@ -Subproject commit 2e41220a584b0d4fcda5c95dc14cf638f9b9a331 +Subproject commit b32373388708126b93dae019bea15de0329ab449