1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
Commit graph

136 commits

Author SHA1 Message Date
Jeremy Evans
ffd0820ab3 Deprecate taint/trust and related methods, and make the methods no-ops
This removes the related tests, and puts the related specs behind
version guards.  This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
2019-11-18 01:00:25 +02:00
Nobuyoshi Nakada
e169ad93f4 Fixed File.extname at a name ending with a dot
File.extname now returns a dot string at a name ending with a dot.
[Bug ]
2019-10-17 18:51:51 +09:00
Yusuke Endoh
a886d5cb79 test/ruby/test_file_exhaustive.rb: check the owner of the root directory
The root directory may be owned by the current user, for example, in
chroot environment.
2019-10-10 23:18:44 +09:00
Yusuke Endoh
cce6cfbe48 Make test-all and test-spec runnable on Android
Calling some syscall functions such as Dir.chroot causes SIGSYS instead
of EPERM on Android.
This change skips all tests that stops the test-suite run.
2019-09-09 20:24:03 +09:00
Yusuke Endoh
823adea954 test/ruby/test_file_exhaustive.rb: suppress method-redefined warning 2019-07-31 11:46:56 +09:00
Jeremy Evans
a50bc9f3c8 Do not always taint the result of File#path
The result should only be tainted if the path given to the method
was tainted.

The code to always taint the result was added in
a4934a42cb (svn revision 4892) in
2003 by matz.  However, the change wasn't mentioned in the
commit message, and it may have been committed by accident.

Skip part of a readline test that uses Reline.  Reline in general
would pass the test, but Reline's test mode doesn't raise a
SecurityError if passing a tainted prompt and $SAFE >= 1. This
was hidden earlier because File#path was always returning a
tainted string.

Fixes [Bug ]
2019-07-30 11:55:59 -07:00
Jeremy Evans
6eab49a40a Revert "Do not always taint the result of File#path"
This reverts commit 1a759bfe5d.

This fails on some operating systems.
2019-07-29 12:10:15 -07:00
Jeremy Evans
1a759bfe5d Do not always taint the result of File#path
The result should only be tainted if the path given to the method
was tainted.

The code to always taint the result was added in
a4934a42cb (svn revision 4892) in
2003 by matz.  However, the change wasn't mentioned in the
commit message, and it may have been committed by accident.

Skip part of a readline test that uses Reline.  Reline in general
would pass the test, but Reline's test mode doesn't raise a
SecurityError if passing a tainted prompt and $SAFE >= 1. This
was hidden earlier because File#path was always returning a
tainted string.

Fixes [Bug ]
2019-07-29 10:45:14 -07:00
Nobuyoshi Nakada
e9ea494171
The behavior of statx(2) depends on the filesystem
birthtime may not be supported on some filesystems, and
NotImplementedError can be raised.  [Bug ]
2019-07-02 22:11:23 +09:00
Nobuyoshi Nakada
45ba027d08
Removed unused variables 2019-06-30 08:45:01 +09:00
nobu
def040f6c3 Skip EPERM, when statx(2) is wholely blocked
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-22 06:35:44 +00:00
nobu
1ae52fcddf Skip EPERM, like as r67102
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-22 06:22:24 +00:00
nobu
aa5dd6fe7e STATX_BTIME depends on filesystems
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-22 06:14:22 +00:00
nobu
fc90c4ec5d Support File#birthtime on Linux
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-22 06:01:08 +00:00
nobu
713f360dcd Already nlink is properly set on Windows
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-17 04:58:50 +00:00
nobu
990c8759db Split test_expand_path, test_basename, test_dirname
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-17 04:58:49 +00:00
aycabta
39a840d084 Document File.{setuid?,setgid?,sticky?} support for IO objects [Bug ]
* file.c (rb_file_setuid_p): rdoc for IO object support
  (rb_file_sgid_p): ditto (rb_file_sticky_p): ditto
* NEWS: inform users of new feature
* test/file/test_file_exhaustive.rb (io_open): wrapper for bare IO
  object (test_suid): test for bare IO support (test_sgid): ditto
  (test_sticky): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 11:47:45 +00:00
nobu
ebf5348528 win32/file.c: relative path with drive letter
* win32/file.c (IS_ABSOLUTE_PATH_P): home directory should not be
  a relative path regardless a drive letter.   PathIsRelativeW
  returns FALSE on such path.  [ruby-core:86356] [Bug ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 07:01:48 +00:00
nobu
bd61ccef57 test_file_exhaustive.rb: get rid of failures
* test/ruby/test_file_exhaustive.rb (test_utime_symlinkfile):
  under some condition, symlink file is also affected by utimes()
  on Linux.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-08 07:35:07 +00:00
nobu
ec74acd1a9 test_file_exhaustive.rb: test_utime_symlinkfile
* test_file_exhaustive.rb (test_utime_symlinkfile): investigate
  failures on some platforms.  wait a second to tell if symlink
  atime is changed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-08 07:13:04 +00:00
nobu
d52ef7541f test_file_exhaustive.rb: fix arguments order
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-08 06:24:16 +00:00
nobu
defcaf89dd file.c: File.lutime
* file.c (utime_internal): add File.lutime.  [Feature ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-29 09:59:20 +00:00
hsbt
a5641cdf7a added workaround for APFS file format.
* TestFileExhaustive#test_atime: It fails with nano-sec precise.
    I changed to use unixtime for this assertion for APFS.
  * TestFileExhaustive#test_expand_path: skip assertion when given
    invalid charactor on APFS.

  [Bug ][ruby-core:82383]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14 05:04:38 +00:00
nobu
9c5c31c8b7 test_file_exhaustive.rb: check case-sensitive fs
* test/ruby/test_file_exhaustive.rb (test_expand_path): dump
  expanded file name, not only appended char, for case-sensitive
  filesystem.  [ruby-dev:50093] [Bug ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-22 08:19:34 +00:00
nobu
b75f68ab8d file.c: join with /
* file.c (rb_file_join): join using "/" always, not a constant.
  and fix the document.  [ruby-core:79579] [Bug ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-13 09:29:19 +00:00
nobu
7eb8d74f34 file.c: cygwin behavior
* file.c: recent cygwin hides NTFS specific features.
  [ruby-core:78497] [Bug ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-07 02:19:29 +00:00
nobu
a8fff36406 EPERM by symlink
* test/ruby/test_file_exhaustive.rb (symlinkfile): EPERM can raise
  on cygwin.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-06 06:16:57 +00:00
nobu
6b88dd2698 file.c: home directory from system
* file.c (rb_default_home_dir): resolve home directory from the
  system database when HOME is not set.  [Feature ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-26 11:37:01 +00:00
nobu
b569971422 Normalization test iff UTF-8 file system
* test/ruby/test_file_exhaustive.rb (test_expand_path_compose):
  normalization is meaningless unless file system encoding is UTF.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 01:48:27 +00:00
nobu
58edb064c3 File.expand_path compose test only on OS X
* test/ruby/test_file_exhaustive.rb (test_expand_path_compose):
  valid only on OS X.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-12 09:45:09 +00:00
nobu
797f2eda58 file.c: normalize cwd
* file.c (append_fspath): normalize directory name to be appended
  on OS X.  [ruby-core:75957] [Ruby trunk Bug#12483]
  https://github.com/rails/rails/issues/25303#issuecomment-224834804

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-12 00:24:36 +00:00
nobu
77a8772b11 test_file_exhaustive.rb: writable open
* test/ruby/test_file_exhaustive.rb (test_flock_shared): open
  in writable mode for exclusive lock.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 14:07:01 +00:00
nobu
7a622b18d9 test_file_exhaustive.rb: blocking flock
* test/ruby/test_file_exhaustive.rb (test_flock): add assertions
  for the blocking cases.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-28 10:45:48 +00:00
svn
7f50d69c4a * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-02 14:03:22 +00:00
usa
42ebe37b88 * test/ruby/test_file_exhaustive.rb: test UTF-8 filename. see [Bug ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-02 14:03:21 +00:00
akr
9ac296698a Fix a test message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-01 12:30:51 +00:00
nobu
096137e84f file.c: File.empty?
* file.c (Init_File): add alias File.empty? to File.zero?.
  [Feature ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-13 05:47:49 +00:00
nobu
54c7712081 test_file_exhaustive.rb: strict check test_dirname
* test/ruby/test_file_exhaustive.rb (test_dirname): assert same as
  the parent directory, not ascendant directories.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 08:00:57 +00:00
nobu
c7f815eed8 test/ruby: suppress runtime warnings
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-19 07:58:09 +00:00
nobu
28a7199ae0 r53688 test
* test/ruby/test_file_exhaustive.rb (test_realpath_mount_point):
  test for r53688.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-31 09:43:22 +00:00
nobu
8b9cd1dbb2 test for File#lstat.
* test/ruby/test_file_exhaustive.rb (test_lstat): Add lacking test
  for File#lstat.  [Fix GH-1231]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-31 03:20:22 +00:00
nobu
1e22638295 r53689 test
* test/ruby/test_file_exhaustive.rb (test_readlink_junction): test
  for r53689.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-29 09:32:57 +00:00
naruse
3e92b635fb Add frozen_string_literal: false for all files
When you change this to true, you may need to add more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
nobu
5dfc455b72 test: File.symlink needs administrator privilege
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-28 01:24:36 +00:00
akr
3024fc235a * test/lib/envutil.rb (File.mkfifo): Defined using mkfifo command.
* test/ruby/test_io.rb: Ditto.

* test/ruby/test_file_exhaustive.rb: Use File.mkfifo.

* test/ruby/test_process.rb: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-13 13:46:10 +00:00
nobu
143a2817f2 test_file_exhaustive.rb: assert_predicate
* test/ruby/test_file_exhaustive.rb: use assert_predicate and
  assert_not_predicate for better failure messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-12 02:32:10 +00:00
akr
525d2102fc Consider more block devices.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-12 01:33:19 +00:00
nobu
a062d71b15 test_file_exhaustive.rb: NTFS
* test/ruby/test_file_exhaustive.rb (NTFS): flag for test of NTFS.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-12 01:26:28 +00:00
nobu
640ad73bcc test_file_exhaustive.rb: POSIX-like tests
* test/ruby/test_file_exhaustive.rb: define POSIX-like filesystem
  depenedent tests only on POSIX-like systems.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-12 01:22:19 +00:00
nobu
c305a5aac2 test_file_exhaustive.rb: POSIX
* test/ruby/test_file_exhaustive.rb (POSIX): flag for test of
  POSIX-like filesystems.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-12 01:13:50 +00:00