Bug 5033 - configure inserts incorrect define for HPUX
Summary: configure inserts incorrect define for HPUX
Status: RESOLVED WONTFIX
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: nmbd (show other bugs)
Version: 3.0.26a
Hardware: PA-RISC HP-UX
: P3 major
Target Milestone: none
Assignee: Samba Bugzilla Account
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-23 01:35 UTC by Olaf Flebbe
Modified: 2009-08-21 07:03 UTC (History)
0 users

See Also:


Attachments
Small example how samba uses va macros (650 bytes, text/plain)
2007-10-23 01:38 UTC, Olaf Flebbe
no flags Details
small glitch, example corrected (629 bytes, text/plain)
2007-10-23 01:43 UTC, Olaf Flebbe
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olaf Flebbe 2007-10-23 01:35:20 UTC
Hi,

samba doesn't work at all for HPUX in 3.0.26. Version 3.0.24 was o.k.

smbd (32bit) writes binary information into log files, nmbd loops while printing the --help info ...

Root cause is broken varargs handling in snprintf.c which is triggered by the configure skript. It inserts -D__LP64__ into the compiler cflags iff on HPUX 11.11. This define breaks <stdarg.h> severly. (Have a look into the definition of va_arg and you know why ;-)

It is a mystery to me how these five lines made it into configure:
----
               if test "`uname -r`" = "B.11.11"; then
                        { echo "$as_me:$LINENO: WARNING: Enabling HPUX 11.11 header bug workaround" >&5
echo "$as_me: WARNING: Enabling HPUX 11.11 header bug workaround" >&2;}
                        CFLAGS="$CFLAGS -D_LARGEFILE64_SUPPORT -D__LP64__ -DO_LARGEFILE=04000"
                fi
----

They are not in config.in and I found no evidence of these lines in several samba svn branch checkouts. Regenerating configure with autogen.sh did not contain these lines for me.

These lines appeared in the release tar ball of 3.0.25. Please make sure that these lines will be removed from the release tar ball in future versions.

Appended you will find a small example file, demonstrating the varargs handling. Please compile with the HPUX cc and -D__LP64__ and find that it prints incorrect output, compared to the correct output for cc without this define.
Comment 1 Olaf Flebbe 2007-10-23 01:38:11 UTC
Created attachment 2951 [details]
Small example how samba uses va macros

Please compile on HP-UX with cc -D__LP64__ example.c and with cc example.c and compare the output. 

__LP64__ is a compiler intrisic macro which should not be redefined.
Comment 2 Olaf Flebbe 2007-10-23 01:43:52 UTC
Created attachment 2952 [details]
small glitch, example corrected
Comment 3 Olaf Flebbe 2007-10-23 11:06:27 UTC
Ah, I see now it is needed for fixing the pread() desaster in HP-UX. 

Comment 4 Olaf Flebbe 2009-08-21 07:03:25 UTC
O.K. its a while I reported this issue. lets take a step back and forget all the workarounds supposed:

The root problem of all is a wrong prototype in <sys/unistd.h> as of HPUX for PA-RISC (at least)

We found no other solution than to patch the vendor header file:

----
flebbe@hpux sys $ diff unistd.h~ unistd.h
323,324c323,329
<      extern ssize_t pread __((int, void *, size_t, unsigned));
<      extern ssize_t pwrite __((int, const void *, size_t, unsigned));
---
> #ifdef _APP32_64BIT_OFF_T
>      extern ssize_t pread __((int, void *, size_t, off32_t));
>      extern ssize_t pwrite __((int, const void *, size_t, off32_t));
> #else
>      extern ssize_t pread __((int, void *, size_t, off_t));
>      extern ssize_t pwrite __((int, const void *, size_t, off_t));
> #endif

So I change this to CLOSE/WONT_FIX.