Fix linux find-so failure if no old ld entries exist
If '/etc/ld.so.cache' does not contain any old entries using the 'HeaderOld' struct then it fails with a bad-magic error before looking for the HeaderNew entries. My Ubuntu 19.10 system doesn't have any old entries so always fails here when using 'load-all', which results in the 'extra/llvm' vocab failing due to using 'find-so'. The fix implemented here is to catch the error and recover from it by seeking back to the start of the header before looking for the new header entries.master
parent
dfdbde9f33
commit
487141d440
|
@ -1,8 +1,9 @@
|
||||||
! Copyright (C) 2017 Björn Lindqvist.
|
! Copyright (C) 2017 Björn Lindqvist.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien.c-types alien.strings assocs byte-arrays
|
USING: accessors alien.c-types alien.strings assocs byte-arrays
|
||||||
classes.struct fry io io.encodings.binary io.encodings.string io.files
|
classes.struct continuations fry io io.encodings.binary
|
||||||
kernel math math.bitwise sequences system ;
|
io.encodings.string io.files kernel math math.bitwise sequences
|
||||||
|
system ;
|
||||||
IN: ldcache
|
IN: ldcache
|
||||||
|
|
||||||
! General util
|
! General util
|
||||||
|
@ -75,8 +76,10 @@ STRUCT: EntryNew
|
||||||
: parse ( -- entries )
|
: parse ( -- entries )
|
||||||
! Read the old header and jump past it.
|
! Read the old header and jump past it.
|
||||||
HeaderOld read-struct
|
HeaderOld read-struct
|
||||||
|
[
|
||||||
[ HEADER_MAGIC_OLD check-ldcache-magic ]
|
[ HEADER_MAGIC_OLD check-ldcache-magic ]
|
||||||
[ nlibs>> EntryOld struct-size * seek-relative seek-input ] bi
|
[ nlibs>> EntryOld struct-size * seek-relative seek-input ] bi
|
||||||
|
] [ 2drop HeaderOld struct-size neg seek-relative seek-input ] recover
|
||||||
HeaderNew read-struct
|
HeaderNew read-struct
|
||||||
[ HEADER_MAGIC_NEW check-ldcache-magic ] keep
|
[ HEADER_MAGIC_NEW check-ldcache-magic ] keep
|
||||||
[ parse-new-entries ]
|
[ parse-new-entries ]
|
||||||
|
|
Loading…
Reference in New Issue