Project

General

Profile

Bug #16558

What is special about GB2312

Added by vo.x (Vit Ondruch) about 1 month ago. Updated about 1 month ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
[ruby-core:96981]

Description

Checking Ruby in Fedora, rpmlint complains about standard library:

$ rpmlint ./ruby-libs-2.7.0-126.fc32.x86_64.rpm 
ruby-libs.x86_64: W: spelling-error %description -l en_US libruby -> lib ruby, lib-ruby, library
ruby-libs.x86_64: W: obsolete-not-provided ruby-tcltk
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/continuation.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/digest/bubblebabble.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/digest/md5.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/digest/rmd160.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/digest/sha1.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/digest/sha2.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/big5.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/cesu_8.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/cp949.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/emacs_mule.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/encdb.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/euc_jp.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/euc_kr.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/euc_tw.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/gb18030.so
ruby-libs.x86_64: E: shared-lib-without-dependency-information /usr/lib64/ruby/enc/gb2312.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/gbk.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/iso_8859_1.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/iso_8859_10.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/iso_8859_11.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/iso_8859_13.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/iso_8859_14.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/iso_8859_15.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/iso_8859_16.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/iso_8859_2.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/iso_8859_3.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/iso_8859_4.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/iso_8859_5.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/iso_8859_6.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/iso_8859_7.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/iso_8859_8.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/iso_8859_9.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/koi8_r.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/koi8_u.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/shift_jis.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/big5.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/cesu_8.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/chinese.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/ebcdic.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/emoji.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/emoji_iso2022_kddi.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/emoji_sjis_docomo.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/emoji_sjis_kddi.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/emoji_sjis_softbank.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/escape.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/gb18030.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/gbk.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/iso2022.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/japanese.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/japanese_euc.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/japanese_sjis.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/korean.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/single_byte.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/transdb.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/trans/utf_16_32.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/utf_16be.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/utf_16le.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/utf_32be.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/utf_32le.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/windows_1250.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/windows_1251.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/windows_1252.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/windows_1253.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/windows_1254.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/windows_1257.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/enc/windows_31j.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/fcntl.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/fiber.so
ruby-libs.x86_64: E: library-not-linked-against-libc /usr/lib64/ruby/rbconfig/sizeof.so
1 packages and 0 specfiles checked; 69 errors, 2 warnings.

I guess that the E: library-not-linked-against-libc errors are false positive, because these are providing internal Ruby functionality and they are always loaded later, when libc is already loaded.

But I wonder what is the difference for enc/gb2312.so. Looking into details, these are the information I am able to obtani:

$ ldd /usr/lib64/ruby/enc/gb2312.so
    statically linked

$ readelf -d /usr/lib64/ruby/enc/gb2312.so

Dynamic section at offset 0x2e20 contains 22 entries:
  Tag        Type                         Name/Value
 0x000000000000000c (INIT)               0x1000
 0x000000000000000d (FINI)               0x1118
 0x0000000000000019 (INIT_ARRAY)         0x3e08
 0x000000000000001b (INIT_ARRAYSZ)       8 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x3e10
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x2f0
 0x0000000000000005 (STRTAB)             0x3a8
 0x0000000000000006 (SYMTAB)             0x318
 0x000000000000000a (STRSZ)              97 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000003 (PLTGOT)             0x3fc0
 0x0000000000000002 (PLTRELSZ)           24 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x4b8
 0x0000000000000007 (RELA)               0x410
 0x0000000000000008 (RELASZ)             168 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x0000000000000018 (BIND_NOW)           
 0x000000006ffffffb (FLAGS_1)            Flags: NOW
 0x000000006ffffff9 (RELACOUNT)          3
 0x0000000000000000 (NULL)               0x0

This says it is statically linked. If yes, the question is why and why not the others. Please note that enc/gb2312.so used to be similar to all other libraries in Ruby 2.6, so I wonder what is the reason, what has changed?

Updated by jeremyevans0 (Jeremy Evans) about 1 month ago

I checked on OpenBSD and gb2312.so seems to be similar to others (I checked gb18030.so):

$ readelf -d /usr/local/lib/ruby/2.7/x86_64-openbsd/enc/gb2312.so

Dynamic section at offset 0x3058 contains 20 entries:
  Tag        Type                         Name/Value
 0x000000000000001d (RUNPATH)            Library runpath: [/usr/local/lib]
 0x0000000000000001 (NEEDED)             Shared library: [libruby27.so]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.10.1]
 0x0000000000000007 (RELA)               0x478
 0x0000000000000008 (RELASZ)             96 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffff9 (RELACOUNT)          2
 0x0000000000000017 (JMPREL)             0x4d8
 0x0000000000000002 (PLTRELSZ)           96 (bytes)
 0x0000000000000003 (PLTGOT)             0x31b0
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000006 (SYMTAB)             0x2c0
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000005 (STRTAB)             0x3f0
 0x000000000000000a (STRSZ)              129 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x380
 0x0000000000000004 (HASH)               0x3a8
 0x000000000000000c (INIT)               0x11d0
 0x000000000000000d (FINI)               0x11e0
 0x0000000000000000 (NULL)               0x0


$ readelf -d /usr/local/lib/ruby/2.7/x86_64-openbsd/enc/gb18030.so

Dynamic section at offset 0x4118 contains 20 entries:
  Tag        Type                         Name/Value
 0x000000000000001d (RUNPATH)            Library runpath: [/usr/local/lib]
 0x0000000000000001 (NEEDED)             Shared library: [libruby27.so]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.10.1]
 0x0000000000000007 (RELA)               0x758
 0x0000000000000008 (RELASZ)             456 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffff9 (RELACOUNT)          10
 0x0000000000000017 (JMPREL)             0x920
 0x0000000000000002 (PLTRELSZ)           216 (bytes)
 0x0000000000000003 (PLTGOT)             0x4270
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000006 (SYMTAB)             0x2c0
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000005 (STRTAB)             0x570
 0x000000000000000a (STRSZ)              487 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x4a0
 0x0000000000000004 (HASH)               0x4c8
 0x000000000000000c (INIT)               0x29d0
 0x000000000000000d (FINI)               0x29e0
 0x0000000000000000 (NULL)               0x0

This is with clang 8.0.1 and LLD 8.0.1.

Maybe this is a Linux or Fedora specific issue, or specific to certain compiler/linker combinations? I would be helpful to have feedback from Mac users as well as users of other Linux distributions to see if other users are affected, including what compiler/linker they are using.

Updated by nobu (Nobuyoshi Nakada) about 1 month ago

Since 88db6fa4793da3724c0128e53cfe1abead1774f8 (and 162cf2879af592f8aa458311486749bed9a6bf55), GB2312 is defined in encdb.c and Init_gb2312 is empty now.
And ENC_REPLICATE and similar macros are expanded empty unless configured as --with-static-linked-ext.
So nothing referred and no dependency information should be no problem.

Also available in: Atom PDF