diff options
author | Eric Blake <eblake@redhat.com> | 2013-03-12 17:23:30 -0600 |
---|---|---|
committer | Gary V. Vaughan <gary@gnu.org> | 2013-09-18 20:53:33 +0700 |
commit | 7044c45b704482ee62d1edf3a2f3dc81c6115d60 (patch) | |
tree | eb88fc1e4477423b1adcee29c458c9c39d469ca5 | |
parent | 0b85e7900bcb0fda336c7516f76ad205fbd1d864 (diff) | |
download | m4-7044c45b704482ee62d1edf3a2f3dc81c6115d60.tar.gz |
build: avoid test failure on HPUX
POSIX permits implementations to open fd 0, 1, and 2 on exec(), even
when the user tried to close them. HPUX-11.23 is one of the
implementations that does not allow closed standard descriptors,
leading to a failure of test 005.command_li. But a test that makes
sure we behave gracefully in the face of closed standard descriptors
makes no sense on a platform where we can never have them closed, so
add some code to skip the test on "helpful" platforms.
Note - HPUX opens any closed standard descriptor as O_WRONLY on
/dev/null. This means that attempts to close stdout generally
result in silent success, but attempts to close stdin often still
result in failure when it is not possible to read from the O_WRONLY
stdin.
* doc/m4.texi (Command line files): Skip tests on systems where it
is impossible to start with stdin/out closed.
Reported by Gary V. Vaughan.
Signed-off-by: Eric Blake <eblake@redhat.com>
-rw-r--r-- | doc/m4.texi | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/doc/m4.texi b/doc/m4.texi index f262a7b4..801f9f94 100644 --- a/doc/m4.texi +++ b/doc/m4.texi @@ -1129,6 +1129,70 @@ If you need to read a file whose name starts with a @file{-}, you can specify it as @samp{./-file}, or use @option{--} to mark the end of options. +@ignore +@comment Test that 'm4 file/' detects that file is not a directory; we +@comment can assume that the current directory contains a Makefile. +@comment mingw fails with EINVAL rather than ENOTDIR. + +@comment status: 1 +@comment xerr: ignore +@comment options: Makefile/ +@example +@error{}m4: cannot open file 'Makefile/': No such file or directory +@end example + +@comment Test that closed stderr does not cause a crash. Not all +@comment systems have the same message for EBADF. + +@comment xerr: ignore +@example +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl +syscmd(`echo | cat >&- 2>/dev/null')ifelse(sysval, `0', + `errprint(` skipping: system does not allow closing stdout +')m4exit(`77')')dnl +changequote(`[', `]')dnl +syscmd([echo | ']__program__[' >&-])dnl +@error{}m4: write error: Bad file descriptor +sysval +@result{}1 +@end example + +@example +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl +syscmd(`echo | cat >&- 2>/dev/null')ifelse(sysval, `0', + `errprint(` skipping: system does not allow closing stdout +')m4exit(`77')')dnl +changequote(`[', `]')dnl +syscmd([echo 'esyscmd(echo hi >&2 && echo err"print(bye +)d"nl)dnl' > tmp.m4 \ + && ']__program__[' tmp.m4 <&- >&- \ + && rm tmp.m4])sysval +@error{}hi +@error{}bye +@result{}0 +@end example + +@comment Test that we obey POSIX semantics with -D interspersed with +@comment files, even with POSIXLY_CORRECT (BSD getopt gets it wrong). + +$ @kbd{m4 } +@example +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl +changequote(`[', `]')dnl +syscmd([POSIXLY_CORRECT=1 ']__program__[' -Dbar=hello foo -Dbar=world foo])dnl +@result{}hello +@result{}world +sysval +@result{}0 +@end example +@end ignore + @node Syntax @chapter Lexical and syntactic conventions |