]> Savannah Git Hosting - m4.git/commitdiff

Savannah Git Hosting - m4.git/commitdiff

git git@sv / m4.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0b85e79)
build: avoid test failure on HPUX
2013年3月12日 23:23:30 +0000 (17:23 -0600)
2013年9月18日 13:53:33 +0000 (20:53 +0700)
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>

diff --git a/doc/m4.texi b/doc/m4.texi
index f262a7b4aa40c3cf6ea79f7967ac0bd2ed457d42..801f9f94547e8619a05ba85d0b6e6c733379a5a4 100644 (file)
--- 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
GNU M4 source repository
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /