aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tmpdir.rb
Commit message (Collapse)AuthorAgeFilesLines
* [ruby/tmpdir] [Bug #18933] Make `Dir.mktmpdir` Ractor-safeNobuyoshi Nakada2023-07-031-5/+11
| | | | | | Fix https://bugs.ruby-lang.org/issues/18933 https://github.com/ruby/tmpdir/commit/446e636434
* [ruby/tmpdir] Ignore empty environment variablesNobuyoshi Nakada2022-10-251-2/+4
| | | | | | Fixes https://github.com/ruby/tmpdir/pull/17 https://github.com/ruby/tmpdir/commit/a79c727a5d
* [ruby/tmpdir] Found or raise Nobuyoshi Nakada2022-10-251-4/+2
|
* [ruby/tmpdir] Make `Dir.tmpdir` more idiomatic and functionalPeter Vandenberk2022-10-251-4/+2
| | | | | | | | | | Use `Enumerable#find` to iterate over the candidates, not `Enumerable.each`. (this makes the code more functional, and - IMO - slightly more idiomatic, as it avoids setting the "global" (by which I mean: non-local) `tmp` variable from inside the block) https://github.com/ruby/tmpdir/commit/d1f20ad694
* [ruby/tmpdir] Fix typo Nobuyoshi Nakada2022-10-251-1/+1
|
* [ruby/tmpdir] [DOC] Improve documentationNobuyoshi Nakada2022-10-251-1/+9
| | | | https://github.com/ruby/tmpdir/commit/b9c880f2b6
* [ruby/tmpdir] [DOC] Fix syntax in example code [ci skip]Nobuyoshi Nakada2021-11-111-2/+2
| | | | | | RDoc expects example code to be valid syntax. https://github.com/ruby/tmpdir/commit/ee42540ebb
* [ruby/tmpdir] Make usable chars more strictNobuyoshi Nakada2021-04-051-1/+1
| | | | | | | | | Remove other than alphanumeric and some punctuations considered filesystem-safe, instead of removing some unsafe chars only. https://hackerone.com/reports/1131465 https://github.com/ruby/tmpdir/commit/adf294bc2d
* [ruby/tmpdir] Warn when environment variables skipped (fixes #2)Nobuyoshi Nakada2020-09-141-4/+11
| | | | https://github.com/ruby/tmpdir/commit/af7b020a89
* Correctly remove temporary directory if path yielded is mutatedJeremy Evans2020-05-291-1/+1
| | | | | | | Another approach would be to freeze the string, but that could cause backwards compatibility issues. Fixes [Bug #16918]
* Isolate the PRNG for tmpdir/tempfileNobuyoshi Nakada2020-01-291-1/+9
| | | | To get rid of conflicts affected by `srand`.
* Warn on access/modify of $SAFE, and remove effects of modifying $SAFEJeremy Evans2019-11-181-21/+13
| | | | | | | | | | | | | | | | | This removes the security features added by $SAFE = 1, and warns for access or modification of $SAFE from Ruby-level, as well as warning when calling all public C functions related to $SAFE. This modifies some internal functions that took a safe level argument to no longer take the argument. rb_require_safe now warns, rb_require_string has been added as a version that takes a VALUE and does not warn. One public C function that still takes a safe level argument and that this doesn't warn for is rb_eval_cmd. We may want to consider adding an alternative method that does not take a safe level argument, and warn for rb_eval_cmd.
* Fix keyword argument separation issues in libJeremy Evans2019-08-301-2/+2
| | | | Mostly requires adding ** in either calls or method definitions.
* Constified unusable charsNobuyoshi Nakada2019-06-211-2/+4
|
* tmpdir.rb: permission of user given directorynobu2019-01-231-5/+12
| | | | | | | | | | * lib/tmpdir.rb (Dir.mktmpdir): check if the permission of the parent directory only when using the default temporary directory, and no check against user given directory. the security is the user's responsibility in that case. [ruby-core:91216] [Bug #15555] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Ignore file separator from tmpfile/tmpdir name.hsbt2018-03-281-0/+2
| | | | | | From: SHIBATA Hiroshi <hsbt@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* tmpdir.rb: merged make_tmpname to createnobu2017-11-151-13/+9
| | | | | | | * lib/tmpdir.rb (Dir::Tmpname#create): try conversion of prefix and suffix just once before loop. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/tmpdir.rb: Unify to coding-style for method definition.hsbt2016-02-261-1/+1
| | | | | | [fix GH-1252] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/open-uri.rb: Remove indicator for "frozen_string_literal: true".akr2015-11-101-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/pp.rb: Ditto. * lib/prettyprint.rb: Ditto. * lib/resolv.rb: Ditto. * lib/securerandom.rb: Ditto. * lib/tmpdir.rb: Ditto. * lib/unicode_normalize/tables.rb: Ditto. * test/net/ftp/test_buffered_socket.rb: Ditto. * test/net/ftp/test_mlsx_entry.rb: Ditto. * test/open-uri/test_open-uri.rb: Ditto. * test/open-uri/test_ssl.rb: Ditto. * test/pathname/test_pathname.rb: Ditto. * test/test_pp.rb: Ditto. * test/test_prettyprint.rb: Ditto. * tool/transcode-tblgen.rb: Ditto. * ext/pathname/lib/pathname.rb: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/tmpdir.rb (Dir.tmpdir): return duplicated string to beakr2015-10-061-1/+1
| | | | | | | modify safely even when $SAFE > 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Put an line before "frozen_string_literal: true" for emacs.akr2015-10-051-0/+1
| | | | | | | https://bugs.ruby-lang.org/issues/8976#note-49 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/pp.rb: Use frozen_string_literal: true.akr2015-10-051-1/+2
| | | | | | | | | | | | | | | | | | * lib/prettyprint.rb: Ditto. * lib/resolv.rb: Ditto. * lib/tmpdir.rb: Ditto. * test/test_pp.rb: Ditto. * test/test_prettyprint.rb: Ditto. * tool/transcode-tblgen.rb: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/tmpdir.rb (Dir.mktmpdir): Accept nil again, as Ruby 2.1.akr2014-12-201-2/+2
| | | | | | | | [ruby-core:66943] [Bug #10616] Fixed by Alex Slynko. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* tmpdir.rb: explicit conversion to stringnobu2014-09-221-0/+4
| | | | | | | * lib/tmpdir.rb (Dir::Tmpname#make_tmpname): convert prefix and suffix to strings explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* tempfile.rb: fix r47655nobu2014-09-211-12/+3
| | | | | | | | | | | | * lib/tempfile.rb (Tempfile#initialize, Tempfile.create): get rid of shadowing local variables. * lib/tmpdir.rb (Dir::Tmpname#make_tmpname): simlify argument splitting. * test/test_tempfile.rb: need thread library for ConditionVariable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/tempfile.rb: define parameters appropriately and someglass2014-09-201-15/+7
| | | | | | | | refactoring. * lib/tmpdir.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/shell/command-processor.rb: remove unused variable.hsbt2014-07-261-1/+1
| | | | | | | | * lib/shell/system-command.rb: ditto. * lib/tmpdir.rb: ditto. * lib/uri/generic.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * (lib/tmpdir.rb): Rescue LoadError on etc.so for miniruby.akr2014-04-291-1/+4
| | | | | | | | Revert r45707, r45711, r45717. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/tmpdir.rb: Don't need to rescue LoadError for etc.so.akr2014-04-241-4/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix typos. Patch by k_takata.ktsj2013-05-191-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* tmpdir.rb: not expand tildenobu2012-12-121-1/+1
| | | | | | | | * lib/tmpdir.rb (Dir::Tmpname#create): deal with a prefix name which starts with tilde as a plain name, not expanding as home directory. [ruby-core:50793] [Bug #7547] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/tmpdir.rb (Dir::tmpdir): test the current directory suitable forakr2012-03-121-4/+7
| | | | | | | temporary directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/tmpdir.rb: update document for changingakr2012-03-111-2/+3
| | | | | | | | | | FileUtils.remove_entry_secure to FileUtils.remove_entry. * NEWS: add incompatiblity note for lib/tmpdir.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/tmpdir.rb (Dir.tmpdir): should not use world-writable butnobu2012-03-111-2/+7
| | | | | | | non-sticky directory. * lib/tmpdir.rb (Dir.mktmpdir): check the parent directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib: Convert tabs to spaces for ruby files perdrbrain2011-05-181-4/+4
| | | | | | | | | http://redmine.ruby-lang.org/projects/ruby/wiki/DeveloperHowto#coding-style Patch by Steve Klabnik [Ruby 1.9 - Bug #4730] Patch by Jason Dew [Ruby 1.9 - Feature #4718] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/etc/etc.c (etc_systmpdir): moved from ext/tmpdir.nobu2010-05-081-3/+4
| | | | | | | | | * ext/etc/etc.c (etc_sysconfdir): added. * lib/rubygems/config_file.rb, lib/tmpdir.rb: use etc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/tmpdir.rb: test RUBY_PLATFORM for loading tmpdir.so to avoidakr2010-05-061-2/+1
| | | | | | | LoadError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/tmpdir: split from lib/tmpdir.rb.nobu2010-03-161-27/+5
| | | | | | | * win32/win32.c (rb_w32_system_tmpdir): extracted from init_env. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/tempfile.rb (Tempfile#initialize): merge mode option.nobu2009-11-111-1/+1
| | | | | | | * lib/tmpdir.rb (Dir::Tmpname#create): splat options. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/tmpdir.rb (Dir::Tmpname): for internal use.nobu2009-09-111-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/tempfile.rb, lib/tmpdir.rb (Tmpname): extracted new module.nobu2009-09-081-30/+59
| | | | | | | [ruby-dev:39197] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/tmpdir.rb (Dir.mktmpdir): rolled back r24699. [ruby-dev:39193]nobu2009-08-291-2/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/tmpdir.rb (Dir.mktmpdir): removed thread race condition.nobu2009-08-281-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * dir.c (dir_s_getwd): directory path's encoding should be filesystem'susa2009-06-101-0/+1
| | | | | | | | | | one. * lib/tmpdir.rb: ditto (but not finished yet.) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/tmpdir.rb (Dir.tmpdir): not use USERPROFILE, and ignoresnobu2009-03-051-4/+3
| | | | | | | non-existent directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/tmpdir.rb (@@systmpdir): File.expand_path also joins paths.nobu2009-02-191-4/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/tmpdir.rb: setup buffer with nul characters instead of spaces.usa2008-09-241-1/+1
| | | | | | | | fixed [ruby-dev:36493] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/tmpdir.rb (@@systmpdir): prior LOCAL_APPDATA if possible, andnobu2008-06-291-6/+13
| | | | | | | | should be clean. based on a patch from arton <artonx AT yahoo.co.jp> at [ruby-dev:35269] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* doc. wording fix.akr2007-10-241-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/tmpdir.rb (Dir.mktmpdir): make directory suffix specifiable.akr2007-08-211-5/+28
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e