ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:115682] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir
@ 2023-12-10 18:16 zverok (Victor Shepelev) via ruby-core
  2023-12-10 23:56 ` [ruby-core:115683] " jeremyevans0 (Jeremy Evans) via ruby-core
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: zverok (Victor Shepelev) via ruby-core @ 2023-12-10 18:16 UTC (permalink / raw
  To: ruby-core; +Cc: zverok (Victor Shepelev)

Issue #20056 has been reported by zverok (Victor Shepelev).

----------------------------------------
Misc #20056: Dir#chdir inconsistency with Dir.chdir
https://bugs.ruby-lang.org/issues/20056

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Assignee: jeremyevans0 (Jeremy Evans)
----------------------------------------
I am not sure it is important; I just wanted to understand if this is intentional or accidental.

1. There is no block form for `Dir#chdir`, unlike `Dir.chdir` (the form that will return to the previous directory when the block is finished)
2. `Dir.chdir` returns `0`, while `Dir#chdir` returns `nil` (both seem to be not representing any particular internal value, just a hardcoded return value).






-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:115683] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir
  2023-12-10 18:16 [ruby-core:115682] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir zverok (Victor Shepelev) via ruby-core
@ 2023-12-10 23:56 ` jeremyevans0 (Jeremy Evans) via ruby-core
  2023-12-11  8:19 ` [ruby-core:115687] " zverok (Victor Shepelev) via ruby-core
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2023-12-10 23:56 UTC (permalink / raw
  To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)

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


zverok (Victor Shepelev) wrote:
> 1. There is no block form for `Dir#chdir`, unlike `Dir.chdir` (the form that will return to the previous directory when the block is finished)

`Dir#chdir` implicitly calls `Dir.chdir` or `Dir.fchdir` with the passed block, so the block form does work, but it apparently is not documented:

```ruby
p Dir.pwd
# => '/home/jeremy'

Dir.new('..').chdir{p Dir.pwd}
# => '/home'

p Dir.pwd
# => '/home/jeremy'
```

> 2. `Dir.chdir` returns `0`, while `Dir#chdir` returns `nil` (both seem to be not representing any particular internal value, just a hardcoded return value).

Return value being `nil` is expected.  I assume the only reason `Dir.chdir` returns `0` is backwards compatibility, as I highly doubt we would use `0` as the return value for success for new methods.

----------------------------------------
Misc #20056: Dir#chdir inconsistency with Dir.chdir
https://bugs.ruby-lang.org/issues/20056#change-105617

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Assignee: jeremyevans0 (Jeremy Evans)
----------------------------------------
I am not sure it is important; I just wanted to understand if this is intentional or accidental.

1. There is no block form for `Dir#chdir`, unlike `Dir.chdir` (the form that will return to the previous directory when the block is finished)
2. `Dir.chdir` returns `0`, while `Dir#chdir` returns `nil` (both seem to be not representing any particular internal value, just a hardcoded return value).






-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:115687] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir
  2023-12-10 18:16 [ruby-core:115682] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir zverok (Victor Shepelev) via ruby-core
  2023-12-10 23:56 ` [ruby-core:115683] " jeremyevans0 (Jeremy Evans) via ruby-core
@ 2023-12-11  8:19 ` zverok (Victor Shepelev) via ruby-core
  2023-12-11 20:31 ` [ruby-core:115697] " zverok (Victor Shepelev) via ruby-core
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: zverok (Victor Shepelev) via ruby-core @ 2023-12-11  8:19 UTC (permalink / raw
  To: ruby-core; +Cc: zverok (Victor Shepelev)

Issue #20056 has been updated by zverok (Victor Shepelev).

Status changed from Open to Closed

> Dir#chdir implicitly calls Dir.chdir or Dir.fchdir with the passed block, so the block form does work, but it apparently is not documented:

Ugh, indeed. My bad. Instead of checking manually, just looked in the code and didn't saw anything related to block passing— but now I understand.

I'll push a small docs adjustment in the evening into https://github.com/ruby/ruby/pull/9183 while fixing the review notes.

----------------------------------------
Misc #20056: Dir#chdir inconsistency with Dir.chdir
https://bugs.ruby-lang.org/issues/20056#change-105619

* Author: zverok (Victor Shepelev)
* Status: Closed
* Priority: Normal
* Assignee: jeremyevans0 (Jeremy Evans)
----------------------------------------
I am not sure it is important; I just wanted to understand if this is intentional or accidental.

1. There is no block form for `Dir#chdir`, unlike `Dir.chdir` (the form that will return to the previous directory when the block is finished)
2. `Dir.chdir` returns `0`, while `Dir#chdir` returns `nil` (both seem to be not representing any particular internal value, just a hardcoded return value).






-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:115697] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir
  2023-12-10 18:16 [ruby-core:115682] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir zverok (Victor Shepelev) via ruby-core
  2023-12-10 23:56 ` [ruby-core:115683] " jeremyevans0 (Jeremy Evans) via ruby-core
  2023-12-11  8:19 ` [ruby-core:115687] " zverok (Victor Shepelev) via ruby-core
@ 2023-12-11 20:31 ` zverok (Victor Shepelev) via ruby-core
  2023-12-11 20:53 ` [ruby-core:115699] " jeremyevans0 (Jeremy Evans) via ruby-core
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: zverok (Victor Shepelev) via ruby-core @ 2023-12-11 20:31 UTC (permalink / raw
  To: ruby-core; +Cc: zverok (Victor Shepelev)

Issue #20056 has been updated by zverok (Victor Shepelev).

Status changed from Closed to Open

Actually, I found _another_ inconsistency while writing docs. Not sure it is worth fixing, but still somewhat confusing:

```ruby
Dir.chdir('doc') do |*args|
  p args #=> ["doc"]
  "res"
end.tap { p _1 } #=> "res"

Dir.new('doc').chdir do |*args|
  p args #=> []
  "res"
end.tap { p _1 } #=> nil

Dir.fchdir(Dir.new('doc').fileno) do |*args|
  p args #=> []
  "res"
end.tap { p _1 } #=> "res"
```

The difference in args passing into a block might cause only mild confusion, but the fact that the `Dir#chdir` doesn't return the block result seems problematic.

Unless I am missing something again.

----------------------------------------
Misc #20056: Dir#chdir inconsistency with Dir.chdir
https://bugs.ruby-lang.org/issues/20056#change-105629

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Assignee: jeremyevans0 (Jeremy Evans)
----------------------------------------
I am not sure it is important; I just wanted to understand if this is intentional or accidental.

1. There is no block form for `Dir#chdir`, unlike `Dir.chdir` (the form that will return to the previous directory when the block is finished)
2. `Dir.chdir` returns `0`, while `Dir#chdir` returns `nil` (both seem to be not representing any particular internal value, just a hardcoded return value).






-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:115699] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir
  2023-12-10 18:16 [ruby-core:115682] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir zverok (Victor Shepelev) via ruby-core
                   ` (2 preceding siblings ...)
  2023-12-11 20:31 ` [ruby-core:115697] " zverok (Victor Shepelev) via ruby-core
@ 2023-12-11 20:53 ` jeremyevans0 (Jeremy Evans) via ruby-core
  2023-12-11 21:02 ` [ruby-core:115700] " zverok (Victor Shepelev) via ruby-core
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2023-12-11 20:53 UTC (permalink / raw
  To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)

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


Not passing an argument to the block in the Dir.fchdir or Dir#chdir case makes sense to me. A directory may not even know the path (e.g. `Dir.for_fd(dir_fd).chdir`), and yielding the file descriptor doesn't seem helpful (plus it isn't portable).

Note that whether the block is passed an argument in the Dir#chdir case depends on the platform.  If the platform supports fchdir, then no argument is passed, but if it does not support an argument, then the path is passed.  This isn't optimal, ideally no argument should passed in any case.  That will take a little refactoring.

----------------------------------------
Misc #20056: Dir#chdir inconsistency with Dir.chdir
https://bugs.ruby-lang.org/issues/20056#change-105631

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Assignee: jeremyevans0 (Jeremy Evans)
----------------------------------------
I am not sure it is important; I just wanted to understand if this is intentional or accidental.

1. There is no block form for `Dir#chdir`, unlike `Dir.chdir` (the form that will return to the previous directory when the block is finished)
2. `Dir.chdir` returns `0`, while `Dir#chdir` returns `nil` (both seem to be not representing any particular internal value, just a hardcoded return value).






-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:115700] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir
  2023-12-10 18:16 [ruby-core:115682] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir zverok (Victor Shepelev) via ruby-core
                   ` (3 preceding siblings ...)
  2023-12-11 20:53 ` [ruby-core:115699] " jeremyevans0 (Jeremy Evans) via ruby-core
@ 2023-12-11 21:02 ` zverok (Victor Shepelev) via ruby-core
  2023-12-11 22:09 ` [ruby-core:115703] " jeremyevans0 (Jeremy Evans) via ruby-core
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: zverok (Victor Shepelev) via ruby-core @ 2023-12-11 21:02 UTC (permalink / raw
  To: ruby-core; +Cc: zverok (Victor Shepelev)

Issue #20056 has been updated by zverok (Victor Shepelev).


> Not passing an argument to the block in the Dir.fchdir or Dir#chdir case makes sense to me.

Yup, I can see the reasoning, that's why I don't think it is a big problem. (I thought that may be passing `self`, i.e. an instance of `Dir` inside the block might be a good idea, but the implementation doesn't allow that.)

On the other hand, the return value of the block in `#chdir` case should be fixed, don't you think? I think this should do, probably...
```diff
dir_chdir(VALUE dir)
{
#if defined(HAVE_FCHDIR) && defined(HAVE_DIRFD) && HAVE_FCHDIR && HAVE_DIRFD
-    dir_s_fchdir(rb_cDir, dir_fileno(dir));
+    return dir_s_fchdir(rb_cDir, dir_fileno(dir));
#else
    VALUE path = dir_get(dir)->path;
-    dir_s_chdir(1, &path, rb_cDir);
+    return dir_s_chdir(1, &path, rb_cDir);
#endif
-
-    return Qnil;
}
```

----------------------------------------
Misc #20056: Dir#chdir inconsistency with Dir.chdir
https://bugs.ruby-lang.org/issues/20056#change-105632

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Assignee: jeremyevans0 (Jeremy Evans)
----------------------------------------
I am not sure it is important; I just wanted to understand if this is intentional or accidental.

1. There is no block form for `Dir#chdir`, unlike `Dir.chdir` (the form that will return to the previous directory when the block is finished)
2. `Dir.chdir` returns `0`, while `Dir#chdir` returns `nil` (both seem to be not representing any particular internal value, just a hardcoded return value).






-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:115703] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir
  2023-12-10 18:16 [ruby-core:115682] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir zverok (Victor Shepelev) via ruby-core
                   ` (4 preceding siblings ...)
  2023-12-11 21:02 ` [ruby-core:115700] " zverok (Victor Shepelev) via ruby-core
@ 2023-12-11 22:09 ` jeremyevans0 (Jeremy Evans) via ruby-core
  2023-12-11 22:14 ` [ruby-core:115704] " zverok (Victor Shepelev) via ruby-core
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2023-12-11 22:09 UTC (permalink / raw
  To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)

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


zverok (Victor Shepelev) wrote in #note-5:
> On the other hand, the return value of the block in `#chdir` case should be fixed, don't you think? I think this should do, probably...

That's more or less the same diff I came up with before I determined we need more refactoring so that Dir#chdir never yields an argument to the block.

----------------------------------------
Misc #20056: Dir#chdir inconsistency with Dir.chdir
https://bugs.ruby-lang.org/issues/20056#change-105634

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Assignee: jeremyevans0 (Jeremy Evans)
----------------------------------------
I am not sure it is important; I just wanted to understand if this is intentional or accidental.

1. There is no block form for `Dir#chdir`, unlike `Dir.chdir` (the form that will return to the previous directory when the block is finished)
2. `Dir.chdir` returns `0`, while `Dir#chdir` returns `nil` (both seem to be not representing any particular internal value, just a hardcoded return value).






-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:115704] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir
  2023-12-10 18:16 [ruby-core:115682] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir zverok (Victor Shepelev) via ruby-core
                   ` (5 preceding siblings ...)
  2023-12-11 22:09 ` [ruby-core:115703] " jeremyevans0 (Jeremy Evans) via ruby-core
@ 2023-12-11 22:14 ` zverok (Victor Shepelev) via ruby-core
  2023-12-11 22:18 ` [ruby-core:115705] " jeremyevans0 (Jeremy Evans) via ruby-core
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: zverok (Victor Shepelev) via ruby-core @ 2023-12-11 22:14 UTC (permalink / raw
  To: ruby-core; +Cc: zverok (Victor Shepelev)

Issue #20056 has been updated by zverok (Victor Shepelev).


> That's more or less the same diff I came up with before I determined we need more refactoring so that `Dir#chdir` never yields an argument to the block.

I provided the diff to solve return value problem for the **block form**. Which is not a _big_ problem, but still might be confusing:

```ruby
Dir.chdir('doc') do 
  # ...some more logic or calling other modules
  # ...which might do something like...
  Dir['*.md'].map { File.read(_1) }.join("\n\n")
end #=> what was calculated in the block

Dir.new('doc').chdir do 
  Dir['*.md'].map { File.read(_1) }.join("\n\n")
end #=> nil
```

This is simply fixed by `return`ing what the called method have returned, right? Whatever the implementation is chosen.

----------------------------------------
Misc #20056: Dir#chdir inconsistency with Dir.chdir
https://bugs.ruby-lang.org/issues/20056#change-105635

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Assignee: jeremyevans0 (Jeremy Evans)
----------------------------------------
I am not sure it is important; I just wanted to understand if this is intentional or accidental.

1. There is no block form for `Dir#chdir`, unlike `Dir.chdir` (the form that will return to the previous directory when the block is finished)
2. `Dir.chdir` returns `0`, while `Dir#chdir` returns `nil` (both seem to be not representing any particular internal value, just a hardcoded return value).






-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:115705] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir
  2023-12-10 18:16 [ruby-core:115682] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir zverok (Victor Shepelev) via ruby-core
                   ` (6 preceding siblings ...)
  2023-12-11 22:14 ` [ruby-core:115704] " zverok (Victor Shepelev) via ruby-core
@ 2023-12-11 22:18 ` jeremyevans0 (Jeremy Evans) via ruby-core
  2023-12-11 22:21 ` [ruby-core:115706] " zverok (Victor Shepelev) via ruby-core
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2023-12-11 22:18 UTC (permalink / raw
  To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)

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


zverok (Victor Shepelev) wrote in #note-7:
> This is simply fixed by `return`ing what the called method have returned, right? Whatever the implementation is chosen.

It's not that simple. It does fix the block return value, but doesn't fix the Dir#chdir block yielding the path if fchdir is not supported.  More refactoring is needed for that, you cannot just reuse the Dir.chdir code in that case, since that yields the path.

----------------------------------------
Misc #20056: Dir#chdir inconsistency with Dir.chdir
https://bugs.ruby-lang.org/issues/20056#change-105636

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Assignee: jeremyevans0 (Jeremy Evans)
----------------------------------------
I am not sure it is important; I just wanted to understand if this is intentional or accidental.

1. There is no block form for `Dir#chdir`, unlike `Dir.chdir` (the form that will return to the previous directory when the block is finished)
2. `Dir.chdir` returns `0`, while `Dir#chdir` returns `nil` (both seem to be not representing any particular internal value, just a hardcoded return value).






-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:115706] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir
  2023-12-10 18:16 [ruby-core:115682] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir zverok (Victor Shepelev) via ruby-core
                   ` (7 preceding siblings ...)
  2023-12-11 22:18 ` [ruby-core:115705] " jeremyevans0 (Jeremy Evans) via ruby-core
@ 2023-12-11 22:21 ` zverok (Victor Shepelev) via ruby-core
  2023-12-11 22:30 ` [ruby-core:115708] " jeremyevans0 (Jeremy Evans) via ruby-core
  2023-12-12  6:32 ` [ruby-core:115718] [Ruby master Bug#20056] " jeremyevans0 (Jeremy Evans) via ruby-core
  10 siblings, 0 replies; 12+ messages in thread
From: zverok (Victor Shepelev) via ruby-core @ 2023-12-11 22:21 UTC (permalink / raw
  To: ruby-core; +Cc: zverok (Victor Shepelev)

Issue #20056 has been updated by zverok (Victor Shepelev).


> It does fix the block return value, but doesn't fix the Dir#chdir block yielding the path if fchdir is not supported. 

I understand that. But for now, just fixing the return value (while ignoring args inconsistency) before 3.3 seems more reasonable than not fixing it?

Or do you plan the deeper refactoring soon? 

----------------------------------------
Misc #20056: Dir#chdir inconsistency with Dir.chdir
https://bugs.ruby-lang.org/issues/20056#change-105637

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Assignee: jeremyevans0 (Jeremy Evans)
----------------------------------------
I am not sure it is important; I just wanted to understand if this is intentional or accidental.

1. There is no block form for `Dir#chdir`, unlike `Dir.chdir` (the form that will return to the previous directory when the block is finished)
2. `Dir.chdir` returns `0`, while `Dir#chdir` returns `nil` (both seem to be not representing any particular internal value, just a hardcoded return value).






-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:115708] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir
  2023-12-10 18:16 [ruby-core:115682] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir zverok (Victor Shepelev) via ruby-core
                   ` (8 preceding siblings ...)
  2023-12-11 22:21 ` [ruby-core:115706] " zverok (Victor Shepelev) via ruby-core
@ 2023-12-11 22:30 ` jeremyevans0 (Jeremy Evans) via ruby-core
  2023-12-12  6:32 ` [ruby-core:115718] [Ruby master Bug#20056] " jeremyevans0 (Jeremy Evans) via ruby-core
  10 siblings, 0 replies; 12+ messages in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2023-12-11 22:30 UTC (permalink / raw
  To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)

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


zverok (Victor Shepelev) wrote in #note-9:
> Or do you plan the deeper refactoring soon?

Yes.  I'll work on a pull request tonight.  The refactoring necessary is not extensive.

----------------------------------------
Misc #20056: Dir#chdir inconsistency with Dir.chdir
https://bugs.ruby-lang.org/issues/20056#change-105639

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Assignee: jeremyevans0 (Jeremy Evans)
----------------------------------------
I am not sure it is important; I just wanted to understand if this is intentional or accidental.

1. There is no block form for `Dir#chdir`, unlike `Dir.chdir` (the form that will return to the previous directory when the block is finished)
2. `Dir.chdir` returns `0`, while `Dir#chdir` returns `nil` (both seem to be not representing any particular internal value, just a hardcoded return value).






-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:115718] [Ruby master Bug#20056] Dir#chdir inconsistency with Dir.chdir
  2023-12-10 18:16 [ruby-core:115682] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir zverok (Victor Shepelev) via ruby-core
                   ` (9 preceding siblings ...)
  2023-12-11 22:30 ` [ruby-core:115708] " jeremyevans0 (Jeremy Evans) via ruby-core
@ 2023-12-12  6:32 ` jeremyevans0 (Jeremy Evans) via ruby-core
  10 siblings, 0 replies; 12+ messages in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2023-12-12  6:32 UTC (permalink / raw
  To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)

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

Tracker changed from Misc to Bug
Status changed from Open to Closed
Backport set to 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN

Fixed by commit:f49af3c969eb7ba9937514a229b49e5b7d91f0f1 

----------------------------------------
Bug #20056: Dir#chdir inconsistency with Dir.chdir
https://bugs.ruby-lang.org/issues/20056#change-105647

* Author: zverok (Victor Shepelev)
* Status: Closed
* Priority: Normal
* Assignee: jeremyevans0 (Jeremy Evans)
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
I am not sure it is important; I just wanted to understand if this is intentional or accidental.

1. There is no block form for `Dir#chdir`, unlike `Dir.chdir` (the form that will return to the previous directory when the block is finished)
2. `Dir.chdir` returns `0`, while `Dir#chdir` returns `nil` (both seem to be not representing any particular internal value, just a hardcoded return value).






-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

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

end of thread, other threads:[~2023-12-12  6:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-10 18:16 [ruby-core:115682] [Ruby master Misc#20056] Dir#chdir inconsistency with Dir.chdir zverok (Victor Shepelev) via ruby-core
2023-12-10 23:56 ` [ruby-core:115683] " jeremyevans0 (Jeremy Evans) via ruby-core
2023-12-11  8:19 ` [ruby-core:115687] " zverok (Victor Shepelev) via ruby-core
2023-12-11 20:31 ` [ruby-core:115697] " zverok (Victor Shepelev) via ruby-core
2023-12-11 20:53 ` [ruby-core:115699] " jeremyevans0 (Jeremy Evans) via ruby-core
2023-12-11 21:02 ` [ruby-core:115700] " zverok (Victor Shepelev) via ruby-core
2023-12-11 22:09 ` [ruby-core:115703] " jeremyevans0 (Jeremy Evans) via ruby-core
2023-12-11 22:14 ` [ruby-core:115704] " zverok (Victor Shepelev) via ruby-core
2023-12-11 22:18 ` [ruby-core:115705] " jeremyevans0 (Jeremy Evans) via ruby-core
2023-12-11 22:21 ` [ruby-core:115706] " zverok (Victor Shepelev) via ruby-core
2023-12-11 22:30 ` [ruby-core:115708] " jeremyevans0 (Jeremy Evans) via ruby-core
2023-12-12  6:32 ` [ruby-core:115718] [Ruby master Bug#20056] " jeremyevans0 (Jeremy Evans) via ruby-core

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