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: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, 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 ADBE21F45A for ; Sat, 18 Apr 2020 14:29:23 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 10D761209D6; Sat, 18 Apr 2020 23:29:00 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id A5D201209D3 for ; Sat, 18 Apr 2020 23:28:57 +0900 (JST) Received: by filterdrecv-p3mdw1-6dbfd75bfd-rd7m8 with SMTP id filterdrecv-p3mdw1-6dbfd75bfd-rd7m8-20-5E9B0EB9-B 2020-04-18 14:29:13.161935655 +0000 UTC m=+2035313.674445910 Received: from herokuapp.com (unknown) by ismtpd0040p1iad2.sendgrid.net (SG) with ESMTP id 5MRZEQzGSy-jdSjmMBbnAw for ; Sat, 18 Apr 2020 14:29:13.119 +0000 (UTC) Date: Sat, 18 Apr 2020 14:29:13 +0000 (UTC) From: deivid.rodriguez@riseup.net Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 73711 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 16798 X-Redmine-Issue-Author: deivid X-Redmine-Sender: deivid 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?klzXTY0v3jOvaMSihdVenmzxCeXPrK4t1AV7GwiE8ThiBC3of5O3nVsEjZYkLr?= =?us-ascii?Q?5F+1AoDIjzeHPXDHlQdOGs+kkzQ6vTmJNsOgaCn?= =?us-ascii?Q?Rc3+MHTFNKYoFWETl2fRzcnPl6VJ4XUu5anRGNX?= =?us-ascii?Q?AzcDch7lkuFzUm5jkjdY1WWaxE5i7IRJOxuwsmF?= =?us-ascii?Q?I8r6tM4Fh1r5HIdsxT7m92bPfzGYkvJvMVD5ytF?= =?us-ascii?Q?V3CbM4DKY1l6TZWrE=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 97950 Subject: [ruby-core:97950] [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 deivid (David Rodr=EDguez). Thanks for the quick fix @nobu, and for setting the backports! <3 ---------------------------------------- Bug #16798: ENV.replace on Windows with a variable name not respecting case= will clear it https://bugs.ruby-lang.org/issues/16798#change-85176 * Author: deivid (David Rodr=EDguez) * Status: Closed * Priority: Normal * Backport: 2.5: REQUIRED, 2.6: REQUIRED, 2.7: REQUIRED ---------------------------------------- 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: