Граф коммитов

269 Коммитов

Автор SHA1 Сообщение Дата
KJ Tsanaktsidis e74ea904ad [ruby/zlib] Check for z_size_t along with {crc,adler}32_z in
extconf.rb
(https://github.com/ruby/zlib/pull/69)

The android NDK (android-ndk-r21e) does not have crc32_z, adler32_z, nor
z_size_t in its zlib.h header file. However, it _does_ have the crc32_z
and adler32_z symbols in the libz.a static library!

mkmf performs two tests for have_func:
* It sees if a program that includes the header and takes the address of
  the symbol can compile
* It sees if a program that defines the symbol as `extern void sym_name()`
  and calls it can be linked

If either test works, it considers the function present. The
android-ndk-r21e is passing the second test but not the first for
crc32_z/adler32_z. So, we define HAVE_ZLIB_SIZE_T_FUNCS, but then can't
actually compile the extension (since the prototypes aren't in the
header file).

We can keep this working how it was working before by _also_ checking
for `have_type("z_size_t", "zlib.h")`. The have_type check _only_ looks
in the header file for the type; if a program including the header file
and using the type can't compile, the type is considered absent
regardless of what might be in libz.a.

https://github.com/ruby/zlib/commit/3b9fe962d8
2023-10-26 09:56:21 +00:00
KJ Tsanaktsidis ac4d687656 [ruby/zlib] Fix misdetection of {crc32,alder32}_z in cloudflare zlib fork
We use the Cloudflare fork of zlib
(https://github.com/cloudflare/zlib), which we find gives improved
performance on AWS Graviton ARM instances. That fork does not define
crc32_z and alder32_z functions.

Until two days ago, Ruby's zlib gem worked fine, because cloudflare zlib
_also_ did not define z_size_t, which meant Ruby did not try and use
these functions.

Since a3ba99596d
however, cloudflare zlib _does_ define z_size_t (but NOT crc32_z or
alder32_z). The zlib gem would try and use these nonexistant
functions and not compile.

This patch fixes it by actually specifically detecting the functions
that the gem wants to call, rather than just the presence of the
z_size_t type.

https://github.com/ruby/zlib/commit/c96e8b9a57
2023-10-26 02:17:54 +00:00
Sorah Fukumori d2864ca330 [ruby/zlib] Zlib.gunzip should not fail with utf-8 strings
(https://github.com/ruby/zlib/pull/55)

zstream_discard_input was encoding and character-aware when given input is user-provided, so this discards `len` chars instead of `len` bytes.

Also Zlib.gunzip explains in its rdoc that it is equivalent with the following code, but this doesn't fail for UTF-8 String.

```ruby
string = %w[1f8b0800c28000000003cb48cdc9c9070086a6103605000000].pack("H*").force_encoding('UTF-8')
sio = StringIO.new(string)
p gz.read #=> "hello"
gz&.close
p Zlib.gunzip(string) #=> Zlib::DataError
```

Reported and discovered by eagletmt at https://twitter.com/eagletmt/status/1689692467929694209

https://github.com/ruby/zlib/commit/c5e58bc62a
2023-08-10 20:12:21 +00:00
Matt Valentine-House 5e4b80177e Update the depend files 2023-02-28 09:09:00 -08:00
Matt Valentine-House f38c6552f9 Remove intern/gc.h from Make deps 2023-02-27 10:11:56 -08:00
Nobuyoshi Nakada 899ea35035
Extract include/ruby/internal/attr/packed_struct.h
Split `PACKED_STRUCT` and `PACKED_STRUCT_UNALIGNED` macros into the
macros bellow:
* `RBIMPL_ATTR_PACKED_STRUCT_BEGIN`
* `RBIMPL_ATTR_PACKED_STRUCT_END`
* `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_BEGIN`
* `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_END`
2023-02-08 12:34:13 +09:00
Nobuyoshi Nakada 0a2bf5f1e2 [ruby/zlib] Check for functions with arguments and the header
With arguments, mkmf skips compilation check for the function as RHS.

https://github.com/ruby/zlib/commit/9ed9d6d36e
2023-01-09 10:46:02 +00:00
Hiroshi SHIBATA 3f8dad0463 [ruby/zlib] Bump version to 3.0.0
https://github.com/ruby/zlib/commit/f1ce5e3e8d
2022-12-05 08:26:21 +00:00
Hiroshi SHIBATA 839577d833
Removed mswin patch for zlib-1.2.11 2022-04-05 14:30:47 +09:00
Nobuyoshi Nakada 07acd6006c [ruby/zlib] Use `z_size_t` version functions
https://github.com/ruby/zlib/commit/1ce6625fff
2022-04-02 19:34:05 +09:00
Nobuyoshi Nakada 4ee71097a0 [ruby/zlib] Mask checksums to lower 32bits on also IL32 platforms
https://github.com/ruby/zlib/commit/e1ead85113
2022-04-02 19:23:59 +09:00
Nobuyoshi Nakada 1cbdedec89 [ruby/zlib] Mask checksums to lower 32bits
Upper bits affect the result of `crc32` in zlib 1.2.12.

https://github.com/ruby/zlib/commit/9ab6d04af1
2022-04-02 17:01:33 +09:00
Peter Zhu 2d5ecd60a5 [Feature #18249] Update dependencies 2022-02-22 09:55:21 -05:00
Mau Magnaguagno 50098f4b61 [ruby/zlib] [DOC] Fix typo in Zlib.adler32_combine
https://github.com/ruby/zlib/commit/5e8f0b4164
2022-02-22 18:01:53 +09:00
NARUSE, Yui 82c8acbcfd Prevent installing zlib library 2021-12-25 21:01:43 +09:00
Peter Zhu c51b92c18d [ruby/zlib] [Bug #18358] Fix crash in zlib when in progress
When Zlib::Inflate#inflate or Zlib::Deflate#deflate is called
recursively inside the block, a crash can occur because of an
use-after-free bug.

https://github.com/ruby/zlib/commit/50fb8a0338
2021-11-24 23:01:41 +09:00
Nobuyoshi Nakada ac152b3cac
Update dependencies 2021-11-21 16:21:18 +09:00
Peter Zhu aeae6e2842 [Feature #18290] Remove all usages of rb_gc_force_recycle
This commit removes usages of rb_gc_force_recycle since it is a burden
to maintain and makes changes to the GC difficult.
2021-11-08 14:05:54 -05:00
Hiroshi SHIBATA b482a516d2 [ruby/zlib] Bump up zlib version to 2.1.1
https://github.com/ruby/zlib/commit/82e9a636a6
2021-10-19 20:28:57 +09:00
Sutou Kouhei 027a3379d6 [ruby/zlib] Fix a bug that GZipReader#gets may return incomplete line
See also: https://github.com/ruby/csv/issues/117#issuecomment-933289373

How to reproduce with x.csv.gz in the issue comment:

    Zlib::GzipReader.open("x.csv.gz") do |rio|
      rio.gets(nil, 1024)
      while line = rio.gets(nil, 8192)
        raise line unless line.valid_encoding?
      end
    end

Reported by Dimitrij Denissenko. Thanks!!!

https://github.com/ruby/zlib/commit/b1f182e98f
2021-10-15 15:31:15 +09:00
Hiroshi SHIBATA 6b13448040 [ruby/zlib] Bump up zlib version to 2.1.0
https://github.com/ruby/zlib/commit/dd593acaee
2021-10-14 16:18:41 +09:00
Hiroshi SHIBATA db500f05c2 [ruby/zlib] Bump version to v2.0.0
https://github.com/ruby/zlib/commit/434eba55ae
2021-10-14 16:18:36 +09:00
卜部昌平 5c167a9778 ruby tool/update-deps --fix 2021-10-05 14:18:23 +09:00
Nobuyoshi Nakada d3155e3632 [ruby/zlib] Don't print out warnings when finalizing
https://github.com/ruby/zlib/commit/44a56d36e7
2021-08-31 23:20:42 +09:00
Nobuyoshi Nakada 31c427511c [ruby/zlib] Revert "Don't print out warnings when freeing."
https://github.com/ruby/zlib/commit/931aa7a272
2021-08-31 23:20:40 +09:00
Samuel Williams d19af1675c [ruby/zlib] Don't print out warnings when freeing.
https://github.com/ruby/zlib/commit/098c50255d
2021-08-31 19:33:38 +09:00
Jeremy Evans b3d62a77d9 [ruby/zlib] Synchronize access to zstream to prevent segfault in multithreaded use
I'm not sure whether this handles all multithreaded use cases,
but this handles the example that crashes almost immediately
and does 10,000,000 total deflates using 100 separate threads.

To prevent the tests from taking forever, the committed test
for this uses only 10,000 deflates across 10 separate threads,
which still causes a segfault in the previous implementation
almost immediately.

Fixes [Bug #17803]

https://github.com/ruby/zlib/commit/4b1023b3f2
2021-07-28 13:40:03 +09:00
Nobuyoshi Nakada eecc4570cd
Found library is not usable if the header is not found 2021-07-06 01:17:38 +09:00
Nobuyoshi Nakada 6d8422659a
Fix linking bundled zlib
* Prefix "./" to the import library name to expanded when static
  linking exts.

* Copy zlib shared library to the top build directory.
2021-07-03 12:52:46 +09:00
Benoit Daloze fa7a712d46 Fix -Wundef warnings for HAVE_RB_EXT_RACTOR_SAFE
* See [Feature #17752]
2021-05-04 14:56:55 +02:00
Olle Jonsson 59411b0b36
[ruby/zlib] gemspec: Remove unused files
Remove the list of executables.

https://github.com/ruby/zlib/commit/6a70725b8e
2021-04-20 21:19:41 +09:00
卜部昌平 6413dc27dc dependency updates 2021-04-13 14:30:21 +09:00
Nobuyoshi Nakada 3260602fa3
Adjusted indents [ci skip] 2021-03-17 09:49:17 +09:00
Sorah Fukumori cf831f4918
zlib: fix Gzip{Writer,Reader}.new fails with a O_TMPFILE file 2021-03-17 02:16:27 +09:00
wanabe 0c5f8c6276 [ruby/zlib] Resume zstream if available [Bug #10961] 2021-03-09 13:19:03 +09:00
Hiroshi SHIBATA e72757a311 [ruby/zlib] Don't use gemspec for gem dependecy
https://github.com/ruby/zlib/commit/7d3d19710f
2021-02-10 12:49:33 +09:00
Koichi Sasada b44f7151c7 zlib is ractor-safe 2020-12-18 14:09:32 +09:00
Jeremy Evans 0adc426ca5 [ruby/zlib] Add Zlib::Inflate#inflate :buffer keyword argument
If a buffer keyword argument is given, it is used as the buffer,
instead of creating new strings.  This can result in significantly
lower memory usage during inflation.

Implements #19

https://github.com/ruby/zlib/commit/dac9a9b57d
2020-12-04 19:12:32 +09:00
Jeremy Evans bc63ec57e7 [ruby/zlib] Allow Zlib.crc32 and .adler32 to accept IO instance
This reads from the IO in 8192 byte chunks, so you don't need to
have the entire string in memory.

Fixes #16

https://github.com/ruby/zlib/commit/ba9793c550
2020-12-04 19:12:20 +09:00
Jeremy Evans a60dfff434 [ruby/zlib] Document that gets can return nil when eof? returns false
This behavior differs from File#gets.

Fixes [Bug #13904]

https://github.com/ruby/zlib/commit/448e41efdd
2020-12-04 19:11:30 +09:00
卜部昌平 43b95bafd5
delete deprecated IO-like methods
This commit deletes
{IO,ARGF,StringIO,Zib::GZipReader}#{bytes,chars,lines,codepoints}, which
have been deprecated since c47c095b97.

Note that String also has those methods.  They are neither depreacted
nor deleted because they are not aliases of counterpart each_something.
2020-12-03 12:47:51 +09:00
Nobuyoshi Nakada 48d1e8682c
zlib: patches for mswin64
* cast to suppress C4267 warnings; no possible loss of data as
  following the comparison.

* shift base address to suppress LNK4281; although /DYNAMICBASE is
  preferable, not sure from which version of link.exe supports it.
2020-11-24 08:27:08 +09:00
Nobuyoshi Nakada 78c40e6588
zlib: extlibs to download zlib-1.2.11 2020-11-24 08:22:54 +09:00
Jeremy Evans d52dffd817 [ruby/zlib] Add Zlib::GzipReader.zcat for handling multiple gzip streams in gz file
Most gzip tools support concatenated gz streams in a gz file. This
offers a way to handle such gz files in Ruby.

Fixes [Bug #9790]
Fixes [Bug #11180]
Fixes [Bug #14804]

https://github.com/ruby/zlib/commit/e2ce56de7d
2020-09-14 17:52:20 +09:00
卜部昌平 490010084e sed -i '/rmodule.h/d' 2020-08-27 16:42:06 +09:00
卜部昌平 756403d775 sed -i '/r_cast.h/d' 2020-08-27 15:03:36 +09:00
卜部昌平 0da2a3f1fc sed -i '\,2/extern.h,d' 2020-08-27 14:07:49 +09:00
Hiroshi SHIBATA 8fb02b7a97
Update the license for the default gems to dual licenses 2020-08-18 20:26:39 +09:00
卜部昌平 9e41a75255 sed -i 's|ruby/impl|ruby/internal|'
To fix build failures.
2020-05-11 09:24:08 +09:00
卜部昌平 d7f4d732c1 sed -i s|ruby/3|ruby/impl|g
This shall fix compile errors.
2020-05-11 09:24:08 +09:00