bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] flock is not available on solaris 10 (at least sparc)


From: Tim Rühsen
Subject: Re: [Bug-wget] flock is not available on solaris 10 (at least sparc)
Date: Wed, 16 Dec 2015 21:01:39 +0100
User-agent: KMail/4.14.10 (Linux/4.3.0-1-amd64; KDE/4.14.14; x86_64; ; )

Am Mittwoch, 16. Dezember 2015, 12:13:46 schrieb Giuseppe Scrivano:
> Tim Ruehsen <address@hidden> writes:
> > On Wednesday 16 December 2015 10:31:33 Giuseppe Scrivano wrote:
> >> Tim Ruehsen <address@hidden> writes:
> >> > On Tuesday 15 December 2015 21:55:53 Kiyoshi KANAZAWA wrote:
> >> >> 2. about #error "Compiler or options invalid for pre-UNIX 03 X/Open
> >> >> applications" This error may depends on compilers.
> >> >> Both of  "solarisstudio12.4"  &  "gcc-4.8.5" can build wget-1.17.1
> >> >> without
> >> >> errors.
> >> >> 
> >> >> But I once experienced the similar problem when trying to compile
> >> >> "sam2p-0.49.2". At that time, gcc-4.4.7 passed, but gcc-4.8.* stopped
> >> >> with
> >> >> this error and I had to set "-D_XPG6" as optional cc flags.
> >> >> 
> >> >> ./configure of wget checks compiler to accept ISO C89, such as
> >> >> "checking for gcc -O3 option to accept ISO C89... none needed".
> >> >> If "-std=c89" is required for some versions of gcc, shouldn't it set
> >> >> in
> >> >> configure ?
> >> > 
> >> > You could try to insert AC_PROG_CC_C89 after AC_PROG_CC. AFAIK, it will
> >> > add - std=c89 but only if needed (if the compiler does not support C89
> >> > without it).
> >> > 
> >> > autoreconf && ./configure && make clean && make
> >> > to see if the problem still occurs.
> >> > 
> >> > Setting CFLAGS directly in configure.ac is not recommended, AFAIK.
> >> > Maybe
> >> > just a set of compilers understands -std=c89 !? Also, setting -std=c89
> >> > might be helpful or not, depending of the compiler and version. Nobody
> >> > is
> >> > going to waste time working on such a list/table.
> >> > 
> >> > Maybe we should ask the gnulib people, why flock() isn't emulated on
> >> > Solaris when -std=c89 is missing !? I could simply be a bug...
> >> 
> >> the gnulib documentation for flock says:
> >>   Portability problems not fixed by Gnulib:
> >>     This function is missing on some platforms:
> >>     AIX 5.1, HP-UX 11.23, Solaris 11 2011-11, BeOS.
> >> 
> >> This can either be because nobody cared before, or because there is no
> >> way to emulate it on these platforms.
> >> 
> >> Couldn't we replace the flock part with a write to a tmp file+atomic
> >> rename?  In the remote case of two wget processes trying to write the
> >> same file, at least we won't get garbage there.  What do you think?
> > 
> > There is no atomic rename for all OSes, AFAIK.
> > 
> > How about using fcntl() for locking ? The gnulib emulation might be better
> > and it is a POSIX function.
> 
> it will break on mingw :(
> 
> fcntl:
> 
>   Portability problems not fixed by Gnulib:
>     The replacement function does not support F_SETFD,
>       F_GETFL, F_SETFL, F_GETOWN, F_SETOWN,
>       F_GETLK, F_SETLK, and F_SETLKW on some platforms:
>       mingw, MSVC 9.
> 
> but we can perhaps use this when flock is not available.

Sounds like doing gnulib's job !?

If flock() is not available, gnulib throws in it's flock() emulation. They 
already check for flock and fcntl being available. Not sure, what problem 
exists on Solaris 11 - there should be a working fcntl available.

Is the gnulib documentation up-to-date ?

But back to 0... the flock failure has been addressed by adding it to 
boostrap.conf.

What Christian and I experience is this (just got it on OpenCSW Solaris 11):

/opt/csw/lib/gcc/i386-pc-solaris2.10/5.2.0/include-
fixed/sys/feature_tests.h:346:2: error: #error "Compiler or options invalid 
for pre-UNIX 03 X/Open applications       and pre-2001 POSIX applications"
 #error "Compiler or options invalid for pre-UNIX 03 X/Open applications \
  ^
In file included from   :12:0,
                 from ../lib/sys/types.h:28,
                 from sysdep.h:85,
                 from wget.h:47,
                 from ftp-ls.c:32:


>From feature_test.h:
/*
 * It is invalid to compile an XPG3, XPG4, XPG4v2, or XPG5 application
 * using c99.  The same is true for POSIX.1-1990, POSIX.2-1992, POSIX.1b,
 * and POSIX.1c applications. Likewise, it is invalid to compile an XPG6
 * or a POSIX.1-2001 application with anything other than a c99 or later
 * compiler.  Therefore, we force an error in both cases.
 */
#if defined(_STDC_C99) && (defined(__XOPEN_OR_POSIX) && !defined(_XPG6))
#error "Compiler or options invalid for pre-UNIX 03 X/Open applications \
        and pre-2001 POSIX applications"
#elif !defined(_STDC_C99) && \
        (defined(__XOPEN_OR_POSIX) && defined(_XPG6))
#error "Compiler or options invalid; UNIX 03 and POSIX.1-2001 applications \
        require the use of c99"
#endif


Seems pretty clear - gcc 5 has C99 as default standard (and Solaris has gcc 
5.2).
But we explicitely define _XOPEN_SOURCE 500 in src/sysdep.h, which says we 
want 'X/Open 5, POSIX 1995' functions and nothing newer.
Solaris headers just make some checks to ensure proper definitions here and 
they fail.

When I simply remove the define, everything compiles ok.
The question is if we still want what the comment says: "/* Request the "Unix 
98 compilation environment". */". I think, we should allow Wget to be compiled 
on newer environments as well.

WDYT ?

Tim

> gcc -v
Reading specs from /opt/csw/lib/gcc/i386-pc-solaris2.10/5.2.0/specs
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/csw/libexec/gcc/i386-pc-solaris2.10/5.2.0/lto-wrapper
Target: i386-pc-solaris2.10
Configured with: /home/dam/mgar/pkg/gcc5/trunk/work/solaris10-i386/build-isa-
pentium_pro/gcc-5.2.0/configure --prefix=/opt/csw --exec_prefix=/opt/csw --
bindir=/opt/csw/bin --sbindir=/opt/csw/sbin --libexecdir=/opt/csw/libexec --
datadir=/opt/csw/share --sysconfdir=/etc/opt/csw --
sharedstatedir=/opt/csw/share --localstatedir=/var/opt/csw --
libdir=/opt/csw/lib --infodir=/opt/csw/share/info --
includedir=/opt/csw/include --mandir=/opt/csw/share/man --enable-cloog-
backend=isl --enable-java-awt=xlib --enable-
languages=ada,c,c++,fortran,go,java,objc --enable-libada --enable-libssp --
enable-nls --enable-objc-gc --enable-threads=posix --program-suffix=-5.2 --
with-cloog=/opt/csw --with-gmp=/opt/csw --with-included-gettext --with-
ld=/usr/ccs/bin/ld --without-gnu-ld --with-libiconv-prefix=/opt/csw --with-
mpfr=/opt/csw --with-ppl=/opt/csw --with-system-zlib=/opt/csw --with-gnu-as --
with-as=/opt/csw/bin/gas
Thread model: posix
gcc version 5.2.0 (GCC)


 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]