[PATCH] Improve “missing separator” error when reading spaces

2016-11-19 Thread Michael Stapelberg
With this change, users who have their editor misconfigured when writing
Makefiles without using 8 spaces for one TAB character will also get a
friendly error message.

I used the following 3 test cases:

  echo -e "foo:\n  echo bar" > broken.make
  echo -e "foo:\necho bar" > broken.8.make
  echo -e "foo:\n--echo bar" > broken.else.make

Before this commit, running make on these files results in:

  $ make -f broken.make
  broken.make:2: *** missing separator.  Stop.

  $ make -f broken.8.make
  broken.8.make:2: *** missing separator (did you mean TAB instead of 8 
spaces?).  Stop.

  $ make -f broken.else.make
  broken.else.make:2: *** missing separator.  Stop.

After this commit, running make on these files results in:

  $ /tmp/make/make -f broken.make
  broken.make:2: *** missing separator (expected TAB, found SPACE).  Stop.

  $ /tmp/make/make -f broken.8.make
  broken.8.make:2: *** missing separator (did you mean TAB instead of 8 
spaces?).  Stop.

  $ /tmp/make/make -f broken.else.make
  broken.else.make:2: *** missing separator.  Stop.
---
 read.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/read.c b/read.c
index b870aa8..3c67e55 100644
--- a/read.c
+++ b/read.c
@@ -1122,6 +1122,8 @@ eval (struct ebuffer *ebuf, int set_default)
one of the most common bugs found in makefiles...  */
 if (cmd_prefix == '\t' && strneq (line, "", 8))
   O (fatal, fstart, _("missing separator (did you mean TAB instead 
of 8 spaces?)"));
+else if (cmd_prefix == '\t' && strneq (line, " ", 1))
+  O (fatal, fstart, _("missing separator (expected TAB, found 
SPACE)"));
 else
   O (fatal, fstart, _("missing separator"));
   }
-- 
2.9.3


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


[PATCH] Improve “missing separator” error when reading spaces

2016-11-19 Thread Michael Stapelberg
With this change, users who have their editor misconfigured when writing
Makefiles without using 8 spaces for one TAB character will also get a
friendly error message.

I used the following 3 test cases:

  echo -e "foo:\n  echo bar" > broken.make
  echo -e "foo:\necho bar" > broken.8.make
  echo -e "foo:\n--echo bar" > broken.else.make

Before this commit, running make on these files results in:

  $ make -f broken.make
  broken.make:2: *** missing separator.  Stop.

  $ make -f broken.8.make
  broken.8.make:2: *** missing separator (did you mean TAB instead of 8 
spaces?).  Stop.

  $ make -f broken.else.make
  broken.else.make:2: *** missing separator.  Stop.

After this commit, running make on these files results in:

  $ /tmp/make/make -f broken.make
  broken.make:2: *** missing separator (expected TAB, found SPACE).  Stop.

  $ /tmp/make/make -f broken.8.make
  broken.8.make:2: *** missing separator (did you mean TAB instead of 8 
spaces?).  Stop.

  $ /tmp/make/make -f broken.else.make
  broken.else.make:2: *** missing separator.  Stop.
---
 read.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/read.c b/read.c
index b870aa8..3c67e55 100644
--- a/read.c
+++ b/read.c
@@ -1122,6 +1122,8 @@ eval (struct ebuffer *ebuf, int set_default)
one of the most common bugs found in makefiles...  */
 if (cmd_prefix == '\t' && strneq (line, "", 8))
   O (fatal, fstart, _("missing separator (did you mean TAB instead 
of 8 spaces?)"));
+else if (cmd_prefix == '\t' && strneq (line, " ", 1))
+  O (fatal, fstart, _("missing separator (expected TAB, found 
SPACE)"));
 else
   O (fatal, fstart, _("missing separator"));
   }
-- 
2.9.3


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


Re: INTERNAL: Exiting with 2 jobserver tokens available; should be 5!

2016-11-19 Thread Jaak Ristioja
Hi!

On 13.11.2016 07:37, Tim Murphy wrote:
> Something like Valgrind might spot some initial problem that doesn't
> immediately crash but eventually spirals out of control.

I could try valgrind, but (1) I will need to recompile glibc with debug
symbols to use it, and (2) I don't have an eternity to wait for
--trace-children to finish, so I'd have to run it without
--trace-children because afaik valgrind doesn't provide good means to
trace only certain children (i.e. only "make" processes). Actually the
RPi2 would probably OOM/die from multiple valgrind processes anyway.

> I don't know what the gcc version is on your Pi but if you have a recent
> enough one  you might manage to use the address sanitiser option to get
> a similar result.

I'm currently using GCC 5.4, so its fairly new from that aspect, but I
won't be able to use its address sanitizer, because it doesn't work with
a PaX/grsecurity kernel like Gentoo's sys-devel/hardened-sources, due to
"ASAN assumes/uses hardcoded userland address space size values, which
breaks when UDEREF is set as it pitches a bit from the size" [1].
Because of this, it is disabled by default on hardened profiles, hence
I'd have to both recompile GCC and a kernel without PaX/grsec to

So I guess I'll attempt to recompile glibc and run valgrind on the
parent "make -j5" process and see whether that turns up anything. If
not, then I'll try the -fsanitize=address approach. I expect all of this
to take some time (and perhaps wear out more flash storage) on the slow
RPi2.

Best regards,
J


[1] http://blog.siphos.be/2013/04/another-gentoo-hardened-month-has-passed/

___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


Re: INTERNAL: Exiting with 2 jobserver tokens available; should be 5!

2016-11-19 Thread Paul Smith
On Sun, 2016-11-20 at 00:03 +0200, Jaak Ristioja wrote:
> So I guess I'll attempt to recompile glibc and run valgrind on the
> parent "make -j5" process and see whether that turns up anything. If
> not, then I'll try the -fsanitize=address approach. I expect all of this
> to take some time (and perhaps wear out more flash storage) on the slow
> RPi2.

Of course another option is the old standby: add printf calls etc. to
the code to try to figure out what's going on.

___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


Re: INTERNAL: Exiting with 2 jobserver tokens available; should be 5!

2016-11-19 Thread Tim Murphy
Hi, sounds like a tough situation and printfs() might be the easiest but I
thought I might suggest one other complicated idea :-). Surely someone has
put together a cross-compiler for this os/hw combination? the idea of
compiling on-device would certainly have been impossibly slow until fairly
recent times.

Regards,

Tim

On 19 November 2016 at 22:03, Jaak Ristioja  wrote:

> Hi!
>
> On 13.11.2016 07:37, Tim Murphy wrote:
> > Something like Valgrind might spot some initial problem that doesn't
> > immediately crash but eventually spirals out of control.
>
> I could try valgrind, but (1) I will need to recompile glibc with debug
> symbols to use it, and (2) I don't have an eternity to wait for
> --trace-children to finish, so I'd have to run it without
> --trace-children because afaik valgrind doesn't provide good means to
> trace only certain children (i.e. only "make" processes). Actually the
> RPi2 would probably OOM/die from multiple valgrind processes anyway.
>
> > I don't know what the gcc version is on your Pi but if you have a recent
> > enough one  you might manage to use the address sanitiser option to get
> > a similar result.
>
> I'm currently using GCC 5.4, so its fairly new from that aspect, but I
> won't be able to use its address sanitizer, because it doesn't work with
> a PaX/grsecurity kernel like Gentoo's sys-devel/hardened-sources, due to
> "ASAN assumes/uses hardcoded userland address space size values, which
> breaks when UDEREF is set as it pitches a bit from the size" [1].
> Because of this, it is disabled by default on hardened profiles, hence
> I'd have to both recompile GCC and a kernel without PaX/grsec to
>
> So I guess I'll attempt to recompile glibc and run valgrind on the
> parent "make -j5" process and see whether that turns up anything. If
> not, then I'll try the -fsanitize=address approach. I expect all of this
> to take some time (and perhaps wear out more flash storage) on the slow
> RPi2.
>
> Best regards,
> J
>
>
> [1] http://blog.siphos.be/2013/04/another-gentoo-hardened-month-
> has-passed/
>
> ___
> Bug-make mailing list
> Bug-make@gnu.org
> https://lists.gnu.org/mailman/listinfo/bug-make
>
___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make