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-Status: No, score=-2.8 required=3.0 tests=AWL,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id ABF931F5AE for ; Sat, 25 Jul 2020 03:00:59 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id A50091209E7; Sat, 25 Jul 2020 12:00:29 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id F2C1F1209E1 for ; Sat, 25 Jul 2020 12:00:26 +0900 (JST) Received: by filterdrecv-p3mdw1-75c584b9c6-msczw with SMTP id filterdrecv-p3mdw1-75c584b9c6-msczw-20-5F1BA066-6D 2020-07-25 03:00:54.466434094 +0000 UTC m=+2454680.320935007 Received: from herokuapp.com (unknown) by ismtpd0023p1iad2.sendgrid.net (SG) with ESMTP id OHa170PRQTm5s3aMioXwjQ for ; Sat, 25 Jul 2020 03:00:54.411 +0000 (UTC) Date: Sat, 25 Jul 2020 03:00:54 +0000 (UTC) From: nagachika00@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 75114 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 16798 X-Redmine-Issue-Author: deivid X-Redmine-Sender: nagachika X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?O2wxg26uOO6cft6GjkEp=2FGevTnH9lR=2FEdG60AX3F8=2FDhez2+Rxlvd7UvJjwmvB?= =?us-ascii?Q?hM=2FsFohmLlWwh+Rdrga=2FDpZwXi+DTbDnt7xBi3y?= =?us-ascii?Q?GsFwe4+n2lX6qKFjsuCrDvbaXC7rzTtjyPsiuoz?= =?us-ascii?Q?4Q8CkpONWhUjCARfsZ4OKXfen7=2FfjSaW6bp21Uu?= =?us-ascii?Q?d0yl9jkkTfhx6CNFt2hqs7Zmw5LK1ksmw11+7nA?= =?us-ascii?Q?oVdsPRODSkOdjaBdU=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 99322 Subject: [ruby-core:99322] [Ruby master Bug#16798] ENV.replace on Windows with a variable name not respecting case will clear it X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #16798 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 2.5: REQUIRED, 2.6: REQUIRED, 2.7: REQUIRED to 2.5: R= EQUIRED, 2.6: REQUIRED, 2.7: DONE ruby_2_7 89f06ce8b8a887f12b53ea190d79a58e98b59008 merged revision(s) 08529a= 61153e5c40f57a65272211357511d6e6db. ---------------------------------------- Bug #16798: ENV.replace on Windows with a variable name not respecting case= will clear it https://bugs.ruby-lang.org/issues/16798#change-86717 * Author: deivid (David Rodr=EDguez) * Status: Closed * Priority: Normal * Backport: 2.5: REQUIRED, 2.6: REQUIRED, 2.7: DONE ---------------------------------------- On Windows, environment variable names are case insensitive: ``` PS C:\Users\deivi> ruby -e "puts ENV['Path']; ENV['PATH'] =3D 'foo'; puts E= NV['Path']" = = C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Window= s\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program = Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin= ;C:\Ruby26-x64\bin;C:\Ruby25-x64\bin;C:\Windows\system32;C:\Windows;C:\Wind= ows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\Sy= stem32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C= :\Program Files\Git\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\Syste= m32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\Op= enSSH\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program= Files\Git\usr\bin;C:\Ruby27-x64\bin;C:\Ruby25-x64\bin foo PS C:\Users\deivi> ruby -e "puts ENV['Path']; ENV.update('PATH' =3D> 'foo')= ; puts ENV['Path']" = = C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Window= s\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program = Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin= ;C:\Ruby26-x64\bin;C:\Ruby25-x64\bin;C:\Windows\system32;C:\Windows;C:\Wind= ows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\Sy= stem32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C= :\Program Files\Git\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\Syste= m32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\Op= enSSH\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program= Files\Git\usr\bin;C:\Ruby27-x64\bin;C:\Ruby25-x64\bin foo ``` However, with `ENV.replace`, if you don't use the "canonical casing" (as gi= ven by `ENV.keys`, for example), the environment variable will be cleared. ``` PS C:\Users\deivi> ruby -e "puts ENV['Path']; ENV.replace('PATH' =3D> 'foo'= ); puts ENV['Path']" = = C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\W= indows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Pro= gram Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\us= r\bin;C:\Ruby26-x64\bin;C:\Ruby25-x64\bin;C:\Windows\system32;C:\Windows;C:= \Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windo= ws\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\= bin;C:\Program Files\Git\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\= System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System= 32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Pr= ogram Files\Git\usr\bin;C:\Ruby27-x64\bin;C:\Ruby25-x64\bin ``` This is unexpected to me. -- = https://bugs.ruby-lang.org/ Unsubscribe: