libzip sem fordul

Na de linuxon nem fordul!


In file included from /usr/include/fcntl.h:25:0,
                 from nonrandomopen.c:34:
/usr/include/features.h:332:0: note: this is the location of the previous definition
 # define __USE_GNU 1
 ^
/tmp/ccWTsAQS.s: Assembler messages:
/tmp/ccWTsAQS.s:137: Error: symbol `open64' is already defined

Szerk: Megnézetem, a /dev/urandom megnyitását akarja ezzel megakadályozni!


    if (strcmp(path, "/dev/urandom") == 0) {
        return real_open64("/dev/zero", flags, mode);
    } else {
        return real_open64(path, flags, mode);
    }

Első ötletem:


sed_repl 's/^open/szabodj_meg_open/' ./regress/nonrandomopen.c

Hozzászólások

Még nem néztem meg rendesen, de első ránézésre olyan, mintha Ifjabb Vér István csinálta volna: saját megjobbított open/open64 függvényeket definiál, amelyek azért hívják az igazikat (vö: dlsym/RTLD_NEXT). Namostan a gond ott van, hogy az 'open' az 'open64' lesz, mire a gcc megírja az Assembly-t.

off

Te legalább tudod, mit csinálsz. Én sötétben tapogatózom. Épp az mpd nem fordul OpenWrt/LEDE-re, de terveim szerint addig ütöm, amíg átverem a compileren. :)

tr '[:lower:]' '[:upper:]' <<<locsemege
LOCSEMEGE

csak megnéztem tesztre. Egy sima Centos7 alatt libzip.org -ról libzip-1.3.2

configure && make

Itt minden nyűg nélkül lefordult. Vagy nem erről a libzipről beszélünk? :)

[root@centos7 libzip-1.3.2]# nm -g regress/nonrandomopen.o
U abort
U dlsym
0000000000000050 T open
00000000000000e0 T open64

ennyit.

Gondolom largefile supporttal, mivel nem adtam meg --disable-largefile -t configure-nak.

itt egy configure "log" https://pastebin.com/dBUCQy3X

itt pedig a teljes make folyamat: https://pastebin.com/pZvjexcb

És 64bit

Ilyen szépség van nálam a /usr/include/fcntl.h-ban:


#ifndef __USE_FILE_OFFSET64
extern int open (const char *__file, int __oflag, ...) __nonnull ((1));
#else
# ifdef __REDIRECT
extern int __REDIRECT (open, (const char *__file, int __oflag, ...), open64)
     __nonnull ((1));
# else
#  define open open64
# endif
#endif
#ifdef __USE_LARGEFILE64
extern int open64 (const char *__file, int __oflag, ...) __nonnull ((1));
#endif

Ez nálam is ugyan így néz ki:

#ifndef __USE_FILE_OFFSET64
extern int open (__const char *__file, int __oflag, ...) __nonnull ((1));
#else
# ifdef __REDIRECT
extern int __REDIRECT (open, (__const char *__file, int __oflag, ...), open64)
__nonnull ((1));
# else
# define open open64
# endif
#endif
#ifdef __USE_LARGEFILE64
extern int open64 (__const char *__file, int __oflag, ...) __nonnull ((1));
#endif

Ekkor jön a cpp nevű komponens, és ilyet generál a __REDIRECT-ből:


extern int open (const char *__file, int __oflag, ...) __asm__ ("" "open64")
     __attribute__ ((__nonnull__ (1)));

Mondjuk azt be kell valljam, hogy az alábbiak mindegyikét globálisan beállítottam, hogy minden egzotikus program minden egzotikus platformon értsen valamelyikből:


-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES