Package: make
Version: 3.81-8.2
Severity: important

Dear Maintainer,
*** Please consider answering these questions, where appropriate ***

   * What led up to the situation?
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
   * What was the outcome of this action?
   * What outcome did you expect instead?

*** End of the template - remove these lines ***

Given the following Makefile:

===
default:        foo?=bar
        foo?=baz
default:        .echo_foo

.echo_%:
        @echo level 1: $($*)
        @$(MAKE) echo_$*

echo_%:
        @echo level 2: $($*)
===

% make
level 1: bar
make[1]: Entering directory `/usr/src/make/test'
level 2: baz
make[1]: Leaving directory `/usr/src/make/test'

However, setting a variable from the environment produces some problems:
% make foo=biff
level 1:
make[1]: Entering directory `/usr/src/make/test'
level 2: P??
make[1]: Leaving directory `/usr/src/make/test'


The output is not consistent and changes with each invocation which felt like a 
memory
allocation problem. I built the source from the 3.81 package as well as the 3.82
experimental package and ran it under valgrind:

valgrind ../make-dfsg-3.82/make foo=biff
==10660== Memcheck, a memory error detector
==10660== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==10660== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==10660== Command: ../make-dfsg-3.82/make foo=biff
==10660== 
==10660== Invalid read of size 1
==10660==    at 0x4C29502: __GI_strlen (mc_replace_strmem.c:391)
==10660==    by 0x50B6905: strdup (strdup.c:42)
==10660==    by 0x412C18: xstrdup (misc.c:413)
==10660==    by 0x416A98: eval (read.c:1818)
==10660==    by 0x417389: eval_makefile (read.c:423)
==10660==    by 0x41772B: read_all_makefiles (read.c:257)
==10660==    by 0x4035B3: main (main.c:1659)
==10660==  Address 0x55f1780 is 0 bytes inside a block of size 5 free'd
==10660==    at 0x4C27D4E: free (vg_replace_malloc.c:427)
==10660==    by 0x416A8F: eval (read.c:1817)
==10660==    by 0x417389: eval_makefile (read.c:423)
==10660==    by 0x41772B: read_all_makefiles (read.c:257)
==10660==    by 0x4035B3: main (main.c:1659)
==10660== 
==10660== Invalid read of size 1
==10660==    at 0x4C29514: __GI_strlen (mc_replace_strmem.c:391)
==10660==    by 0x50B6905: strdup (strdup.c:42)
==10660==    by 0x412C18: xstrdup (misc.c:413)
==10660==    by 0x416A98: eval (read.c:1818)
==10660==    by 0x417389: eval_makefile (read.c:423)
==10660==    by 0x41772B: read_all_makefiles (read.c:257)
==10660==    by 0x4035B3: main (main.c:1659)
==10660==  Address 0x55f1781 is 1 bytes inside a block of size 5 free'd
==10660==    at 0x4C27D4E: free (vg_replace_malloc.c:427)
==10660==    by 0x416A8F: eval (read.c:1817)
==10660==    by 0x417389: eval_makefile (read.c:423)
==10660==    by 0x41772B: read_all_makefiles (read.c:257)
==10660==    by 0x4035B3: main (main.c:1659)
==10660== 
==10660== Invalid read of size 1
==10660==    at 0x4C2A7C1: memcpy (mc_replace_strmem.c:838)
==10660==    by 0x412C18: xstrdup (misc.c:413)
==10660==    by 0x416A98: eval (read.c:1818)
==10660==    by 0x417389: eval_makefile (read.c:423)
==10660==    by 0x41772B: read_all_makefiles (read.c:257)
==10660==    by 0x4035B3: main (main.c:1659)
==10660==  Address 0x55f1784 is 4 bytes inside a block of size 5 free'd
==10660==    at 0x4C27D4E: free (vg_replace_malloc.c:427)
==10660==    by 0x416A8F: eval (read.c:1817)
==10660==    by 0x417389: eval_makefile (read.c:423)
==10660==    by 0x41772B: read_all_makefiles (read.c:257)
==10660==    by 0x4035B3: main (main.c:1659)
==10660== 
level 1: biff
make[1]: Entering directory `/usr/src/make/test'
level 2:
make[1]: Leaving directory `/usr/src/make/test'
==10660== 
==10660== HEAP SUMMARY:
==10660==     in use at exit: 133,721 bytes in 1,071 blocks
==10660==   total heap usage: 1,252 allocs, 181 frees, 281,854 bytes allocated
==10660== 
==10660== LEAK SUMMARY:
==10660==    definitely lost: 0 bytes in 0 blocks
==10660==    indirectly lost: 0 bytes in 0 blocks
==10660==      possibly lost: 0 bytes in 0 blocks
==10660==    still reachable: 133,721 bytes in 1,071 blocks
==10660==         suppressed: 0 bytes in 0 blocks
==10660== Rerun with --leak-check=full to see details of leaked memory
==10660== 
==10660== For counts of detected and suppressed errors, rerun with: -v
==10660== ERROR SUMMARY: 10 errors from 3 contexts (suppressed: 4 from 4)

Note that 3.82 behaves slightly different from 3.81 but the result is still 
incorrect.

Finally, this problem was "solved" by a user that copied a make version 3.81 
binary from
a much older distribution. The difference seems to be that libc changed how 
certain
string functions are implemented. The old libc would effectively inline the 
string
handling code while the newer (Debian) libc defines the various string 
functions in the
shared library.

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing-proposed-updates
  APT policy: (500, 'testing-proposed-updates'), (500, 'testing'), (1, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-xen-amd64 (SMP w/8 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

Versions of packages make depends on:
ii  libc6  2.13-33

make recommends no packages.

Versions of packages make suggests:
pn  make-doc  <none>

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to