From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 285E21F405; Sat, 15 Dec 2018 22:49:02 +0000 (UTC) From: Eric Wong To: kcar-public@bogomips.org Cc: Eric Wong Subject: [PATCH] extconf: fix rb_hash_aset deduplication test Date: Sat, 15 Dec 2018 22:48:49 +0000 Message-Id: <20181215224849.19276-1-e@80x24.org> List-Id: We must rely on a random string which is already outside of the Ruby fstring table. --- ext/kcar/extconf.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ext/kcar/extconf.rb b/ext/kcar/extconf.rb index ba69c3c..1608f70 100644 --- a/ext/kcar/extconf.rb +++ b/ext/kcar/extconf.rb @@ -24,8 +24,11 @@ end message('checking if Hash#[]= (rb_hash_aset) dedupes... ') h = {} -h[%w(m k m f).join('')] = :foo -if 'mkmf'.freeze.equal?(h.keys[0]) +x = {} +r = rand.to_s +h[%W(#{r}).join('')] = :foo +x[%W(#{r}).join('')] = :foo +if x.keys[0].equal?(h.keys[0]) $CPPFLAGS += ' -DHASH_ASET_DEDUPE=1 ' message("yes\n") else -- EW