ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:110737] [Ruby master Bug#19130] MRI failing when executing shell builtins with Errno::ENOENT
@ 2022-11-14  2:00 ifiht (Mikal R)
  2022-11-18  9:50 ` [ruby-core:110808] [Ruby master Bug#19130] MRI failing when executing shell builtin commands " mjrzasa
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: ifiht (Mikal R) @ 2022-11-14  2:00 UTC (permalink / raw)
  To: ruby-core

Issue #19130 has been reported by ifiht (Mikal R).

----------------------------------------
Bug #19130: MRI failing when executing shell builtins with Errno::ENOENT
https://bugs.ruby-lang.org/issues/19130

* Author: ifiht (Mikal R)
* Status: Open
* Priority: Normal
* ruby -v: 3.2.0
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
Sorry if this came up already, Google & Redmine came up blank but maybe I missed it. Bug was found on 3.0.0 but I tested on 3.2.0-preview1 and it's present on both.

Trying to execute any shell builtin commands from irb or script fails with `No such file or directory - <cmd> (Errno::ENOENT)`

```
└$ rvm list
 * ruby-3.0.0 [ x86_64 ]
=> ruby-3.2.0-preview1 [ x86_64 ]
```
MRI 3.0.0:
```
3.0.0 :001 > %x(type ls)
Traceback (most recent call last):
        5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
        4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
        3: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        2: from (irb):1:in `<main>'
        1: from (irb):1:in ``'
Errno::ENOENT (No such file or directory - type)
3.0.0 :002 > %x(cd /home/imbris)
Traceback (most recent call last):
        6: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
        5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
        4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        3: from (irb):1:in `<main>'
        2: from (irb):2:in `rescue in <main>'
        1: from (irb):2:in ``'
Errno::ENOENT (No such file or directory - cd)
3.0.0 :003 > exit
```
MRI 3.2.0:
```
:001 > %x(type ls)
(irb):1:in ``': No such file or directory - type (Errno::ENOENT)
        from (irb):1:in `<main>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
 :002 > `type ls`
(irb):2:in ``': No such file or directory - type (Errno::ENOENT)
        from (irb):2:in `<main>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
```

Assuming this is a bug? Let me know if shell builtins are deliberately excluded for some reason, I'll try to work around it.



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

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

* [ruby-core:110808] [Ruby master Bug#19130] MRI failing when executing shell builtin commands with Errno::ENOENT
  2022-11-14  2:00 [ruby-core:110737] [Ruby master Bug#19130] MRI failing when executing shell builtins with Errno::ENOENT ifiht (Mikal R)
@ 2022-11-18  9:50 ` mjrzasa
  2022-11-18  9:50 ` [ruby-core:110809] " mjrzasa
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mjrzasa @ 2022-11-18  9:50 UTC (permalink / raw)
  To: ruby-core

Issue #19130 has been updated by mjrzasa (Maciek Rząsa).


ifiht (Mikal R) wrote:
> Sorry if this came up already, Google & Redmine came up blank but maybe I missed it. Bug was found on 3.0.0 but I tested on 3.2.0-preview1 and it's present on both.
> 
> Trying to execute any shell builtin commands from irb or script fails with `No such file or directory - <cmd> (Errno::ENOENT)`
> 
> ```
> └$ rvm list
>  * ruby-3.0.0 [ x86_64 ]
> => ruby-3.2.0-preview1 [ x86_64 ]
> ```
> MRI 3.0.0:
> ```
> 3.0.0 :001 > %x(type ls)
> Traceback (most recent call last):
>         5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
>         4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
>         3: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
>         2: from (irb):1:in `<main>'
>         1: from (irb):1:in ``'
> Errno::ENOENT (No such file or directory - type)
> 3.0.0 :002 > %x(cd /home/ifiht)
> Traceback (most recent call last):
>         6: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
>         5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
>         4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
>         3: from (irb):1:in `<main>'
>         2: from (irb):2:in `rescue in <main>'
>         1: from (irb):2:in ``'
> Errno::ENOENT (No such file or directory - cd)
> 3.0.0 :003 > exit
> ```
> MRI 3.2.0:
> ```
> :001 > %x(type ls)
> (irb):1:in ``': No such file or directory - type (Errno::ENOENT)
>         from (irb):1:in `<main>'
>         from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
>         from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
>         from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
>  :002 > `type ls`
> (irb):2:in ``': No such file or directory - type (Errno::ENOENT)
>         from (irb):2:in `<main>'
>         from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
>         from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
>         from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
> ```
> 
> Assuming this is a bug? Let me know if shell builtins are deliberately excluded for some reason, I'll try to work around it.

a

----------------------------------------
Bug #19130: MRI failing when executing shell builtin commands with Errno::ENOENT
https://bugs.ruby-lang.org/issues/19130#change-100166

* Author: ifiht (Mikal R)
* Status: Open
* Priority: Normal
* ruby -v: 3.2.0
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
Sorry if this came up already, Google & Redmine came up blank but maybe I missed it. Bug was found on 3.0.0 but I tested on 3.2.0-preview1 and it's present on both.

Trying to execute any shell builtin commands from irb or script fails with `No such file or directory - <cmd> (Errno::ENOENT)`

```
└$ rvm list
 * ruby-3.0.0 [ x86_64 ]
=> ruby-3.2.0-preview1 [ x86_64 ]
```
MRI 3.0.0:
```
3.0.0 :001 > %x(type ls)
Traceback (most recent call last):
        5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
        4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
        3: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        2: from (irb):1:in `<main>'
        1: from (irb):1:in ``'
Errno::ENOENT (No such file or directory - type)
3.0.0 :002 > %x(cd /home/ifiht)
Traceback (most recent call last):
        6: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
        5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
        4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        3: from (irb):1:in `<main>'
        2: from (irb):2:in `rescue in <main>'
        1: from (irb):2:in ``'
Errno::ENOENT (No such file or directory - cd)
3.0.0 :003 > exit
```
MRI 3.2.0:
```
:001 > %x(type ls)
(irb):1:in ``': No such file or directory - type (Errno::ENOENT)
        from (irb):1:in `<main>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
 :002 > `type ls`
(irb):2:in ``': No such file or directory - type (Errno::ENOENT)
        from (irb):2:in `<main>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
```

Assuming this is a bug? Let me know if shell builtins are deliberately excluded for some reason, I'll try to work around it.



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

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

* [ruby-core:110809] [Ruby master Bug#19130] MRI failing when executing shell builtin commands with Errno::ENOENT
  2022-11-14  2:00 [ruby-core:110737] [Ruby master Bug#19130] MRI failing when executing shell builtins with Errno::ENOENT ifiht (Mikal R)
  2022-11-18  9:50 ` [ruby-core:110808] [Ruby master Bug#19130] MRI failing when executing shell builtin commands " mjrzasa
@ 2022-11-18  9:50 ` mjrzasa
  2022-11-18  9:53 ` [ruby-core:110810] " mjrzasa
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mjrzasa @ 2022-11-18  9:50 UTC (permalink / raw)
  To: ruby-core

Issue #19130 has been updated by mjrzasa (Maciek Rząsa).


a

----------------------------------------
Bug #19130: MRI failing when executing shell builtin commands with Errno::ENOENT
https://bugs.ruby-lang.org/issues/19130#change-100167

* Author: ifiht (Mikal R)
* Status: Open
* Priority: Normal
* ruby -v: 3.2.0
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
Sorry if this came up already, Google & Redmine came up blank but maybe I missed it. Bug was found on 3.0.0 but I tested on 3.2.0-preview1 and it's present on both.

Trying to execute any shell builtin commands from irb or script fails with `No such file or directory - <cmd> (Errno::ENOENT)`

```
└$ rvm list
 * ruby-3.0.0 [ x86_64 ]
=> ruby-3.2.0-preview1 [ x86_64 ]
```
MRI 3.0.0:
```
3.0.0 :001 > %x(type ls)
Traceback (most recent call last):
        5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
        4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
        3: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        2: from (irb):1:in `<main>'
        1: from (irb):1:in ``'
Errno::ENOENT (No such file or directory - type)
3.0.0 :002 > %x(cd /home/ifiht)
Traceback (most recent call last):
        6: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
        5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
        4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        3: from (irb):1:in `<main>'
        2: from (irb):2:in `rescue in <main>'
        1: from (irb):2:in ``'
Errno::ENOENT (No such file or directory - cd)
3.0.0 :003 > exit
```
MRI 3.2.0:
```
:001 > %x(type ls)
(irb):1:in ``': No such file or directory - type (Errno::ENOENT)
        from (irb):1:in `<main>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
 :002 > `type ls`
(irb):2:in ``': No such file or directory - type (Errno::ENOENT)
        from (irb):2:in `<main>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
```

Assuming this is a bug? Let me know if shell builtins are deliberately excluded for some reason, I'll try to work around it.



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

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

* [ruby-core:110810] [Ruby master Bug#19130] MRI failing when executing shell builtin commands with Errno::ENOENT
  2022-11-14  2:00 [ruby-core:110737] [Ruby master Bug#19130] MRI failing when executing shell builtins with Errno::ENOENT ifiht (Mikal R)
  2022-11-18  9:50 ` [ruby-core:110808] [Ruby master Bug#19130] MRI failing when executing shell builtin commands " mjrzasa
  2022-11-18  9:50 ` [ruby-core:110809] " mjrzasa
@ 2022-11-18  9:53 ` mjrzasa
  2022-11-19 22:45 ` [ruby-core:110821] " ifiht (Mikal R)
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mjrzasa @ 2022-11-18  9:53 UTC (permalink / raw)
  To: ruby-core

Issue #19130 has been updated by mjrzasa (Maciek Rząsa).


I've reproduced it on MRI 2.7.0, but not for all built-ins, just ones that are Bash-specific as per these lists:
* https://www.gnu.org/software/bash/manual/html_node/Bourne-Shell-Builtins.html (these work)
* https://www.gnu.org/software/bash/manual/html_node/Bash-Builtins.html (these fail)

```
[3] pry(main)> %x(type ls)
Errno::ENOENT: No such file or directory - type
from (pry):3:in ``'
[4] pry(main)> %x(pwd)
=> "/home/mrzasa\n"
[5] pry(main)> %x(return)
=> ""
[6] pry(main)> %x(alias)
Errno::ENOENT: No such file or directory - alias
from (pry):6:in ``'

```

----------------------------------------
Bug #19130: MRI failing when executing shell builtin commands with Errno::ENOENT
https://bugs.ruby-lang.org/issues/19130#change-100168

* Author: ifiht (Mikal R)
* Status: Open
* Priority: Normal
* ruby -v: 3.2.0
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
Sorry if this came up already, Google & Redmine came up blank but maybe I missed it. Bug was found on 3.0.0 but I tested on 3.2.0-preview1 and it's present on both.

Trying to execute any shell builtin commands from irb or script fails with `No such file or directory - <cmd> (Errno::ENOENT)`

```
└$ rvm list
 * ruby-3.0.0 [ x86_64 ]
=> ruby-3.2.0-preview1 [ x86_64 ]
```
MRI 3.0.0:
```
3.0.0 :001 > %x(type ls)
Traceback (most recent call last):
        5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
        4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
        3: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        2: from (irb):1:in `<main>'
        1: from (irb):1:in ``'
Errno::ENOENT (No such file or directory - type)
3.0.0 :002 > %x(cd /home/ifiht)
Traceback (most recent call last):
        6: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
        5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
        4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        3: from (irb):1:in `<main>'
        2: from (irb):2:in `rescue in <main>'
        1: from (irb):2:in ``'
Errno::ENOENT (No such file or directory - cd)
3.0.0 :003 > exit
```
MRI 3.2.0:
```
:001 > %x(type ls)
(irb):1:in ``': No such file or directory - type (Errno::ENOENT)
        from (irb):1:in `<main>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
 :002 > `type ls`
(irb):2:in ``': No such file or directory - type (Errno::ENOENT)
        from (irb):2:in `<main>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
```

Assuming this is a bug? Let me know if shell builtins are deliberately excluded for some reason, I'll try to work around it.



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

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

* [ruby-core:110821] [Ruby master Bug#19130] MRI failing when executing shell builtin commands with Errno::ENOENT
  2022-11-14  2:00 [ruby-core:110737] [Ruby master Bug#19130] MRI failing when executing shell builtins with Errno::ENOENT ifiht (Mikal R)
                   ` (2 preceding siblings ...)
  2022-11-18  9:53 ` [ruby-core:110810] " mjrzasa
@ 2022-11-19 22:45 ` ifiht (Mikal R)
  2022-11-19 23:07 ` [ruby-core:110822] " jeremyevans0 (Jeremy Evans)
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ifiht (Mikal R) @ 2022-11-19 22:45 UTC (permalink / raw)
  To: ruby-core

Issue #19130 has been updated by ifiht (Mikal R).


Is there a ruby-specific list then of what gets implemented? Seems like `type` is both included in the POSIX spec (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/type.html) and the Bourne Shell, but not Ruby:
```
└$ /bin/sh -c "type type"
type is a shell builtin
```

mjrzasa (Maciek Rząsa) wrote in #note-2:
> I've reproduced it on MRI 2.7.0, but not for all built-ins, just ones that are Bash-specific as per these lists:
> * https://www.gnu.org/software/bash/manual/html_node/Bourne-Shell-Builtins.html (these work)
> * https://www.gnu.org/software/bash/manual/html_node/Bash-Builtins.html (these fail)
> 
> ```
> [3] pry(main)> %x(type ls)
> Errno::ENOENT: No such file or directory - type
> from (pry):3:in ``'
> [4] pry(main)> %x(pwd)
> => "/home/mrzasa\n"
> [5] pry(main)> %x(return)
> => ""
> [6] pry(main)> %x(alias)
> Errno::ENOENT: No such file or directory - alias
> from (pry):6:in ``'
> 
> ```



----------------------------------------
Bug #19130: MRI failing when executing shell builtin commands with Errno::ENOENT
https://bugs.ruby-lang.org/issues/19130#change-100178

* Author: ifiht (Mikal R)
* Status: Open
* Priority: Normal
* ruby -v: 3.2.0
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
Sorry if this came up already, Google & Redmine came up blank but maybe I missed it. Bug was found on 3.0.0 but I tested on 3.2.0-preview1 and it's present on both.

Trying to execute any shell builtin commands from irb or script fails with `No such file or directory - <cmd> (Errno::ENOENT)`

```
└$ rvm list
 * ruby-3.0.0 [ x86_64 ]
=> ruby-3.2.0-preview1 [ x86_64 ]
```
MRI 3.0.0:
```
3.0.0 :001 > %x(type ls)
Traceback (most recent call last):
        5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
        4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
        3: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        2: from (irb):1:in `<main>'
        1: from (irb):1:in ``'
Errno::ENOENT (No such file or directory - type)
3.0.0 :002 > %x(cd /home/ifiht)
Traceback (most recent call last):
        6: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
        5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
        4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        3: from (irb):1:in `<main>'
        2: from (irb):2:in `rescue in <main>'
        1: from (irb):2:in ``'
Errno::ENOENT (No such file or directory - cd)
3.0.0 :003 > exit
```
MRI 3.2.0:
```
:001 > %x(type ls)
(irb):1:in ``': No such file or directory - type (Errno::ENOENT)
        from (irb):1:in `<main>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
 :002 > `type ls`
(irb):2:in ``': No such file or directory - type (Errno::ENOENT)
        from (irb):2:in `<main>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
```

Assuming this is a bug? Let me know if shell builtins are deliberately excluded for some reason, I'll try to work around it.



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

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

* [ruby-core:110822] [Ruby master Bug#19130] MRI failing when executing shell builtin commands with Errno::ENOENT
  2022-11-14  2:00 [ruby-core:110737] [Ruby master Bug#19130] MRI failing when executing shell builtins with Errno::ENOENT ifiht (Mikal R)
                   ` (3 preceding siblings ...)
  2022-11-19 22:45 ` [ruby-core:110821] " ifiht (Mikal R)
@ 2022-11-19 23:07 ` jeremyevans0 (Jeremy Evans)
  2022-11-21 15:24 ` [ruby-core:110839] " nobu (Nobuyoshi Nakada)
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jeremyevans0 (Jeremy Evans) @ 2022-11-19 23:07 UTC (permalink / raw)
  To: ruby-core

Issue #19130 has been updated by jeremyevans0 (Jeremy Evans).


I don't think this is a bug.  Ruby's behavior for the Kernel backtick method (what `%x` uses) is that a shell is only used if Ruby thinks it is necessary.  If Ruby doesn't determine the use of a shell is necessary, it will directly execute the program instead of using a shell.  Here's an example showing the behavior:

```
# Simple command line that Ruby doesn't use a shell for
$ ruby -e 'puts %x{ps al}.split("\n").grep(/#{$$}/)'
 1000 54241 42309   3   2   0 61228 15220 kqread  S+     pi    0:00.14 ruby -e puts %x{ps al}.split("\\n").grep(/#{$$}/) (ruby31)
 1000 24047 54241   3  31   0   736   756 -       R+pU/0 pi    0:00.00 ps -al

# Command line including pipe, which Ruby does use a shell for
$ ruby -e 'puts %x{ps al | grep #{$$}}'
 1000 37783 42309   3   2   0 61228 15224 kqread  S+     pi    0:00.14 ruby -e puts %x{ps al | grep #{$$}} (ruby31)
 1000 95607 37783   3  18   0   872   880 sigsusp S+p    pi    0:00.01 sh -c ps al | grep 37783
 1000 47178 95607   3  31   0   172   460 -       R+/2   pi    0:00.00 grep 37783
```

If you want to force the use of a shell when would not be used, you need to manually execute the shell:

```ruby
%x{sh -c "type type"}
# => "type is a shell builtin\n"
```

----------------------------------------
Bug #19130: MRI failing when executing shell builtin commands with Errno::ENOENT
https://bugs.ruby-lang.org/issues/19130#change-100179

* Author: ifiht (Mikal R)
* Status: Open
* Priority: Normal
* ruby -v: 3.2.0
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
Sorry if this came up already, Google & Redmine came up blank but maybe I missed it. Bug was found on 3.0.0 but I tested on 3.2.0-preview1 and it's present on both.

Trying to execute any shell builtin commands from irb or script fails with `No such file or directory - <cmd> (Errno::ENOENT)`

```
└$ rvm list
 * ruby-3.0.0 [ x86_64 ]
=> ruby-3.2.0-preview1 [ x86_64 ]
```
MRI 3.0.0:
```
3.0.0 :001 > %x(type ls)
Traceback (most recent call last):
        5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
        4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
        3: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        2: from (irb):1:in `<main>'
        1: from (irb):1:in ``'
Errno::ENOENT (No such file or directory - type)
3.0.0 :002 > %x(cd /home/ifiht)
Traceback (most recent call last):
        6: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
        5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
        4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        3: from (irb):1:in `<main>'
        2: from (irb):2:in `rescue in <main>'
        1: from (irb):2:in ``'
Errno::ENOENT (No such file or directory - cd)
3.0.0 :003 > exit
```
MRI 3.2.0:
```
:001 > %x(type ls)
(irb):1:in ``': No such file or directory - type (Errno::ENOENT)
        from (irb):1:in `<main>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
 :002 > `type ls`
(irb):2:in ``': No such file or directory - type (Errno::ENOENT)
        from (irb):2:in `<main>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
```

Assuming this is a bug? Let me know if shell builtins are deliberately excluded for some reason, I'll try to work around it.



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

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

* [ruby-core:110839] [Ruby master Bug#19130] MRI failing when executing shell builtin commands with Errno::ENOENT
  2022-11-14  2:00 [ruby-core:110737] [Ruby master Bug#19130] MRI failing when executing shell builtins with Errno::ENOENT ifiht (Mikal R)
                   ` (4 preceding siblings ...)
  2022-11-19 23:07 ` [ruby-core:110822] " jeremyevans0 (Jeremy Evans)
@ 2022-11-21 15:24 ` nobu (Nobuyoshi Nakada)
  2022-11-21 15:31 ` [ruby-core:110840] " nobu (Nobuyoshi Nakada)
  2022-11-24 23:34 ` [ruby-core:110884] " jeremyevans0 (Jeremy Evans)
  7 siblings, 0 replies; 9+ messages in thread
From: nobu (Nobuyoshi Nakada) @ 2022-11-21 15:24 UTC (permalink / raw)
  To: ruby-core

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


ifiht (Mikal R) wrote in #note-3:
> Is there a ruby-specific list then of what gets implemented? Seems like `type` is both included in the POSIX spec (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/type.html) and the Bourne Shell, but not Ruby:

The list in Ruby is based on http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html,
and may be pretty out of date.

jeremyevans0 (Jeremy Evans) wrote in #note-4:
> If you want to force the use of a shell when would not be used, you need to manually execute the shell:
> 
> ```ruby
> %x{sh -c "type type"}
> # => "type is a shell builtin\n"
> ```

Or include a semicolon:

```ruby
%x{type type;}
```

----------------------------------------
Bug #19130: MRI failing when executing shell builtin commands with Errno::ENOENT
https://bugs.ruby-lang.org/issues/19130#change-100194

* Author: ifiht (Mikal R)
* Status: Open
* Priority: Normal
* ruby -v: 3.2.0
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
Sorry if this came up already, Google & Redmine came up blank but maybe I missed it. Bug was found on 3.0.0 but I tested on 3.2.0-preview1 and it's present on both.

Trying to execute any shell builtin commands from irb or script fails with `No such file or directory - <cmd> (Errno::ENOENT)`

```
└$ rvm list
 * ruby-3.0.0 [ x86_64 ]
=> ruby-3.2.0-preview1 [ x86_64 ]
```
MRI 3.0.0:
```
3.0.0 :001 > %x(type ls)
Traceback (most recent call last):
        5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
        4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
        3: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        2: from (irb):1:in `<main>'
        1: from (irb):1:in ``'
Errno::ENOENT (No such file or directory - type)
3.0.0 :002 > %x(cd /home/ifiht)
Traceback (most recent call last):
        6: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
        5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
        4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        3: from (irb):1:in `<main>'
        2: from (irb):2:in `rescue in <main>'
        1: from (irb):2:in ``'
Errno::ENOENT (No such file or directory - cd)
3.0.0 :003 > exit
```
MRI 3.2.0:
```
:001 > %x(type ls)
(irb):1:in ``': No such file or directory - type (Errno::ENOENT)
        from (irb):1:in `<main>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
 :002 > `type ls`
(irb):2:in ``': No such file or directory - type (Errno::ENOENT)
        from (irb):2:in `<main>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
```

Assuming this is a bug? Let me know if shell builtins are deliberately excluded for some reason, I'll try to work around it.



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

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

* [ruby-core:110840] [Ruby master Bug#19130] MRI failing when executing shell builtin commands with Errno::ENOENT
  2022-11-14  2:00 [ruby-core:110737] [Ruby master Bug#19130] MRI failing when executing shell builtins with Errno::ENOENT ifiht (Mikal R)
                   ` (5 preceding siblings ...)
  2022-11-21 15:24 ` [ruby-core:110839] " nobu (Nobuyoshi Nakada)
@ 2022-11-21 15:31 ` nobu (Nobuyoshi Nakada)
  2022-11-24 23:34 ` [ruby-core:110884] " jeremyevans0 (Jeremy Evans)
  7 siblings, 0 replies; 9+ messages in thread
From: nobu (Nobuyoshi Nakada) @ 2022-11-21 15:31 UTC (permalink / raw)
  To: ruby-core

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


nobu (Nobuyoshi Nakada) wrote in #note-5:
> The list in Ruby is based on http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html,
> and may be pretty out of date.

FYI, this list is here: https://github.com/ruby/ruby/blob/50c6cab/process.c#L2659-L2689

----------------------------------------
Bug #19130: MRI failing when executing shell builtin commands with Errno::ENOENT
https://bugs.ruby-lang.org/issues/19130#change-100195

* Author: ifiht (Mikal R)
* Status: Open
* Priority: Normal
* ruby -v: 3.2.0
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
Sorry if this came up already, Google & Redmine came up blank but maybe I missed it. Bug was found on 3.0.0 but I tested on 3.2.0-preview1 and it's present on both.

Trying to execute any shell builtin commands from irb or script fails with `No such file or directory - <cmd> (Errno::ENOENT)`

```
└$ rvm list
 * ruby-3.0.0 [ x86_64 ]
=> ruby-3.2.0-preview1 [ x86_64 ]
```
MRI 3.0.0:
```
3.0.0 :001 > %x(type ls)
Traceback (most recent call last):
        5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
        4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
        3: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        2: from (irb):1:in `<main>'
        1: from (irb):1:in ``'
Errno::ENOENT (No such file or directory - type)
3.0.0 :002 > %x(cd /home/ifiht)
Traceback (most recent call last):
        6: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
        5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
        4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        3: from (irb):1:in `<main>'
        2: from (irb):2:in `rescue in <main>'
        1: from (irb):2:in ``'
Errno::ENOENT (No such file or directory - cd)
3.0.0 :003 > exit
```
MRI 3.2.0:
```
:001 > %x(type ls)
(irb):1:in ``': No such file or directory - type (Errno::ENOENT)
        from (irb):1:in `<main>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
 :002 > `type ls`
(irb):2:in ``': No such file or directory - type (Errno::ENOENT)
        from (irb):2:in `<main>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
```

Assuming this is a bug? Let me know if shell builtins are deliberately excluded for some reason, I'll try to work around it.



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

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

* [ruby-core:110884] [Ruby master Bug#19130] MRI failing when executing shell builtin commands with Errno::ENOENT
  2022-11-14  2:00 [ruby-core:110737] [Ruby master Bug#19130] MRI failing when executing shell builtins with Errno::ENOENT ifiht (Mikal R)
                   ` (6 preceding siblings ...)
  2022-11-21 15:31 ` [ruby-core:110840] " nobu (Nobuyoshi Nakada)
@ 2022-11-24 23:34 ` jeremyevans0 (Jeremy Evans)
  7 siblings, 0 replies; 9+ messages in thread
From: jeremyevans0 (Jeremy Evans) @ 2022-11-24 23:34 UTC (permalink / raw)
  To: ruby-core

Issue #19130 has been updated by jeremyevans0 (Jeremy Evans).

Status changed from Open to Closed

Closing as this behavior is by design and not a bug.

----------------------------------------
Bug #19130: MRI failing when executing shell builtin commands with Errno::ENOENT
https://bugs.ruby-lang.org/issues/19130#change-100247

* Author: ifiht (Mikal R)
* Status: Closed
* Priority: Normal
* ruby -v: 3.2.0
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
Sorry if this came up already, Google & Redmine came up blank but maybe I missed it. Bug was found on 3.0.0 but I tested on 3.2.0-preview1 and it's present on both.

Trying to execute any shell builtin commands from irb or script fails with `No such file or directory - <cmd> (Errno::ENOENT)`

```
└$ rvm list
 * ruby-3.0.0 [ x86_64 ]
=> ruby-3.2.0-preview1 [ x86_64 ]
```
MRI 3.0.0:
```
3.0.0 :001 > %x(type ls)
Traceback (most recent call last):
        5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
        4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
        3: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        2: from (irb):1:in `<main>'
        1: from (irb):1:in ``'
Errno::ENOENT (No such file or directory - type)
3.0.0 :002 > %x(cd /home/ifiht)
Traceback (most recent call last):
        6: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
        5: from /home/ifiht/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
        4: from /home/ifiht/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        3: from (irb):1:in `<main>'
        2: from (irb):2:in `rescue in <main>'
        1: from (irb):2:in ``'
Errno::ENOENT (No such file or directory - cd)
3.0.0 :003 > exit
```
MRI 3.2.0:
```
:001 > %x(type ls)
(irb):1:in ``': No such file or directory - type (Errno::ENOENT)
        from (irb):1:in `<main>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
 :002 > `type ls`
(irb):2:in ``': No such file or directory - type (Errno::ENOENT)
        from (irb):2:in `<main>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/lib/ruby/gems/3.2.0+1/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `load'
        from /home/ifiht/.rvm/rubies/ruby-3.2.0-preview1/bin/irb:25:in `<main>'
```

Assuming this is a bug? Let me know if shell builtins are deliberately excluded for some reason, I'll try to work around it.



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

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

end of thread, other threads:[~2022-11-24 23:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-14  2:00 [ruby-core:110737] [Ruby master Bug#19130] MRI failing when executing shell builtins with Errno::ENOENT ifiht (Mikal R)
2022-11-18  9:50 ` [ruby-core:110808] [Ruby master Bug#19130] MRI failing when executing shell builtin commands " mjrzasa
2022-11-18  9:50 ` [ruby-core:110809] " mjrzasa
2022-11-18  9:53 ` [ruby-core:110810] " mjrzasa
2022-11-19 22:45 ` [ruby-core:110821] " ifiht (Mikal R)
2022-11-19 23:07 ` [ruby-core:110822] " jeremyevans0 (Jeremy Evans)
2022-11-21 15:24 ` [ruby-core:110839] " nobu (Nobuyoshi Nakada)
2022-11-21 15:31 ` [ruby-core:110840] " nobu (Nobuyoshi Nakada)
2022-11-24 23:34 ` [ruby-core:110884] " jeremyevans0 (Jeremy Evans)

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