[New-bugs-announce] [issue34402] [SOLUTION] strftime fails on HP-UX

Michael Osipov report at bugs.python.org
Tue Aug 14 08:36:57 EDT 2018

New submission from Michael Osipov <1983-01-06 at gmx.net>:

strftime() fails on HP-UX. It is mapped to wcsftime(3). It has a quirk on HP-UX that is does not conform to POSIX. To enable POSIX compat one has to do (excerpt from manpage):
>       The "Unix Standards Only" prototype of wcsftime() is available to
>       applications if they are:
>            a. c99 conformant.
>            b. Compiled with -D_XOPEN_SOURCE macro with a value >=500.
>            c. Compiled with -D_POSIX_C_SOURCE macro with a value >= 200112.
>       Also the application must be compiled with the environment variable
>       UNIX_STD set to the value 98 or above and exported.

b and c are satasfied according to config.log. Let's get to a). The manpage of aCC says:
>     Environment Variables
>       [...]
>       UNIX95 or UNIX_STD specify the XPG4 behavior for c89(1) and c99(1).
>       -D_XOPEN_UNIX is also set.  UNIX_STD must be set to 1995, 1998 or
>       2003.  Both these variables cause an appropriate object file to be
>       linked into executables in order to customize libc to match ISO/IEC
>       9899:1990/Amendment 1:1995 (1995) and the C++ and C99 Standards for
>       the various wide char (1998) or other C99 libc functions (2003).
>       NOTE: 2003 is only available on HP-UX 11.31.

So one must at least do "export UNIX_STD=1998".

I am quite certain that other parts of Python are affected too.

The safest bet would be actually to test wcsftime at configure time wether the output is fine and have this env var set in the Makefile, unfortunately, this will only work for GNU make. Alternatively, a warning at the very end of the configure run has to be printed to export this env var.

If done, test_strftime and test_teststrptime will pass flawlessly.

components: Library (Lib)
messages: 323512
nosy: michael-o
priority: normal
severity: normal
status: open
title: [SOLUTION] strftime fails on HP-UX
type: crash
versions: Python 3.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list