ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:101954] [Ruby master Bug#17517] File.expand_path returns us-aascii when both arguments are ascii compat
@ 2021-01-06 11:32 zn
  2021-01-06 12:49 ` [ruby-core:101957] " jean.boussier
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zn @ 2021-01-06 11:32 UTC (permalink / raw)
  To: ruby-core

Issue #17517 has been reported by znz (Kazuhiro NISHIYAMA).

----------------------------------------
Bug #17517: File.expand_path returns us-aascii when both arguments are ascii compat
https://bugs.ruby-lang.org/issues/17517

* Author: znz (Kazuhiro NISHIYAMA)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
Is this intentional?

```ruby
p __dir__.encoding  #=> #<Encoding:UTF-8>
p 'hoge'.encoding   #=> #<Encoding:UTF-8>
p File.expand_path('hoge', __dir__).encoding #=> #<Encoding:US-ASCII>
```

```
% docker run -it --rm ghcr.io/ruby/all-ruby env ALL_RUBY_SINCE=ruby-1.9 ./all-ruby -e 'p File.expand_path("hoge".encode("utf-8"), "/".encode("utf-8")).encoding'
ruby-1.9.0-0        -e:1:in `encode': transcoding not supported (from ASCII-8BIT to UTF-8) (ArgumentError)
                    	from -e:1:in `<main>'
                exit 1
ruby-1.9.0-1        #<Encoding:ASCII-8BIT>
ruby-1.9.0-2        #<Encoding:US-ASCII>
...
ruby-1.9.1-p129     #<Encoding:US-ASCII>
ruby-1.9.1-p243     #<Encoding:UTF-8>
...
ruby-1.9.2-preview1 #<Encoding:UTF-8>
ruby-1.9.2-preview3 #<Encoding:US-ASCII>
...
ruby-3.0.0          #<Encoding:US-ASCII>
```



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

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

* [ruby-core:101957] [Ruby master Bug#17517] File.expand_path returns us-aascii when both arguments are ascii compat
  2021-01-06 11:32 [ruby-core:101954] [Ruby master Bug#17517] File.expand_path returns us-aascii when both arguments are ascii compat zn
@ 2021-01-06 12:49 ` jean.boussier
  2021-01-07  4:39 ` [ruby-core:101969] [Ruby master Bug#17517] File.expand_path returns us-ascii " duerst
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jean.boussier @ 2021-01-06 12:49 UTC (permalink / raw)
  To: ruby-core

Issue #17517 has been updated by byroot (Jean Boussier).


I'm pretty sure it is intentional. That function calls `rb_filesystem_encoding` https://github.com/ruby/ruby/blob/d968829afa19c31e9461fd545cbd21250778ce6e/file.c#L3696



----------------------------------------
Bug #17517: File.expand_path returns us-aascii when both arguments are ascii compat
https://bugs.ruby-lang.org/issues/17517#change-89810

* Author: znz (Kazuhiro NISHIYAMA)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
Is this intentional?

```ruby
p __dir__.encoding  #=> #<Encoding:UTF-8>
p 'hoge'.encoding   #=> #<Encoding:UTF-8>
p File.expand_path('hoge', __dir__).encoding #=> #<Encoding:US-ASCII>
```

```
% docker run -it --rm ghcr.io/ruby/all-ruby env ALL_RUBY_SINCE=ruby-1.9 ./all-ruby -e 'p File.expand_path("hoge".encode("utf-8"), "/".encode("utf-8")).encoding'
ruby-1.9.0-0        -e:1:in `encode': transcoding not supported (from ASCII-8BIT to UTF-8) (ArgumentError)
                    	from -e:1:in `<main>'
                exit 1
ruby-1.9.0-1        #<Encoding:ASCII-8BIT>
ruby-1.9.0-2        #<Encoding:US-ASCII>
...
ruby-1.9.1-p129     #<Encoding:US-ASCII>
ruby-1.9.1-p243     #<Encoding:UTF-8>
...
ruby-1.9.2-preview1 #<Encoding:UTF-8>
ruby-1.9.2-preview3 #<Encoding:US-ASCII>
...
ruby-3.0.0          #<Encoding:US-ASCII>
```



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

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

* [ruby-core:101969] [Ruby master Bug#17517] File.expand_path returns us-ascii when both arguments are ascii compat
  2021-01-06 11:32 [ruby-core:101954] [Ruby master Bug#17517] File.expand_path returns us-aascii when both arguments are ascii compat zn
  2021-01-06 12:49 ` [ruby-core:101957] " jean.boussier
@ 2021-01-07  4:39 ` duerst
  2021-01-12  0:50 ` [ruby-core:102006] " zn
  2021-01-13 15:19 ` [ruby-core:102062] " nobu
  3 siblings, 0 replies; 5+ messages in thread
From: duerst @ 2021-01-07  4:39 UTC (permalink / raw)
  To: ruby-core

Issue #17517 has been updated by duerst (Martin Dürst).

Subject changed from File.expand_path returns us-aascii when both arguments are ascii compat to File.expand_path returns us-ascii when both arguments are ascii compat

Fix a typo in subject.

----------------------------------------
Bug #17517: File.expand_path returns us-ascii when both arguments are ascii compat
https://bugs.ruby-lang.org/issues/17517#change-89821

* Author: znz (Kazuhiro NISHIYAMA)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
Is this intentional?

```ruby
p __dir__.encoding  #=> #<Encoding:UTF-8>
p 'hoge'.encoding   #=> #<Encoding:UTF-8>
p File.expand_path('hoge', __dir__).encoding #=> #<Encoding:US-ASCII>
```

```
% docker run -it --rm ghcr.io/ruby/all-ruby env ALL_RUBY_SINCE=ruby-1.9 ./all-ruby -e 'p File.expand_path("hoge".encode("utf-8"), "/".encode("utf-8")).encoding'
ruby-1.9.0-0        -e:1:in `encode': transcoding not supported (from ASCII-8BIT to UTF-8) (ArgumentError)
                    	from -e:1:in `<main>'
                exit 1
ruby-1.9.0-1        #<Encoding:ASCII-8BIT>
ruby-1.9.0-2        #<Encoding:US-ASCII>
...
ruby-1.9.1-p129     #<Encoding:US-ASCII>
ruby-1.9.1-p243     #<Encoding:UTF-8>
...
ruby-1.9.2-preview1 #<Encoding:UTF-8>
ruby-1.9.2-preview3 #<Encoding:US-ASCII>
...
ruby-3.0.0          #<Encoding:US-ASCII>
```



-- 
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:102006] [Ruby master Bug#17517] File.expand_path returns us-ascii when both arguments are ascii compat
  2021-01-06 11:32 [ruby-core:101954] [Ruby master Bug#17517] File.expand_path returns us-aascii when both arguments are ascii compat zn
  2021-01-06 12:49 ` [ruby-core:101957] " jean.boussier
  2021-01-07  4:39 ` [ruby-core:101969] [Ruby master Bug#17517] File.expand_path returns us-ascii " duerst
@ 2021-01-12  0:50 ` zn
  2021-01-13 15:19 ` [ruby-core:102062] " nobu
  3 siblings, 0 replies; 5+ messages in thread
From: zn @ 2021-01-12  0:50 UTC (permalink / raw)
  To: ruby-core

Issue #17517 has been updated by znz (Kazuhiro NISHIYAMA).


Original problem is `__FILE__` and `__dir__` are us-ascii only when loaded by `relative_require`.

```
% cat hoge.rb
p __FILE__.encoding
p __dir__.encoding
% cat require_relative.rb
require_relative 'hoge'
% ruby require_relative.rb
#<Encoding:US-ASCII>
#<Encoding:US-ASCII>
% cat require.rb
require './hoge'
% ruby require.rb
#<Encoding:UTF-8>
#<Encoding:UTF-8>
```

----------------------------------------
Bug #17517: File.expand_path returns us-ascii when both arguments are ascii compat
https://bugs.ruby-lang.org/issues/17517#change-89851

* Author: znz (Kazuhiro NISHIYAMA)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
Is this intentional?

```ruby
p __dir__.encoding  #=> #<Encoding:UTF-8>
p 'hoge'.encoding   #=> #<Encoding:UTF-8>
p File.expand_path('hoge', __dir__).encoding #=> #<Encoding:US-ASCII>
```

```
% docker run -it --rm ghcr.io/ruby/all-ruby env ALL_RUBY_SINCE=ruby-1.9 ./all-ruby -e 'p File.expand_path("hoge".encode("utf-8"), "/".encode("utf-8")).encoding'
ruby-1.9.0-0        -e:1:in `encode': transcoding not supported (from ASCII-8BIT to UTF-8) (ArgumentError)
                    	from -e:1:in `<main>'
                exit 1
ruby-1.9.0-1        #<Encoding:ASCII-8BIT>
ruby-1.9.0-2        #<Encoding:US-ASCII>
...
ruby-1.9.1-p129     #<Encoding:US-ASCII>
ruby-1.9.1-p243     #<Encoding:UTF-8>
...
ruby-1.9.2-preview1 #<Encoding:UTF-8>
ruby-1.9.2-preview3 #<Encoding:US-ASCII>
...
ruby-3.0.0          #<Encoding:US-ASCII>
```



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

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

* [ruby-core:102062] [Ruby master Bug#17517] File.expand_path returns us-ascii when both arguments are ascii compat
  2021-01-06 11:32 [ruby-core:101954] [Ruby master Bug#17517] File.expand_path returns us-aascii when both arguments are ascii compat zn
                   ` (2 preceding siblings ...)
  2021-01-12  0:50 ` [ruby-core:102006] " zn
@ 2021-01-13 15:19 ` nobu
  3 siblings, 0 replies; 5+ messages in thread
From: nobu @ 2021-01-13 15:19 UTC (permalink / raw)
  To: ruby-core

Issue #17517 has been updated by nobu (Nobuyoshi Nakada).


https://github.com/ruby/ruby/pull/4061

----------------------------------------
Bug #17517: File.expand_path returns us-ascii when both arguments are ascii compat
https://bugs.ruby-lang.org/issues/17517#change-89923

* Author: znz (Kazuhiro NISHIYAMA)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
Is this intentional?

```ruby
p __dir__.encoding  #=> #<Encoding:UTF-8>
p 'hoge'.encoding   #=> #<Encoding:UTF-8>
p File.expand_path('hoge', __dir__).encoding #=> #<Encoding:US-ASCII>
```

```
% docker run -it --rm ghcr.io/ruby/all-ruby env ALL_RUBY_SINCE=ruby-1.9 ./all-ruby -e 'p File.expand_path("hoge".encode("utf-8"), "/".encode("utf-8")).encoding'
ruby-1.9.0-0        -e:1:in `encode': transcoding not supported (from ASCII-8BIT to UTF-8) (ArgumentError)
                    	from -e:1:in `<main>'
                exit 1
ruby-1.9.0-1        #<Encoding:ASCII-8BIT>
ruby-1.9.0-2        #<Encoding:US-ASCII>
...
ruby-1.9.1-p129     #<Encoding:US-ASCII>
ruby-1.9.1-p243     #<Encoding:UTF-8>
...
ruby-1.9.2-preview1 #<Encoding:UTF-8>
ruby-1.9.2-preview3 #<Encoding:US-ASCII>
...
ruby-3.0.0          #<Encoding:US-ASCII>
```



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

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

end of thread, other threads:[~2021-01-13 15:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06 11:32 [ruby-core:101954] [Ruby master Bug#17517] File.expand_path returns us-aascii when both arguments are ascii compat zn
2021-01-06 12:49 ` [ruby-core:101957] " jean.boussier
2021-01-07  4:39 ` [ruby-core:101969] [Ruby master Bug#17517] File.expand_path returns us-ascii " duerst
2021-01-12  0:50 ` [ruby-core:102006] " zn
2021-01-13 15:19 ` [ruby-core:102062] " nobu

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).