Граф коммитов

60 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 3e605a7819 [ruby/tmpdir] [Bug #18933] Make `Dir.mktmpdir` Ractor-safe
Fix https://bugs.ruby-lang.org/issues/18933

https://github.com/ruby/tmpdir/commit/446e636434
2023-07-03 05:47:43 +00:00
Nobuyoshi Nakada 114e71d062 [ruby/tmpdir] Ignore empty environment variables
Fixes https://github.com/ruby/tmpdir/pull/17

https://github.com/ruby/tmpdir/commit/a79c727a5d
2022-10-25 07:54:40 +00:00
Nobuyoshi Nakada 883d9c305f [ruby/tmpdir] Found or raise 2022-10-25 07:16:36 +00:00
Peter Vandenberk 287c5da4aa [ruby/tmpdir] Make `Dir.tmpdir` more idiomatic and functional
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
2022-10-25 06:59:16 +00:00
Nobuyoshi Nakada cade3aba61 [ruby/tmpdir] Fix typo 2022-10-25 05:02:54 +00:00
Nobuyoshi Nakada 71a5b1d457
[ruby/tmpdir] [DOC] Improve documentation
https://github.com/ruby/tmpdir/commit/b9c880f2b6
2022-10-25 13:57:56 +09:00
Nobuyoshi Nakada 414b5565f7
[ruby/tmpdir] [DOC] Fix syntax in example code [ci skip]
RDoc expects example code to be valid syntax.

https://github.com/ruby/tmpdir/commit/ee42540ebb
2021-11-11 10:37:35 +09:00
Nobuyoshi Nakada 4b6fa03a72
[ruby/tmpdir] Make usable chars more strict
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
2021-04-05 21:08:57 +09:00
Nobuyoshi Nakada edb5c67195 [ruby/tmpdir] Warn when environment variables skipped (fixes #2)
https://github.com/ruby/tmpdir/commit/af7b020a89
2020-09-14 18:22:37 +09:00
Jeremy Evans 2ecfb88ee5 Correctly remove temporary directory if path yielded is mutated
Another approach would be to freeze the string, but that could
cause backwards compatibility issues.

Fixes [Bug #16918]
2020-05-29 07:06:46 -07:00
Nobuyoshi Nakada 98f6c74b42
Isolate the PRNG for tmpdir/tempfile
To get rid of conflicts affected by `srand`.
2020-01-29 10:14:15 +09:00
Jeremy Evans c5c05460ac Warn on access/modify of $SAFE, and remove effects of modifying $SAFE
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.
2019-11-18 01:00:25 +02:00
Jeremy Evans d08e1004e0 Fix keyword argument separation issues in lib
Mostly requires adding ** in either calls or method definitions.
2019-08-30 12:39:31 -07:00
Nobuyoshi Nakada 1c7e303b26
Constified unusable chars 2019-06-21 23:04:34 +09:00
nobu 1fae154c07 tmpdir.rb: permission of user given directory
* 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
2019-01-23 06:06:47 +00:00
hsbt 10b96900b9 Ignore file separator from tmpfile/tmpdir name.
From: SHIBATA Hiroshi <hsbt@ruby-lang.org>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 10:03:03 +00:00
nobu 25d56ea7b7 tmpdir.rb: merged make_tmpname to create
* 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
2017-11-15 08:02:09 +00:00
hsbt 379c3b8b24 * lib/tmpdir.rb: Unify to coding-style for method definition.
[fix GH-1252]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-26 02:11:14 +00:00
akr 68ebbbfebe * lib/open-uri.rb: Remove indicator for "frozen_string_literal: true".
* 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
2015-11-10 11:48:14 +00:00
akr 83da44790b * lib/tmpdir.rb (Dir.tmpdir): return duplicated string to be
modify safely even when $SAFE > 0.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-06 12:40:41 +00:00
akr 36ca18b847 Put an line before "frozen_string_literal: true" for emacs.
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
2015-10-05 22:22:56 +00:00
akr 805c20a8e5 * lib/pp.rb: Use frozen_string_literal: true.
* 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
2015-10-05 13:27:48 +00:00
akr 8b5c7d939d * lib/tmpdir.rb (Dir.mktmpdir): Accept nil again, as Ruby 2.1.
[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
2014-12-20 08:58:07 +00:00
nobu 2e2522ecdf tmpdir.rb: explicit conversion to string
* 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
2014-09-22 04:44:19 +00:00
nobu a718be06fa tempfile.rb: fix r47655
* 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
2014-09-21 01:40:21 +00:00
glass 09e91be9ab * lib/tempfile.rb: define parameters appropriately and some
refactoring.

* lib/tmpdir.rb:   ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-20 17:35:06 +00:00
hsbt 4b8f0e7637 * lib/shell/command-processor.rb: remove unused variable.
* 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
2014-07-26 17:44:07 +00:00
akr 07f2563745 * (lib/tmpdir.rb): Rescue LoadError on etc.so for miniruby.
Revert r45707, r45711, r45717.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-29 05:19:38 +00:00
akr 869c7ce0d1 * lib/tmpdir.rb: Don't need to rescue LoadError for etc.so.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-24 11:53:31 +00:00
ktsj edb98f8b91 fix typos. Patch by k_takata.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-19 03:10:21 +00:00
nobu 6f8bce9eff tmpdir.rb: not expand tilde
* 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
2012-12-12 12:40:51 +00:00
akr b681457f01 * lib/tmpdir.rb (Dir::tmpdir): test the current directory suitable for
temporary directory.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-12 11:19:42 +00:00
akr 48b5b163fc * lib/tmpdir.rb: update document for changing
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
2012-03-11 22:37:04 +00:00
nobu bcb9e567c4 * lib/tmpdir.rb (Dir.tmpdir): should not use world-writable but
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
2012-03-11 22:19:06 +00:00
drbrain 7bbf2f3085 * lib: Convert tabs to spaces for ruby files per
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
2011-05-18 21:19:18 +00:00
nobu 2c01a07bf4 * ext/etc/etc.c (etc_systmpdir): moved from ext/tmpdir.
* 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
2010-05-08 03:25:17 +00:00
akr 3b9c00306f * lib/tmpdir.rb: test RUBY_PLATFORM for loading tmpdir.so to avoid
LoadError.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-06 05:14:10 +00:00
nobu 3694f1dda7 * ext/tmpdir: split from lib/tmpdir.rb.
* 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
2010-03-16 06:20:23 +00:00
nobu d9eae80011 * lib/tempfile.rb (Tempfile#initialize): merge mode option.
* 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
2009-11-11 10:17:36 +00:00
nobu 50ef1b0676 * lib/tmpdir.rb (Dir::Tmpname): for internal use.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-11 09:46:53 +00:00
nobu 032a314c50 * lib/tempfile.rb, lib/tmpdir.rb (Tmpname): extracted new module.
[ruby-dev:39197]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-08 13:38:01 +00:00
nobu be41711465 * lib/tmpdir.rb (Dir.mktmpdir): rolled back r24699. [ruby-dev:39193]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-29 03:16:56 +00:00
nobu 2235d504b7 * lib/tmpdir.rb (Dir.mktmpdir): removed thread race condition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-28 18:27:30 +00:00
usa a610b0a959 * dir.c (dir_s_getwd): directory path's encoding should be filesystem's
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
2009-06-10 09:15:55 +00:00
nobu e691ba3bac * lib/tmpdir.rb (Dir.tmpdir): not use USERPROFILE, and ignores
non-existent directory.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-05 07:56:19 +00:00
nobu a285f8565d * lib/tmpdir.rb (@@systmpdir): File.expand_path also joins paths.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-19 06:17:01 +00:00
usa cdc5ebd3f2 * lib/tmpdir.rb: setup buffer with nul characters instead of spaces.
fixed [ruby-dev:36493]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-24 05:39:39 +00:00
nobu 285fb00195 * lib/tmpdir.rb (@@systmpdir): prior LOCAL_APPDATA if possible, and
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
2008-06-29 00:43:12 +00:00
akr 0945e23b07 doc. wording fix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-24 06:03:48 +00:00
akr c4d6f4c01e * lib/tmpdir.rb (Dir.mktmpdir): make directory suffix specifiable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-21 12:15:34 +00:00