Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Feb 2018 07:27:12 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 225946] /usr/bin/make
Message-ID:  <bug-225946-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D225946

            Bug ID: 225946
           Summary: /usr/bin/make
           Product: Base System
           Version: CURRENT
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: itsdavidmarx@gmail.com

/usr/bin/make core dumps with this Makefile for an archive.
Actually the goal is to have the Makefile work without the
foo.o: foo.c entry, as it does with gmake, but for some reason
I think /usr/bin/make realizes it needs to make lib.a(foo.o)=20
but doesn't make it.
For:
% uname -a
FreeBSD metro-6.us.oracle.com 12.0-CURRENT FreeBSD 12.0-CURRENT #10
d26791952(trueos-stable-17.12): Sat Dec  9 18:10:09 UTC 2017=20=20=20=20
root@chimera:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64
% cat foo.c
void
foo (
  void)
{
        }
% cat Makefile
all: lib.a

lib.a: lib.a(foo.o)
        ranlib lib.a

.c.a:
        cc -c foo.c
        ar rv lib.a foo.o
        rm -f foo.o

foo.o: foo.c
        cc -c foo.c

clobber: clean
        rm lib.a

clean:
        rm -f foo.o
% /usr/bin/make
Segmentation fault
% gdb /usr/bin/make
run
% gdb /usr/bin/make
GNU gdb (GDB) 8.0.1 [GDB v8.0.1 for FreeBSD]
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.htm=
l>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd12.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/make...Reading symbols from
/usr/lib/debug//usr/bin/make.debug...done.
done.
(gdb) run
Starting program: /usr/bin/make

Program received signal SIGSEGV, Segmentation fault.
strlen (str=3D0x0) at /usr/src/lib/libc/string/strlen.c:102
102     /usr/src/lib/libc/string/strlen.c: No such file or directory.
(gdb) where
#0  strlen (str=3D0x0) at /usr/src/lib/libc/string/strlen.c:102
#1  0x000000000041aba2 in Var_Set (name=3D<optimized out>, val=3D<optimized=
 out>,
    ctxt=3D0x800cf6ac0, flags=3D0) at /usr/src/contrib/bmake/var.c:973
#2  0x0000000000402090 in Compat_Make (gnp=3D0x800cf6b80, pgnp=3D0x800cf6ac=
0)
    at /usr/src/contrib/bmake/compat.c:657
#3  0x000000000041faf6 in Lst_ForEachFrom (l=3D0x800d700a0, ln=3D0x800d3e1c=
0,
    proc=3D0x401fd0 <Compat_Make>, d=3D0x800cf6ac0)
    at /usr/src/contrib/bmake/lst.lib/lstForEachFrom.c:104
#4  0x0000000000402041 in Compat_Make (gnp=3D0x800cf6ac0, pgnp=3D0x800cf694=
0)
    at /usr/src/contrib/bmake/compat.c:544
#5  0x000000000041faf6 in Lst_ForEachFrom (l=3D0x800d6fdd0, ln=3D0x800d3e16=
0,
    proc=3D0x401fd0 <Compat_Make>, d=3D0x800cf6940)
    at /usr/src/contrib/bmake/lst.lib/lstForEachFrom.c:104
#6  0x0000000000402041 in Compat_Make (gnp=3D0x800cf6940, pgnp=3D0x800cf688=
0)
    at /usr/src/contrib/bmake/compat.c:544
#7  0x000000000041faf6 in Lst_ForEachFrom (l=3D0x800d6fc20, ln=3D0x800d7190=
0,
    proc=3D0x401fd0 <Compat_Make>, d=3D0x800cf6880)
    at /usr/src/contrib/bmake/lst.lib/lstForEachFrom.c:104
#8  0x0000000000402041 in Compat_Make (gnp=3D0x800cf6880, pgnp=3D0x800cf67c=
0)
    at /usr/src/contrib/bmake/compat.c:544
#9  0x000000000041faf6 in Lst_ForEachFrom (l=3D0x800d6fb00, ln=3D0x800d718a=
0,
    proc=3D0x401fd0 <Compat_Make>, d=3D0x800cf67c0)
    at /usr/src/contrib/bmake/lst.lib/lstForEachFrom.c:104
---Type <return> to continue, or q <return> to quit---
#10 0x0000000000402041 in Compat_Make (gnp=3D0x800cf67c0, pgnp=3D0x800cf67c=
0)
    at /usr/src/contrib/bmake/compat.c:544
#11 0x00000000004024e6 in Compat_Run (targs=3D0x800cfa3a0)
    at /usr/src/contrib/bmake/compat.c:761
#12 0x000000000040cce7 in runTargets () at /usr/src/contrib/bmake/main.c:960
#13 main (argc=3D1, argv=3D<optimized out>) at /usr/src/contrib/bmake/main.=
c:1498
(gdb) x/i $rip
=3D> 0x460b7f <strlen+31>:        mov    (%rcx),%rax
(gdb) x/x $rcx
0x0:    Cannot access memory at address 0x0
(gdb)
Appears to be strlen of a null pointer.
Whatever garbage I give make, it should not core dump.
And this does work with gmake.

Thanks.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-225946-8>