ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:97941] [Ruby master Bug#16798] ENV.replace on Windows with a variable name not respecting case will clear it
@ 2020-04-17 11:19 deivid.rodriguez
  2020-04-18 14:29 ` [ruby-core:97950] " deivid.rodriguez
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: deivid.rodriguez @ 2020-04-17 11:19 UTC (permalink / raw)
  To: ruby-core

Issue #16798 has been reported by deivid (David Rodríguez).

----------------------------------------
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íguez)
* 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'] = 'foo'; puts ENV['Path']"                                                                                                                                                     C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Windows\System32\Wbem;C:\Windows\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:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Ruby27-x64\bin;C:\Ruby25-x64\bin
foo

PS C:\Users\deivi> ruby -e "puts ENV['Path']; ENV.update('PATH' => 'foo'); puts ENV['Path']"                                                                                                                                             C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Windows\System32\Wbem;C:\Windows\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:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Ruby27-x64\bin;C:\Ruby25-x64\bin
foo
```

However, with `ENV.replace`, if you don't use the "canonical casing" (as given by `ENV.keys`, for example), the environment variable will be cleared.

```
PS C:\Users\deivi> ruby -e "puts ENV['Path']; ENV.replace('PATH' => 'foo'); puts ENV['Path']"                                                                                                                                                 C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Windows\System32\Wbem;C:\Windows\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:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Ruby27-x64\bin;C:\Ruby25-x64\bin


```

This is unexpected to me.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:97950] [Ruby master Bug#16798] ENV.replace on Windows with a variable name not respecting case will clear it
  2020-04-17 11:19 [ruby-core:97941] [Ruby master Bug#16798] ENV.replace on Windows with a variable name not respecting case will clear it deivid.rodriguez
@ 2020-04-18 14:29 ` deivid.rodriguez
  2020-07-25  3:00 ` [ruby-core:99322] " nagachika00
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: deivid.rodriguez @ 2020-04-18 14:29 UTC (permalink / raw)
  To: ruby-core

Issue #16798 has been updated by deivid (David Rodríguez).


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íguez)
* 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'] = 'foo'; puts ENV['Path']"                                                                                                                                                     C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Windows\System32\Wbem;C:\Windows\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:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Ruby27-x64\bin;C:\Ruby25-x64\bin
foo

PS C:\Users\deivi> ruby -e "puts ENV['Path']; ENV.update('PATH' => 'foo'); puts ENV['Path']"                                                                                                                                             C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Windows\System32\Wbem;C:\Windows\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:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Ruby27-x64\bin;C:\Ruby25-x64\bin
foo
```

However, with `ENV.replace`, if you don't use the "canonical casing" (as given by `ENV.keys`, for example), the environment variable will be cleared.

```
PS C:\Users\deivi> ruby -e "puts ENV['Path']; ENV.replace('PATH' => 'foo'); puts ENV['Path']"                                                                                                                                                 C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Windows\System32\Wbem;C:\Windows\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:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Ruby27-x64\bin;C:\Ruby25-x64\bin


```

This is unexpected to me.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:99322] [Ruby master Bug#16798] ENV.replace on Windows with a variable name not respecting case will clear it
  2020-04-17 11:19 [ruby-core:97941] [Ruby master Bug#16798] ENV.replace on Windows with a variable name not respecting case will clear it deivid.rodriguez
  2020-04-18 14:29 ` [ruby-core:97950] " deivid.rodriguez
@ 2020-07-25  3:00 ` nagachika00
  2021-04-04 22:49 ` [ruby-core:103215] " usa
  2021-04-30 14:45 ` [ruby-core:103674] " v.ondruch
  3 siblings, 0 replies; 5+ messages in thread
From: nagachika00 @ 2020-07-25  3:00 UTC (permalink / raw)
  To: 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: REQUIRED, 2.6: REQUIRED, 2.7: DONE

ruby_2_7 89f06ce8b8a887f12b53ea190d79a58e98b59008 merged revision(s) 08529a61153e5c40f57a65272211357511d6e6db.

----------------------------------------
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íguez)
* 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'] = 'foo'; puts ENV['Path']"                                                                                                                                                     C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Windows\System32\Wbem;C:\Windows\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:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Ruby27-x64\bin;C:\Ruby25-x64\bin
foo

PS C:\Users\deivi> ruby -e "puts ENV['Path']; ENV.update('PATH' => 'foo'); puts ENV['Path']"                                                                                                                                             C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Windows\System32\Wbem;C:\Windows\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:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Ruby27-x64\bin;C:\Ruby25-x64\bin
foo
```

However, with `ENV.replace`, if you don't use the "canonical casing" (as given by `ENV.keys`, for example), the environment variable will be cleared.

```
PS C:\Users\deivi> ruby -e "puts ENV['Path']; ENV.replace('PATH' => 'foo'); puts ENV['Path']"                                                                                                                                                 C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Windows\System32\Wbem;C:\Windows\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:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Ruby27-x64\bin;C:\Ruby25-x64\bin


```

This is unexpected to me.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:103215] [Ruby master Bug#16798] ENV.replace on Windows with a variable name not respecting case will clear it
  2020-04-17 11:19 [ruby-core:97941] [Ruby master Bug#16798] ENV.replace on Windows with a variable name not respecting case will clear it deivid.rodriguez
  2020-04-18 14:29 ` [ruby-core:97950] " deivid.rodriguez
  2020-07-25  3:00 ` [ruby-core:99322] " nagachika00
@ 2021-04-04 22:49 ` usa
  2021-04-30 14:45 ` [ruby-core:103674] " v.ondruch
  3 siblings, 0 replies; 5+ messages in thread
From: usa @ 2021-04-04 22:49 UTC (permalink / raw)
  To: ruby-core

Issue #16798 has been updated by usa (Usaku NAKAMURA).

Backport changed from 2.5: REQUIRED, 2.6: REQUIRED, 2.7: DONE to 2.5: REQUIRED, 2.6: DONE, 2.7: DONE

backported into ruby_2_6 at r67917

----------------------------------------
Bug #16798: ENV.replace on Windows with a variable name not respecting case will clear it
https://bugs.ruby-lang.org/issues/16798#change-91290

* Author: deivid (David Rodríguez)
* Status: Closed
* Priority: Normal
* Backport: 2.5: REQUIRED, 2.6: DONE, 2.7: DONE
----------------------------------------
On Windows, environment variable names are case insensitive:

```
PS C:\Users\deivi> ruby -e "puts ENV['Path']; ENV['PATH'] = 'foo'; puts ENV['Path']"                                                                                                                                                     C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Windows\System32\Wbem;C:\Windows\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:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Ruby27-x64\bin;C:\Ruby25-x64\bin
foo

PS C:\Users\deivi> ruby -e "puts ENV['Path']; ENV.update('PATH' => 'foo'); puts ENV['Path']"                                                                                                                                             C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Windows\System32\Wbem;C:\Windows\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:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Ruby27-x64\bin;C:\Ruby25-x64\bin
foo
```

However, with `ENV.replace`, if you don't use the "canonical casing" (as given by `ENV.keys`, for example), the environment variable will be cleared.

```
PS C:\Users\deivi> ruby -e "puts ENV['Path']; ENV.replace('PATH' => 'foo'); puts ENV['Path']"                                                                                                                                                 C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Windows\System32\Wbem;C:\Windows\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:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Ruby27-x64\bin;C:\Ruby25-x64\bin


```

This is unexpected to me.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:103674] [Ruby master Bug#16798] ENV.replace on Windows with a variable name not respecting case will clear it
  2020-04-17 11:19 [ruby-core:97941] [Ruby master Bug#16798] ENV.replace on Windows with a variable name not respecting case will clear it deivid.rodriguez
                   ` (2 preceding siblings ...)
  2021-04-04 22:49 ` [ruby-core:103215] " usa
@ 2021-04-30 14:45 ` v.ondruch
  3 siblings, 0 replies; 5+ messages in thread
From: v.ondruch @ 2021-04-30 14:45 UTC (permalink / raw)
  To: ruby-core

Issue #16798 has been updated by vo.x (Vit Ondruch).


The backport breaks on RHEL7:

~~~
hash.c: In function 'keylist_delete':
hash.c:5661:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for (long i=0; i<RARRAY_LEN(keys); i++) {
     ^
hash.c:5661:5: note: use option -std=c99 or -std=gnu99 to compile your code
~~~

Interestingly, I have not met this issue in Ruby 2.7. Are there implicitly the -std=c99 or -std=gnu99 options?

----------------------------------------
Bug #16798: ENV.replace on Windows with a variable name not respecting case will clear it
https://bugs.ruby-lang.org/issues/16798#change-91769

* Author: deivid (David Rodríguez)
* Status: Closed
* Priority: Normal
* Backport: 2.5: REQUIRED, 2.6: DONE, 2.7: DONE
----------------------------------------
On Windows, environment variable names are case insensitive:

```
PS C:\Users\deivi> ruby -e "puts ENV['Path']; ENV['PATH'] = 'foo'; puts ENV['Path']"                                                                                                                                                     C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Windows\System32\Wbem;C:\Windows\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:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Ruby27-x64\bin;C:\Ruby25-x64\bin
foo

PS C:\Users\deivi> ruby -e "puts ENV['Path']; ENV.update('PATH' => 'foo'); puts ENV['Path']"                                                                                                                                             C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Windows\System32\Wbem;C:\Windows\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:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Ruby27-x64\bin;C:\Ruby25-x64\bin
foo
```

However, with `ENV.replace`, if you don't use the "canonical casing" (as given by `ENV.keys`, for example), the environment variable will be cleared.

```
PS C:\Users\deivi> ruby -e "puts ENV['Path']; ENV.replace('PATH' => 'foo'); puts ENV['Path']"                                                                                                                                                 C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Windows\System32\Wbem;C:\Windows\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:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\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:\Ruby27-x64\bin;C:\Ruby25-x64\bin


```

This is unexpected to me.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-30 14:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-17 11:19 [ruby-core:97941] [Ruby master Bug#16798] ENV.replace on Windows with a variable name not respecting case will clear it deivid.rodriguez
2020-04-18 14:29 ` [ruby-core:97950] " deivid.rodriguez
2020-07-25  3:00 ` [ruby-core:99322] " nagachika00
2021-04-04 22:49 ` [ruby-core:103215] " usa
2021-04-30 14:45 ` [ruby-core:103674] " v.ondruch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).