Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,13 @@ lcov*.info
/ChangeLog
/Doxyfile
/GNUmakefile
/README.atheos
/README.fat-patch
/README.v6
/TAGS
/archive
/autom4te*.cache
/automake
/benchmark/benchmark-driver
/beos
/bmlog-*
/breakpoints.gdb
/config.cache
Expand Down Expand Up @@ -128,7 +126,6 @@ lcov*.info
/revision.h
/revision.tmp
/ripper.tmp.y
/riscos
/rubicon
/ruby
/ruby-runner
Expand Down
14 changes: 14 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,20 @@ Ruby 4.0 bundled RubyGems and Bundler version 4. see the following links for det
* Interix (Windows Services for UNIX)
* SunOS 4 (Solaris, i.e. SunOS 5, is unaffected)
* BSD/OS (BSDi)
* NeXTSTEP, OpenStep and Rhapsody

* Support code for the following platforms has also been removed. None
of them has a platform maintainer.

* AmigaOS
* AtheOS
* ESIX
* HI-UX/MPP
* IRIX
* OSF/1 (Tru64 UNIX)
* QNX Neutrino
* System V Release 4
* UX/PDS

* Windows 10 1703 or later no longer needs the `LongPathsEnabled` registry
value to use paths longer than 260 characters. This applies to any process
Expand Down
49 changes: 5 additions & 44 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,7 @@ AS_CASE(["$target_os"],
])
rb_cv_binary_elf=no
: ${enable_shared=yes}
],
[hiuxmpp*], [AC_DEFINE(__HIUX_MPP__)]) # by TOYODA Eizi <toyoda@npd.kishou.go.jp>
])

AC_PROG_LN_S
AC_PROG_MAKE_SET
Expand Down Expand Up @@ -1149,9 +1148,6 @@ AC_SUBST(POSTLINK)
cleanlibs=
AC_SUBST(cleanlibs)
AS_CASE(["$target_os"],
[nextstep*], [ ],
[openstep*], [ ],
[rhapsody*], [ ],
[darwin*], [
ORIG_LIBS="$LIBS"
RUBY_PREPEND_OPTION(LIBS, -lobjc)
Expand Down Expand Up @@ -1958,8 +1954,6 @@ AS_CASE(["$target_cpu"],
[alpha*|sh4|sh4el|sh4eb], [AS_CASE(["$target_os"::"$GCC"],
[*::yes], # gcc
[CFLAGS="-mieee $CFLAGS"],
[osf*], # ccc
[CFLAGS="-ieee $CFLAGS"],
)],
[sparc*], [AC_LIBOBJ([sparc])])

Expand Down Expand Up @@ -3171,9 +3165,8 @@ STATIC=
RUBY_APPEND_OPTION(CCDLFLAGS, -fPIC)])
], [
AS_CASE(["$target_os"],
[solaris*|irix*], [CCDLFLAGS="$CCDLFLAGS -KPIC"],
[esix*|uxpds*], [CCDLFLAGS="$CCDLFLAGS -KPIC"],
[: ${CCDLFLAGS=""}])
[solaris*], [CCDLFLAGS="$CCDLFLAGS -KPIC"],
[: ${CCDLFLAGS=""}])
])
}

Expand Down Expand Up @@ -3212,16 +3205,6 @@ AC_SUBST(PROGRAM_EXTS, [${EXTSTATIC:+exts}])
: ${PRELOADENV=LD_PRELOAD_32}
])
rb_cv_dlopen=yes],
[irix*], [ : ${LDSHARED='$(LD) -shared'}
rb_cv_dlopen=yes],
[sysv4*], [ : ${LDSHARED='$(LD) -G'}
rb_cv_dlopen=yes],
[nto-qnx*], [ : ${LDSHARED='$(CC) -shared'}
rb_cv_dlopen=yes],
[esix*|uxpds*], [ : ${LDSHARED='$(LD) -G'}
rb_cv_dlopen=yes],
[osf*], [ : ${LDSHARED='$(LD) -shared -expect_unresolved "*"'}
rb_cv_dlopen=yes],
[linux* | gnu* | k*bsd*-gnu | netbsd* | kopensolaris*-gnu | haiku*], [
: ${LDSHARED='$(CC) -shared'}
AS_IF([test "$rb_cv_binary_elf" = yes], [
Expand Down Expand Up @@ -3270,20 +3253,13 @@ AC_SUBST(PROGRAM_EXTS, [${EXTSTATIC:+exts}])
: ${LIBPATHENV=LIBPATH}
: ${PRELOADENV=LDR_PRELOAD}
rb_cv_dlopen=yes],
[nto-qnx*], [ DLDFLAGS="$DLDFLAGS -L/lib -L/usr/lib -L/usr/local/lib"
: ${LDSHARED='$(LD) -Bshareable -x'}
LDFLAGS="$LDFLAGS -L/lib -L/usr/lib -L/usr/local/lib"
rb_cv_dlopen=yes],
[cygwin*|msys*|mingw*], [
: ${LDSHARED='$(CC) -shared'}
XLDFLAGS="$XLDFLAGS -Wl,--stack,0x00200000,--enable-auto-import"
DLDFLAGS="${DLDFLAGS} -Wl,--enable-auto-image-base,--enable-auto-import"
: ${LIBPATHENV=PATH}
: ${PRELOADENV=""}
rb_cv_dlopen=yes],
[hiuxmpp], [ : ${LDSHARED='$(LD) -r'}],
[atheos*], [ : ${LDSHARED='$(CC) -shared'}
rb_cv_dlopen=yes],
[wasi*], [ : ${LDSHARED='$(LD) -shared -Xlinker --export-dynamic'}],
[ : ${LDSHARED='$(LD)'}])
AC_MSG_RESULT($rb_cv_dlopen)
Expand Down Expand Up @@ -3441,7 +3417,7 @@ AS_IF([test x$with_valgrind != xno],
[darwin*], [
SOEXT=dylib
DLEXT=bundle],
[cygwin*|msys*|mingw*|*djgpp*], [
[cygwin*|msys*|mingw*], [
LOAD_RELATIVE=1
SOEXT=dll
DLEXT=so],
Expand Down Expand Up @@ -3679,7 +3655,7 @@ AS_CASE("$enable_shared", [yes], [

relative_libprefix="/../${multiarch+../}${libdir_basename}"
AS_CASE(["$target_os"],
[linux* | gnu* | k*bsd*-gnu | atheos* | kopensolaris*-gnu | haiku*], [
[linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | haiku*], [
RUBY_APPEND_OPTIONS(LIBRUBY_DLDFLAGS, ['-Wl,-soname,$(LIBRUBY_SONAME)' "$LDFLAGS_OPTDIR"])
LIBRUBY_ALIASES='$(LIBRUBY_SONAME) lib$(RUBY_SO_NAME).$(SOEXT)'
AS_IF([test "$load_relative" = yes], [
Expand Down Expand Up @@ -4242,21 +4218,6 @@ enum {
RUBY_APPEND_OPTION(XLDFLAGS, [-framework CoreFoundation])
RUBY_APPEND_OPTION(LIBRUBYARG_STATIC, [-framework CoreFoundation])
],
[osf*], [
AS_IF([test "$GCC" != "yes" ], [
# compile something small: taint.c is fine for this.
# the main point is the '-v' flag of 'cc'.
AS_CASE(["`cc -v -I. -c main.c -o /tmp/main.o 2>&1`"],
[*/gemc_cc*], [ # we have the new DEC GEM CC
CFLAGS="$CFLAGS -oldc"
],
[ # we have the old MIPS CC
])
# cleanup
rm -f /tmp/main.o
CFLAGS="$CFLAGS -std"
])
],
[cygwin*|msys*|mingw*], [
LIBRUBY_DLDFLAGS="${LIBRUBY_DLDFLAGS}"' -Wl,--out-implib=$(LIBRUBY)'
AS_CASE(["$target_os"],
Expand Down
13 changes: 11 additions & 2 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1813,12 +1813,21 @@ nogvl_rmdir(void *ptr)
}

/*
* :markup: markdown
*
* call-seq:
* Dir.delete(dirpath) -> 0
* Dir.rmdir(dirpath) -> 0
* Dir.unlink(dirpath) -> 0
*
* Removes the directory at +dirpath+ from the underlying file system:
* Removes the directory entry ([hard link](rdoc-ref:file/hard_links.md)) at `dirpath`,
* along with its associated inode:
*
* Dir.rmdir('foo') # => 0
* ```ruby
* dirpath = '/tmp/tmpdir'
* Dir.mkdir(dirpath)
* Dir.rmdir(dirpath) # => 0
* ```
*
* Raises an exception if the directory is not empty.
*/
Expand Down
65 changes: 65 additions & 0 deletions doc/file/hard_links.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Hard Links

A _hard link_ is a filesystem entry pointing to
an [inode](https://en.wikipedia.org/wiki/Inode) in the filesystem;
in effect, the hard link is a name for the inode.

An inode is one of these types (see File.ftype):

- Regular file.
- Directory.
- Symbolic link.
- FIFO.
- \Socket.
- Block-special device.
- Character-special device.

When an inode is created, it initially has one hard link -- its original "name":

```ruby
path0 = '/tmp/t0.tmp'
File.write(path0, 'foo')
stat0 = File.stat(path0)
stat0.ino # => 26345482 # Inode identifier; unique within filesystem.
stat0.nlink # => 1 # Count of hard link to the inode.
```

## Multiple Hard Links

The inode may have more than one hard link:

```ruby
path1 = '/tmp/t1.tmp'
File.link(path0, path1)
stat1 = File.stat(path1)
stat1.ino # => 26345482
stat1.nlink # => 2
```

Multiple hard links to the same inode are in effect multiple names for that inode:

```ruby
File.read(path0) # => "foo"
File.read(path1) # => "foo"
```

When an inode has more than one hard link, all its hard links are "equal";
the original hard link is no more "valid" or "important" than the others.

## Unlinking

Unlinking (removing) one hard link does not remove the inode:

```ruby
File.unlink(path1)
File.exist?(path1) # => false # Hard link path1 was removed.
File.exist?(path0) # => true # Hard link path0 still exists.
File.stat(path0).nlink # => 1 # Now has only one hard link.
```

But removing the last hard link does remove the inode:

```ruby
File.unlink(path0)
File.exist?(path0) # => false # And the inode was removed.
```
1 change: 0 additions & 1 deletion ext/etc/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
headers << h
end
}
have_library("sun", "getpwnam") # NIS (== YP) interface for IRIX 4
have_func("uname((struct utsname *)NULL)", headers)
have_func("getlogin")
if have_func("getpwent")
Expand Down
3 changes: 1 addition & 2 deletions ext/pty/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"

if /mswin|mingw|bccwin/ !~ RUBY_PLATFORM
if /mswin|mingw/ !~ RUBY_PLATFORM
have_header("sys/stropts.h")
have_func("setresuid")
have_header("libutil.h")
Expand All @@ -19,7 +19,6 @@
end
if openpt or
(util or have_func("openpty")) or
have_func("_getpty") or
have_func("ioctl")
have_macro("HAVE_FCHMOD") or have_func("fchmod")
have_macro("HAVE_FCHOWN") or have_func("fchown")
Expand Down
17 changes: 0 additions & 17 deletions ext/pty/pty.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,23 +395,6 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,

return 0;

#elif defined HAVE__GETPTY
/* SGI IRIX */
char *name;
mode_t mode = nomesg ? 0600 : 0622;

if (!(name = _getpty(master, O_RDWR, mode, 0))) {
if (!fail) return -1;
rb_raise(rb_eRuntimeError, "_getpty() failed");
}
rb_fd_fix_cloexec(*master);

*slave = rb_cloexec_open(name, O_RDWR, 0);
/* error check? */
rb_update_max_fd(*slave);
strlcpy(SlaveName, name, DEVICELEN);

return 0;
#elif defined(HAVE_PTSNAME)
/* System V */
int masterfd = -1, slavefd = -1;
Expand Down
4 changes: 1 addition & 3 deletions ext/zlib/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@
Logging::message 'checking for kind of operating system... '
os_code = with_config('os-code') ||
case RUBY_PLATFORM.split('-',2)[1]
when 'amigaos' then
os_code = 'AMIGA'
when /mswin|mingw|bccwin/ then
when /mswin|mingw/ then
# NOTE: cygwin should be regarded as Unix.
os_code = 'WIN32'
else
Expand Down
Loading