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 9765B1F45A for ; Fri, 17 Apr 2020 11:19:50 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 4381A120A91; Fri, 17 Apr 2020 20:19:28 +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 1E767120A8D for ; Fri, 17 Apr 2020 20:19:24 +0900 (JST) Received: by filterdrecv-p3mdw1-6dbfd75bfd-h68rz with SMTP id filterdrecv-p3mdw1-6dbfd75bfd-h68rz-18-5E9990CF-20 2020-04-17 11:19:43.396818352 +0000 UTC m=+1937536.509086166 Received: from herokuapp.com (unknown) by ismtpd0046p1iad1.sendgrid.net (SG) with ESMTP id UIXjr0JeTiyl5KWXZk8F-Q for ; Fri, 17 Apr 2020 11:19:43.372 +0000 (UTC) Date: Fri, 17 Apr 2020 11:19:43 +0000 (UTC) From: deivid.rodriguez@riseup.net Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 73702 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?klzXTY0v3jOvaMSihdVenmzxCeXPrK4t1AV7GwiE8ThMvgIwJKnDYl9SF+NqUO?= =?us-ascii?Q?vV8k0CDzMrO+TzAHCkC9h9YGaqryi+yDzuyn2KC?= =?us-ascii?Q?eOKIOIUIHERz2oy5Lp=2FdbydNYJ5IfxdOzPpd3hU?= =?us-ascii?Q?SByJWxXLSupsTtmoUy=2F2gqY9v93xATpwOWqiXzW?= =?us-ascii?Q?8RpZ=2F+3vn1eKhcm7aHw545NVWuXC4stBVFwi7o4?= =?us-ascii?Q?CxSpkk81VnpVho4kc=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 97941 Subject: [ruby-core:97941] [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 reported by deivid (David Rodr=EDguez). ---------------------------------------- Bug #16798: ENV.replace on Windows with a variable name not respecting case= will clear it https://bugs.ruby-lang.org/issues/16798 * Author: deivid (David Rodr=EDguez) * Status: Open * Priority: Normal * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- 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: