Skip to content

Extra newlines in 'make test' on OS X #183

@noloader

Description

@noloader

From the low-hanging fruit department... OS X builds have an extra newline during make test:

$ make test
...
selftest successful (33 checks).
for x in ./testdata/*.rpl; do echo -n "$x "; if ./testbound -p $x >/dev/null 2>&1; then echo OK; else echo failed; exit 1; fi done
-n ./testdata/acl.rpl 
OK
-n ./testdata/auth_nsec3_ent.rpl 
OK
-n ./testdata/auth_nsec3_wild.rpl 
OK
-n ./testdata/auth_xfr.rpl 
OK
...

According to echo(1) man page on OS X:

     -n    Do not print the trailing newline character.  This may also be
           achieved by appending `\c' to the end of the string, as is done by
           iBCS2 compatible systems.  Note that this option as well as the
           effect of `\c' are implementation-defined in IEEE Std 1003.1-2001
           (``POSIX.1'') as amended by Cor. 1-2002.  Applications aiming for
           maximum portability are strongly encouraged to use printf(1) to
           suppress the newline character.

     Some shells may provide a builtin echo command which is similar or iden-
     tical to this utility.  Most notably, the builtin echo in sh(1) does not
     accept the -n option.  Consult the builtin(1) manual page.

I'm guessing the output is due to the Makefile doing something like SHELL = /bin/sh. The GNU Coding Standards manual says to do it, so it should be fairly common. On OS X you get a lame, non-Bash shell for /bin/sh. -n is not recognized so it gets output as shown in the self tests.

Changing this in Makefile.in:

for x in $(srcdir)/testdata/*.rpl; do echo -n "$$x ";

to this:

for x in $(srcdir)/testdata/*.rpl; do printf "%s" "$$x ";

works as expected on OS X, DragonFly 5.6, OpenBSD 12.1, FreeBSD 12.1. It should also work on Solaris.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions