Bug 241168 - sysutils/grub2-bhyve fails to build with error: 'gets' undeclared here on CURRENT
Summary: sysutils/grub2-bhyve fails to build with error: 'gets' undeclared here on CUR...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: Peter Grehan
URL: https://github.com/grehan-freebsd/gru...
Keywords: patch, patch-ready
Depends on:
Blocks: 222796
  Show dependency treegraph
 
Reported: 2019-10-10 00:35 UTC by Robert James Hernandez
Modified: 2019-10-17 11:13 UTC (History)
2 users (show)

See Also:
woodsb02: maintainer-feedback+
woodsb02: merge-quarterly+


Attachments
poudriere pkg build log (65.15 KB, text/plain)
2019-10-10 00:35 UTC, Robert James Hernandez
no flags Details
grub2-bhyve patch to comment out warning (1.67 KB, patch)
2019-10-17 02:50 UTC, Robert James Hernandez
woodsb02: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert James Hernandez 2019-10-10 00:35:53 UTC
Created attachment 208217 [details]
poudriere pkg build log

I get the following error during my poudriere build against CURRENT:

mv wchar.h-t wchar.h
rm -f wctype.h-t wctype.h && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
  sed -e 's/@''HAVE_WCTYPE_H''@/1/g' \
      -e 's|@''INCLUDE_NEXT''@|include_next|g' \
      -e 's|@''PRAGMA_SYSTEM_HEADER''@|#pragma GCC system_header|g' \
      -e 's|@''NEXT_WCTYPE_H''@|<wctype.h>|g' \
      -e 's/@''HAVE_ISWBLANK''@/1/g' \
      -e 's/@''HAVE_ISWCNTRL''@/1/g' \
      -e 's/@''HAVE_WINT_T''@/1/g' \
      -e 's/@''REPLACE_ISWBLANK''@/0/g' \
      -e 's/@''REPLACE_ISWCNTRL''@/0/g' \
      -e '/definitions of _GL_FUNCDECL_RPL/r c++defs.h' \
      -e '/definition of _GL_WARN_ON_USE/r warn-on-use.h' \
      < ./wctype.in.h; \
} > wctype.h-t && \
mv wctype.h-t wctype.h
gmake  all-recursive
gmake[4]: Entering directory '/wrkdirs/usr/ports/sysutils/grub2-bhyve/work/grub2-bhyve-0.40/grub-core/gnulib'
gmake[5]: Entering directory '/wrkdirs/usr/ports/sysutils/grub2-bhyve/work/grub2-bhyve-0.40/grub-core/gnulib'
gcc9 -DHAVE_CONFIG_H -I. -I../..  -I../../intl    -MT argp-ba.o -MD -MP -MF .deps/argp-ba.Tpo -c -o argp-ba.o argp-ba.c
mv -f .deps/argp-ba.Tpo .deps/argp-ba.Po
gcc9 -DHAVE_CONFIG_H -I. -I../..  -I../../intl    -MT argp-eexst.o -MD -MP -MF .deps/argp-eexst.Tpo -c -o argp-eexst.o argp-eexst.c
In file included from argp.h:22,
                 from argp-eexst.c:25:
./stdio.h:456:1: error: 'gets' undeclared here (not in a function); did you mean 'getw'?
  456 | _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
      | ^~~~~~~~~~~~~~~
gmake[5]: *** [Makefile:1030: argp-eexst.o] Error 1
gmake[5]: Leaving directory '/wrkdirs/usr/ports/sysutils/grub2-bhyve/work/grub2-bhyve-0.40/grub-core/gnulib'
gmake[4]: *** [Makefile:1050: all-recursive] Error 1
gmake[4]: Leaving directory '/wrkdirs/usr/ports/sysutils/grub2-bhyve/work/grub2-bhyve-0.40/grub-core/gnulib'
gmake[3]: *** [Makefile:915: all] Error 2
gmake[3]: Leaving directory '/wrkdirs/usr/ports/sysutils/grub2-bhyve/work/grub2-bhyve-0.40/grub-core/gnulib'
gmake[2]: *** [Makefile:20160: all-recursive] Error 1
gmake[2]: Leaving directory '/wrkdirs/usr/ports/sysutils/grub2-bhyve/work/grub2-bhyve-0.40'
gmake[1]: *** [Makefile:15992: all] Error 2
gmake[1]: Leaving directory '/wrkdirs/usr/ports/sysutils/grub2-bhyve/work/grub2-bhyve-0.40'
*** Error code 1

Stop.
make: stopped in /usr/ports/sysutils/grub2-bhyve
=>> Cleaning up wrkdir
===>  Cleaning for grub2-bhyve-0.40_7
build of sysutils/grub2-bhyve | grub2-bhyve-0.40_7 ended at Mon Oct  7 04:41:46 UTC 2019
build time: 00:00:57
!!! build failure encountered !!!


Ive attached the entire per-pkg build log for grub2-bhyve. I know theres the error about the jail being too new but its only slightly due to the pace of CURRENT vs AWS ami Im using.

Another thing I noticed is that FreeBSD CURRENT doesnt have grub2-bhyve in the pkg.freebsd.org mirror (as of: 11/09/19): http://pkg.freebsd.org/FreeBSD:13:amd64/latest/All/ (I would suspect its failing it the build there as well?)

If you need any more info or need anything else please let me know!

~Rob
Comment 1 Tobias Kortkamp freebsd_committer 2019-10-10 07:35:09 UTC
> If you need any more info or need anything else please let me know!

grub2-bhyve has no maintainer.  This bug needs a patch.
Comment 2 Walter Schwarzenfeld freebsd_triage 2019-10-10 12:49:56 UTC
Could not find "gets" in  argp-eexst.c. If I am right, I guess it is the warning itself causes this error.

455 #undef gets
    456 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");

and we only need to comment it out.
Comment 3 Walter Schwarzenfeld freebsd_triage 2019-10-10 12:53:29 UTC
Forgot:
in the file grub-core/gnulib/stdio.h.
Comment 4 Robert James Hernandez 2019-10-13 20:21:11 UTC
(In reply to Walter Schwarzenfeld from comment #3)

Thanks Ill try that out and report back.

It looks like this issue has also been raised on the projects github page as well: https://github.com/grehan-freebsd/grub2-bhyve/issues/10
Comment 5 Ben Woods freebsd_committer 2019-10-13 23:07:10 UTC
Hi Peter,
Since you said you would look into this, I’ve set you as the bug assignee. Feel free to change it back if you are no longer pursuing a fix for this.
Thanks,
Ben
Comment 6 Robert James Hernandez 2019-10-17 02:50:31 UTC
Created attachment 208372 [details]
grub2-bhyve patch to comment out warning

Added this patch which now allows the port to build on CURRENT and it appears to be working from my initial testing. Can someone else confirm this is working for them as well? See my results below:

# make build install                                                    
===>   NOTICE:                                                                                                      
                                                                                                                    
The grub2-bhyve port currently does not have a maintainer. As a result, it is                                       
more likely to have unresolved issues, not be up-to-date, or even be removed in                                     
the future. To volunteer to maintain this port, please create an issue at:                                          
                                                                                                                    
https://bugs.freebsd.org/bugzilla                                                                                                                                                                                                       
                                                                                                                    
More information about port maintainership is available at:                                                         
                                                                                                                    
https://www.freebsd.org/doc/en/articles/contributing/ports-contributing.html#maintain-port                                                                                                                                              
                                                                                                                    
===>  License GPLv3 accepted by the user                                                                            
===>   grub2-bhyve-0.40_7 depends on file: /usr/local/sbin/pkg - found                                              
===> Fetching all distfiles required by grub2-bhyve-0.40_7 for building                                             
===>  Extracting for grub2-bhyve-0.40_7                                                                             
=> SHA256 Checksum OK for grehan-freebsd-grub2-bhyve-v0.40_GH0.tar.gz.                                              
===>  Patching for grub2-bhyve-0.40_7                                                                               
===>  Applying extra patch /usr/ports/sysutils/grub2-bhyve/files/extra-patch-grub-core_gnulib_stdio.in.h                                                                                                                                
===>   grub2-bhyve-0.40_7 depends on file: /usr/local/bin/flex - found
===>   grub2-bhyve-0.40_7 depends on executable: help2man - found                                                   
===>   grub2-bhyve-0.40_7 depends on executable: bison - found                                                                                                                                                                          
===>   grub2-bhyve-0.40_7 depends on executable: gmake - found                                                      
===>   grub2-bhyve-0.40_7 depends on executable: gcc9 - found
===>   grub2-bhyve-0.40_7 depends on file: /usr/local/bin/as - found
...

# grub-bhyve --help
Usage: grub-bhyve [OPTION...] vmname
grub-bhyve boot loader.

  -c, --cons-dev=cons-dev    a tty(4) device to use for terminal I/O
  -d, --directory=DIR        use GRUB files in the directory DIR
                             [default=/boot/grub]
  -e, --evga                 exclude VGA rows/cols from bootinfo
  -g, --grub-cfg=CFG         alternative name of grub.cfg
  -H, --hold[=SECS]          wait until a debugger will attach
  -m, --device-map=FILE      use FILE as the device map
                             [default=/boot/grub/device.map]
  -M, --memory=MBYTES        guest RAM in MB [default=256]
  -n, --ncons                disable insertion of console=ttys0
  -r, --root=DEVICE_NAME     Set root device.
  -v, --verbose              print verbose messages.
  -S                         Force wiring of guest memory.
  -?, --help                 give this help list
      --usage                give a short usage message
  -V, --version              print program version

Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.

Report bugs to <freebsd-virtualization@freebsd.org>.
Comment 7 commit-hook freebsd_committer 2019-10-17 10:39:49 UTC
A commit references this bug:

Author: woodsb02
Date: Thu Oct 17 10:39:02 UTC 2019
New revision: 514655
URL: https://svnweb.freebsd.org/changeset/ports/514655

Log:
  sysutils/grub2-bhyve: fix build on 13-CURRENT

  Build error: ./stdio.h:456:1: error: 'gets' undeclared here (not in a
               function); did you mean 'getw'?

  grub2 doesn't use gets() at all so it's just an error in the glib header
  file as a result of gets being excised from FreeBSD. Commenting out the
  _GL_WARN_ON_USE macro for that is fine.

  PR:		241168
  Submitted by:	Robert James Hernandez <rob@sarcasticadmin.com>
  Approved by:	grehan (maintainer)
  MFH:		2019Q4

Changes:
  head/sysutils/grub2-bhyve/files/
  head/sysutils/grub2-bhyve/files/patch-grub-core_gnulib_stdio.in.h
Comment 8 commit-hook freebsd_committer 2019-10-17 11:13:53 UTC
A commit references this bug:

Author: woodsb02
Date: Thu Oct 17 11:12:55 UTC 2019
New revision: 514657
URL: https://svnweb.freebsd.org/changeset/ports/514657

Log:
  MFH: r514655

  sysutils/grub2-bhyve: fix build on 13-CURRENT

  Build error: ./stdio.h:456:1: error: 'gets' undeclared here (not in a
               function); did you mean 'getw'?

  grub2 doesn't use gets() at all so it's just an error in the glib header
  file as a result of gets being excised from FreeBSD. Commenting out the
  _GL_WARN_ON_USE macro for that is fine.

  PR:		241168
  Submitted by:	Robert James Hernandez <rob@sarcasticadmin.com>
  Approved by:	grehan (maintainer)

  Approved by:	ports-secteam (joneum)

Changes:
_U  branches/2019Q4/
  branches/2019Q4/sysutils/grub2-bhyve/files/
Comment 9 Ben Woods freebsd_committer 2019-10-17 11:13:59 UTC
Committed to ports head and quarterly branches - thanks!