* [ruby-core:98563] [Ruby master Bug#16918] Dir.mktmpdir should yield a copy of the dir to protect cleanup
@ 2020-05-29 1:14 headius
2020-05-29 2:52 ` [ruby-core:98564] " merch-redmine
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: headius @ 2020-05-29 1:14 UTC (permalink / raw
To: ruby-core
Issue #16918 has been reported by headius (Charles Nutter).
----------------------------------------
Bug #16918: Dir.mktmpdir should yield a copy of the dir to protect cleanup
https://bugs.ruby-lang.org/issues/16918
* Author: headius (Charles Nutter)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin18]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
If you modify the dir string passed into the block from `Dir.mktmpdir`, the logic to clean up the temporary directory may fail:
```
$ rvm ruby-2.6.5 do ruby -rtmpdir -e "Dir.mktmpdir('foo') {|dir| dir << 'bar'}"
Traceback (most recent call last):
9: from -e:1:in `<main>'
8: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/tmpdir.rb:101:in `mktmpdir'
7: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:758:in `remove_entry'
6: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1480:in `postorder_traverse'
5: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:760:in `block in remove_entry'
4: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1425:in `remove'
3: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1436:in `remove_file'
2: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1442:in `platform_support'
1: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1437:in `block in remove_file'
/Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1437:in `unlink': No such file or directory @ apply2files - /var/folders/cq/ylcgmnn556x33f5hsqd0h54h0000gn/T/foo20200528-99594-tuq6pubar (Errno::ENOENT)
```
I believe `Dir.mktmpdir` should protect its cleanup logic by yielding a copy of the dir string, rather than the exact string object it intends to use for cleanup.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:98564] [Ruby master Bug#16918] Dir.mktmpdir should yield a copy of the dir to protect cleanup
2020-05-29 1:14 [ruby-core:98563] [Ruby master Bug#16918] Dir.mktmpdir should yield a copy of the dir to protect cleanup headius
@ 2020-05-29 2:52 ` merch-redmine
2020-05-29 4:59 ` [ruby-core:98566] " shevegen
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: merch-redmine @ 2020-05-29 2:52 UTC (permalink / raw
To: ruby-core
Issue #16918 has been updated by jeremyevans0 (Jeremy Evans).
Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN to 2.6: REQUIRED, 2.7: REQUIRED
I agree this is a bug and have added a pull request to fix it: https://github.com/ruby/ruby/pull/3159
----------------------------------------
Bug #16918: Dir.mktmpdir should yield a copy of the dir to protect cleanup
https://bugs.ruby-lang.org/issues/16918#change-85861
* Author: headius (Charles Nutter)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin18]
* Backport: 2.6: REQUIRED, 2.7: REQUIRED
----------------------------------------
If you modify the dir string passed into the block from `Dir.mktmpdir`, the logic to clean up the temporary directory may fail:
```
$ rvm ruby-2.6.5 do ruby -rtmpdir -e "Dir.mktmpdir('foo') {|dir| dir << 'bar'}"
Traceback (most recent call last):
9: from -e:1:in `<main>'
8: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/tmpdir.rb:101:in `mktmpdir'
7: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:758:in `remove_entry'
6: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1480:in `postorder_traverse'
5: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:760:in `block in remove_entry'
4: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1425:in `remove'
3: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1436:in `remove_file'
2: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1442:in `platform_support'
1: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1437:in `block in remove_file'
/Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1437:in `unlink': No such file or directory @ apply2files - /var/folders/cq/ylcgmnn556x33f5hsqd0h54h0000gn/T/foo20200528-99594-tuq6pubar (Errno::ENOENT)
```
I believe `Dir.mktmpdir` should protect its cleanup logic by yielding a copy of the dir string, rather than the exact string object it intends to use for cleanup.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:98566] [Ruby master Bug#16918] Dir.mktmpdir should yield a copy of the dir to protect cleanup
2020-05-29 1:14 [ruby-core:98563] [Ruby master Bug#16918] Dir.mktmpdir should yield a copy of the dir to protect cleanup headius
2020-05-29 2:52 ` [ruby-core:98564] " merch-redmine
@ 2020-05-29 4:59 ` shevegen
2020-07-23 2:16 ` [ruby-core:99283] " nagachika00
2021-03-02 11:38 ` [ruby-core:102711] " usa
3 siblings, 0 replies; 5+ messages in thread
From: shevegen @ 2020-05-29 4:59 UTC (permalink / raw
To: ruby-core
Issue #16918 has been updated by shevegen (Robert A. Heiler).
Makes sense to me what headius wrote, so if there are no side effects (I have too
little experience with Dir.mktmpdir myself) +1 to the suggestion from me.
----------------------------------------
Bug #16918: Dir.mktmpdir should yield a copy of the dir to protect cleanup
https://bugs.ruby-lang.org/issues/16918#change-85863
* Author: headius (Charles Nutter)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin18]
* Backport: 2.6: REQUIRED, 2.7: REQUIRED
----------------------------------------
If you modify the dir string passed into the block from `Dir.mktmpdir`, the logic to clean up the temporary directory may fail:
```
$ rvm ruby-2.6.5 do ruby -rtmpdir -e "Dir.mktmpdir('foo') {|dir| dir << 'bar'}"
Traceback (most recent call last):
9: from -e:1:in `<main>'
8: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/tmpdir.rb:101:in `mktmpdir'
7: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:758:in `remove_entry'
6: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1480:in `postorder_traverse'
5: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:760:in `block in remove_entry'
4: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1425:in `remove'
3: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1436:in `remove_file'
2: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1442:in `platform_support'
1: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1437:in `block in remove_file'
/Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1437:in `unlink': No such file or directory @ apply2files - /var/folders/cq/ylcgmnn556x33f5hsqd0h54h0000gn/T/foo20200528-99594-tuq6pubar (Errno::ENOENT)
```
I believe `Dir.mktmpdir` should protect its cleanup logic by yielding a copy of the dir string, rather than the exact string object it intends to use for cleanup.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:99283] [Ruby master Bug#16918] Dir.mktmpdir should yield a copy of the dir to protect cleanup
2020-05-29 1:14 [ruby-core:98563] [Ruby master Bug#16918] Dir.mktmpdir should yield a copy of the dir to protect cleanup headius
2020-05-29 2:52 ` [ruby-core:98564] " merch-redmine
2020-05-29 4:59 ` [ruby-core:98566] " shevegen
@ 2020-07-23 2:16 ` nagachika00
2021-03-02 11:38 ` [ruby-core:102711] " usa
3 siblings, 0 replies; 5+ messages in thread
From: nagachika00 @ 2020-07-23 2:16 UTC (permalink / raw
To: ruby-core
Issue #16918 has been updated by nagachika (Tomoyuki Chikanaga).
Backport changed from 2.6: REQUIRED, 2.7: REQUIRED to 2.6: REQUIRED, 2.7: DONE
ruby_2_7 13d2ab0d88bbf72ed310efaec6edc46dd96fdb4d merged revision(s) 2ecfb88ee50510955acd3ae9fc94a5f109e7f109.
----------------------------------------
Bug #16918: Dir.mktmpdir should yield a copy of the dir to protect cleanup
https://bugs.ruby-lang.org/issues/16918#change-86670
* Author: headius (Charles Nutter)
* Status: Closed
* Priority: Normal
* ruby -v: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin18]
* Backport: 2.6: REQUIRED, 2.7: DONE
----------------------------------------
If you modify the dir string passed into the block from `Dir.mktmpdir`, the logic to clean up the temporary directory may fail:
```
$ rvm ruby-2.6.5 do ruby -rtmpdir -e "Dir.mktmpdir('foo') {|dir| dir << 'bar'}"
Traceback (most recent call last):
9: from -e:1:in `<main>'
8: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/tmpdir.rb:101:in `mktmpdir'
7: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:758:in `remove_entry'
6: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1480:in `postorder_traverse'
5: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:760:in `block in remove_entry'
4: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1425:in `remove'
3: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1436:in `remove_file'
2: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1442:in `platform_support'
1: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1437:in `block in remove_file'
/Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1437:in `unlink': No such file or directory @ apply2files - /var/folders/cq/ylcgmnn556x33f5hsqd0h54h0000gn/T/foo20200528-99594-tuq6pubar (Errno::ENOENT)
```
I believe `Dir.mktmpdir` should protect its cleanup logic by yielding a copy of the dir string, rather than the exact string object it intends to use for cleanup.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:102711] [Ruby master Bug#16918] Dir.mktmpdir should yield a copy of the dir to protect cleanup
2020-05-29 1:14 [ruby-core:98563] [Ruby master Bug#16918] Dir.mktmpdir should yield a copy of the dir to protect cleanup headius
` (2 preceding siblings ...)
2020-07-23 2:16 ` [ruby-core:99283] " nagachika00
@ 2021-03-02 11:38 ` usa
3 siblings, 0 replies; 5+ messages in thread
From: usa @ 2021-03-02 11:38 UTC (permalink / raw
To: ruby-core
Issue #16918 has been updated by usa (Usaku NAKAMURA).
Backport changed from 2.6: REQUIRED, 2.7: DONE to 2.6: DONE, 2.7: DONE
backported into ruby_2_6 at r67910.
----------------------------------------
Bug #16918: Dir.mktmpdir should yield a copy of the dir to protect cleanup
https://bugs.ruby-lang.org/issues/16918#change-90705
* Author: headius (Charles Nutter)
* Status: Closed
* Priority: Normal
* ruby -v: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin18]
* Backport: 2.6: DONE, 2.7: DONE
----------------------------------------
If you modify the dir string passed into the block from `Dir.mktmpdir`, the logic to clean up the temporary directory may fail:
```
$ rvm ruby-2.6.5 do ruby -rtmpdir -e "Dir.mktmpdir('foo') {|dir| dir << 'bar'}"
Traceback (most recent call last):
9: from -e:1:in `<main>'
8: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/tmpdir.rb:101:in `mktmpdir'
7: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:758:in `remove_entry'
6: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1480:in `postorder_traverse'
5: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:760:in `block in remove_entry'
4: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1425:in `remove'
3: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1436:in `remove_file'
2: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1442:in `platform_support'
1: from /Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1437:in `block in remove_file'
/Users/headius/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/fileutils.rb:1437:in `unlink': No such file or directory @ apply2files - /var/folders/cq/ylcgmnn556x33f5hsqd0h54h0000gn/T/foo20200528-99594-tuq6pubar (Errno::ENOENT)
```
I believe `Dir.mktmpdir` should protect its cleanup logic by yielding a copy of the dir string, rather than the exact string object it intends to use for cleanup.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-03-02 11:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-29 1:14 [ruby-core:98563] [Ruby master Bug#16918] Dir.mktmpdir should yield a copy of the dir to protect cleanup headius
2020-05-29 2:52 ` [ruby-core:98564] " merch-redmine
2020-05-29 4:59 ` [ruby-core:98566] " shevegen
2020-07-23 2:16 ` [ruby-core:99283] " nagachika00
2021-03-02 11:38 ` [ruby-core:102711] " usa
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).