Dial-Up Magic Version: 1.5.0 serial key or number
Dial-Up Magic Version: 1.5.0 serial key or number
JRuby
JRuby 9.2.13.0 Released
Monday, August 03 2020
The JRuby community is pleased to announce the release of JRuby 9.2.13.0
JRuby 9.2.x is compatible with Ruby 2.5.x and stays in sync with C Ruby. As always there is a mix of miscellaneous fixes so be sure to read the issue list below. All users are encouraged to upgrade.
As we are still actively working on 9.3.0.0 we decided to put out another 9.2.x release to fix some of the more recently reported issues.
Security
Concurrency
- Internal structures used to optimize Ruby code have been made more thread-safe. Previously, these optimizations could be seen across threads in a partially-complete state, leading to errors in JRuby’s core runtime. (#6319, #6323, #6337)
Ruby Compatibility
- IO.copy_stream has been fixed to ensure all read bytes are written. Previously, partial writes would leave some read bytes in limbo, leading to hangs in net/http among other libraries. (#6078, #6348)
- Fixed a regression from 9.2.12.0 in how we translate JDK socket errors to Ruby’s Errno on Windows. (#6322, #6328)
FFI
FFI has been patched to not automatically release memory pointers when autorelease is disabled. This caused crashes in the sassc native library and possibly others. (#6310, #6331)
12 issues fixed for 9.2.13.0
Github Issues resolved for 9.2.13.0
- #6348 - [fix][backport] Ensure copy_stream write sends all bytes read
- #6337 - JRuby 9.2.12.0 OpenJDK11 java.lang.ArrayIndexOutOfBoundsException from JRuby Runtime
- #6332 - Update Psych to 3.2.0
- #6331 - Allow false autorelease to set unmanaged = true
- #6328 - Fall back on old regexp BindException mapping
- #6323 - Eliminate concurrent modification of runtime-sensitive IR state
- #6322 - Windows raising different exception since 9.2.12.0
- #6320 - Update snakeyaml to version 1.26 or higher CVE-2017-18640
- #6319 - org.jruby.runtime.scopes.DynamicScope6 only supports scopes with 6 variables on JRuby 9.2.12.0/OpenJDK8
- #6310 - Rails: After migration from ruby to jruby, app is not booting
- #6284 - FFI::MemoryPointer autorelease issue
- #6078 - net/http hangs (timeouts) since 9.2.7.0
JRuby 9.2.12.0 Released
Wednesday, July 01 2020
The JRuby community is pleased to announce the release of JRuby 9.2.12.0
JRuby 9.2.x is compatible with Ruby 2.5.x and stays in sync with C Ruby. As always there is a mix of miscellaneous fixes so be sure to read the issue list below. All users are encouraged to upgrade.
As we are still actively working on 9.3.0.0 we decided to put out another 9.2.x release to fix some of the more recently reported issues.
Java Integration
- The last remaining triggers of the “Illegal access” warnings and errors in JRuby core have been fixed. JRuby will avoid accessing Java modules and packages that have not been exported or opened. (#6195, #6287, #6298, #6299)
- A new option is added to work around the OpenJDK URLClassLoader concurrency bug we recently reported. Set Java property to when embedding JRuby in a JVM application to avoid “zip file closed” errors. This will be the default setting in JRuby 9.3. (#6218, #6307)
- Support for calling Kotlin has improved, avoiding warniings for companion objects. This also avoids a warning when accessing Java code where a static final field is named the same as an inner class. (#6196, #6289)
Concurrency
- An issue affecting concurrent generation of Java interface implementations has been fixed. (#6160, #6167)
- Internal optimization of Ruby code has been improved to avoid concurrency issues. (6210, #6230, #6275, 6282, #6288)
Security
A few minor security issues have been fixed. We do not consider them high risk, but we recommend users update. (#6304)
- Numeric objects now use a per-runtime random seed to generate hash values (CVE-2011-4815). The existing JRuby property can be set to to restore predictable hash values, as for other core types. (6305)
- String#unpack raised the wrong error for invalid input related to CVE-2018-8778. There was no security issue. (#6306)
- The WEBrick HTTP server provided in the Ruby standard library has been updated to 1.6.0, to address two issues with response-splitting and header injection (CVE-2017-17742 and CVE-2019-16254). This server is not typically used in production, so the exposure is limited. (#6308)
24 Github Issues resolved for 9.2.12.0
- #6308 - Update WEBrick to 1.6.0
- #6307 - Only close temporary jars to avoid poisoning global jar file cache
- #6306 - Raise RangeError for out of bounds unpack_at
- #6305 - Mimic CRuby's numeric hashing
- #6304 - Align behavior with CRuby for security specs
- #6299 - Reflective access on Java 11
- #6298 - Do not bind methods from classes that are not exported
- #6289 - Only define static field constant when inner class collides
- #6288 - Always treat non-full IC as not having protocol
- #6287 - com.sun.javafx.collections not exported in javafx.base
- #6285 - Backport 9.3 fixes for 9.2.12
- #6282 - NPE in ruby block called concurrently from Java
- #6275 - Do lazy instruction deserialization against dup'ed reader
- #6256 - Raise proper error for missing URLResource target
- #6230 - CompiledScript throws weird exception that doesn't happen with Invocable
- #6219 - JRuby thrown NullPointerException on File.open of nonexistent uri
- #6218 - Errors running multiple independent ScriptingContainers in parallel
- #6210 - Multithreaded code with function calls fail in precompiled JRuby classes
- #6196 - "warning: already initialized constant Companion" with Kotlin companion objects
- #6195 - Use all the tricks to properly eliminate illegal access warnings
- #6167 - [fix][ji] handle concurrent proxy iface impl init
- #6160 - interface proxy generation is race-y
- #6112 - [fix] Enumerable#any? does not require an arg
- #5968 - Enumerator#any? is wrong for sequence of empty arrays
HostingAdvice.com interview of Charles Oliver Nutter
Thursday, May 07 2020
Our friends over at HostingAdvice.com have written up a great JRuby intro and interview with Charles Nutter, co-lead of JRuby! If you’ve ever wondered how JRuby works or whether it might be a useful tool for your Ruby toolbox, then check out the article and let us know what you think!
HostingAdvice.com’s interview of Charles Oliver Nutter
JRuby 9.2.11.1 Released
Wednesday, March 25 2020
The JRuby community is pleased to announce the release of JRuby 9.2.11.1
JRuby 9.2.x is compatible with Ruby 2.5.x and stays in sync with C Ruby. As always there is a mix of miscellaneous fixes so be sure to read the issue list below. All users are encouraged to upgrade.
As we are actively working on 9.3.0.0 we decided to put out a mini release which fixes a single issue.
- sprintf substring string formatting with precision may expose characters (#6137)
If you format a string using a precision specifier (e.g. %.1s) AND you pass in a substring of a larger string, you may see some of the larger string’s characters in the formatted result. This is due to a bug in the handling of internal String data that causes the result to contain more characters than requested.
This bug could potentially expose sensitive content from the original String. It is unlikely to affect most users, but you are still encouraged to upgrade.
Github Issues resolved for 9.2.11.1
- #6138 - Subtract begin offset for partial substring in sprintf 's'
- #6137 - `sprintf` adds extra buffer slots when precision arg truncates string slices
JRuby 9.2.11.0 Released
Monday, March 02 2020
The JRuby community is pleased to announce the release of JRuby 9.2.11.0
JRuby 9.2.x is compatible with Ruby 2.5.x and stays in sync with C Ruby. As always there is a mix of miscellaneous fixes so be sure to read the issue list below. All users are encouraged to upgrade.
Java Integration
- Gems and gem paths packaged inside jar files will properly load now. This 9.2.10.0 regression was caused by a change in RubyGems 3 that exposed a bug in JRuby. (#6060, #6082, #6083, #6084)
Performance Improvements
- Fixed a major performance and memory bottleneck in backtrace generation, used by and friends. This was a regression in 9.2.10.0. (#6089)
Github Issues resolved for 9.2.11.0
- #6097 - CGI.escapeHTML restore the original encoding
- #6093 - CGI.escapeHTML crashes on invalid byte sequence where CRuby does not
- #6091 - Check arity earlier in JavaConstructor#new_instance
- #6090 - [9.2.10.0] bogus revision regression
- #6089 - Pontential performance issue
- #6084 - Use expand_path logic for Dir.glob base path
- #6083 - Basic smoke test with warbler no longer works with jruby-jars-9.2.10
- #6082 - Upgrade to 9.2.10.0 breaks project using asciidoctor-maven-plugin
- #6081 - Dependency convergence errors in 9.2.10.0
- #6079 - newInstance on protected/private classes sometimes give an Index OOB Exception
- #6060 - Globbed jar contents with expand path failing in RubyGems
JRuby 9.2.10.0 Released
Tuesday, February 18 2020
The JRuby community is pleased to announce the release of JRuby 9.2.10.0
JRuby 9.2.x is compatible with Ruby 2.5.x and stays in sync with C Ruby. As always there is a mix of miscellaneous fixes so be sure to read the issue list below. All users are encouraged to upgrade.
Ruby Core
- Kernel#send and BasicObject#__send__ will now honor refinements used in the surrounding scopes. (#5945, #6045)
- Kernel#eval will now honor refinements used in a given binding. (#6017)
- Process#spawn now correctly processes environment variables for the child process. (#3428, #5907)
Ruby Standard Library
- RubyGems has been updated to version 3.0.6. (#5995, #5996)
- The jruby-openssl library has been updated to 0.10.4. This release improves support for newer forms of ciphers and cryptographic keys and reduces the number of Java module warnings displayed. (#6077)
- The compatibility of the fiddle library has been improved. (#5955, #5956, #5960)
Java Support
- Java methods looked up one-at-a-time using and friends now honor Java modules. This fixes some illegal access errors introduced in JRuby 9.2.9.0. (#5894, #5969, #6043, #6069, #6072)
- More illegal access warnings have been cleaned up in JRuby and the jruby-openssl extension.
Native FFI Improvements
- The native subsystem has been rebuilt on MacOS to avoid security warnings due to the old toolchain originally used to build it. (#6044, #6074)
- Native constants have been updated for Windows to better support the Ruby socket API. (#5656, #6070, #6071)
Performance Improvements
- Several improvements to the method invocation pipeline and JVM bytecode output to improve JIT optimizations. (#5958, #5959, #5978, #5992, #6005)
- Several core methods used by Rails and the internal handling of exception backtraces have been optimized. (#5952, #5961, #5965, #5972, #6014, #6015, #6031, #6067)
JRuby Launcher
- Java options dotfiles accidentally omitted in the JRuby 9.2.9.0 release have been restored in the bin directory.
- The bash-based launcher script has been cleaned up and optimized for cross-platform compatibility. (#5977, #6007, #6016)
Thank You!
The JRuby project would not be possible without contributions from you!
This release includes pull requests or major contributions from the following Github users (in no particular order): @matthewd, @fidothe, @MariuszCwikla, @ahorek, @deivid-rodriguez, @pythias, @rotty3000, @rmannibucau, @Mrnoname1000, @kares, @mkristian, @eregon
Github Issues resolved for 9.2.10.0
- #6077 - update jruby-openssl to 0.10.4
- #6074 - Update jnr dependencies
- #6073 - Fix windows_stub_script to use jruby.exe
- #6072 - Type Error: illegal access for final methods on ReferencePipeline (stream) in Java 11
- #6071 - socket addrinfo fixes
- #6070 - ipproto values are missing on Windows
- #6069 - Generify and reuse accessible method search
- #6067 - optimize roundUpToPowerOfTwo
- #6057 - Bump mavengem-wagon version everywhere
- #6054 - Refined send
- #6044 - libjffi should be rebuilt on darwin (using newer xcode)
- #6043 - Java 11 Compatibility
- #6040 - make jruby-core-source jar has no absolute path from home dir
- #6039 - NullPointerException from FStringEqual.hashCode
- #6038 - profiler crashes with `java.lang.RuntimeException: BUG: refined marker called as method`
- #6036 - Enumerator#take duplicates objects
- #6035 - Prepare io/console for move to gem.
- #6032 - [fix] restore $! on non-local return from rescue
- #6031 - [fix] restore rescue nil performance
- #6030 - Deprecation warning message : Gem::ConfigMap
- #6029 - [fix] inspect builtin
- #6028 - revert rational test
- #6027 - [fix] SyntaxError rational overflow
- #6025 - SyntaxError (Rational (174532925199432957/1E+19) out of range)
- #6024 - Add filesystem and internal encoding names
- #6021 - Fix Enumerator fiber leaks
- #6017 - Refinements in eval with binding
- #6016 - Remove array expansion of JAVA_OPTS environment variable
- #6015 - early block return retains $! filling cause for next error
- #6014 - correct/revisit exception backtrace (and stack-trace)
- #6007 - Bash cleanup
- #6005 - Reduce block overhead
- #6002 - (refinements?) Something is passing nullblock instead of the actual block in GraphQL
- #6000 - Do not alias a Java IsEqual to equal?
- #5999 - ensure javase version in osgi meta is 8 and not 9
- #5998 - update maven-bundle-plugin and bndlib to latest
- #5997 - Stack overflow due to RubyGems warn patch
- #5996 - Update RubyGems to 3.0.6.
- #5995 - Update RubyGems
- #5992 - Make many fields on Ruby final.
- #5991 - Invalid OSGi metadata
- #5990 - The .equal? method should not be mapped to .isEqual for Java objects (e.g. Joda LocalDate)
- #5988 - java.lang.module.ResolutionException
- #5985 - fix strict_base64 for shared strings
- #5984 - Bind only public interface methods for private classes
- #5981 - Nailgun Error - org.jruby.util.NailMain: command not found
- #5979 - Maven source artifact contains full build path
- #5978 - Cache method_missing target
- #5977 - fix 'jruby: line 88: cd: ../libexec/bin: No such file …'
- #5976 - Incorrect warning line
- #5972 - optimize isGregorianLeap
- #5970 - expand #succ for bignums
- #5969 - Mutliple issues on jdk11 after ugrading to jRuby 9.2.9.0
- #5968 - Enumerator#any? is wrong for sequence of empty arrays
- #5966 - Remove usages of deprecated ConfigMap
- #5965 - isGregorianLeap in RubyDate.java - two suggestions for minor changes
- #5963 - improve BUILDING.md
- #5961 - Faster unpackm0
- #5960 - fiddle fixes
- #5959 - Tweak getCurrentContext for SPEED
- #5958 - Propagate ThreadContext through to_a implementations
- #5956 - dlload throws LoadError instead of Fiddle::DLError
- #5955 - NameError: uninitialized constant Fiddle::CParser::TYPE_SIZE_T
- #5953 - Fix Array.pack with @ directive and buffer #4727
- #5952 - Use string index in String #sub/#gsub when String pattern passed without creating a Regexp
- #5945 - Refinements are not activated in send
- #5907 - Properly override base env with supplied values for spawn
- #5905 - String#gsub given a String can avoid Regexp
- #5894 - Can't call methods of private subclasses in a module
- #5656 - Multicast Receive Broken On Windows 10
- #4727 - Array#pack buffer should start from beginning of buffer?
- #3428 - Process.spawn doesn't remove nil env variables
- #2255 - Fixnum instance variable behaviour incorrect
- #2096 - filesystem and internal encodings are missing from Encoding.name_list
JRuby 9.2.9.0 Released
Wednesday, October 30 2019
The JRuby community is pleased to announce the release of JRuby 9.2.9.0
JRuby 9.2.x is compatible with Ruby 2.5.x and stays in sync with C Ruby. As always there is a mix of miscellaneous fixes so be sure to read the issue list below. All users are encouraged to upgrade.
Ruby Standard Library
The Ruby Standard Library has been updated to Ruby 2.5.7. JRuby will now report this as our equivalent compatible Ruby version. (#5917)
RubyGems has been updated to version 2.7.10.
Security Updates
- This release removes an exploitable version of JQuery used by the rdoc library. See https://www.ruby-lang.org/en/news/2019/08/28/multiple-jquery-vulnerabilities-in-rdoc/
Java Modules Support
- Java modules are better supported in this release by checking for openness before attempting to reflect against classes from that module. This should reduce the number of module warnings on Java 9+ and make it easier to configure the JVM to open up appropriate modules and packages to JRuby applications. See also the file below, which can help you manage module options. (#5841, 5832, #5843, #5855, #5860)
Java Launcher Improvements
JVM options can now be added to global or app-local files and automatically processed by the JRuby launcher. See JRuby Java Options Files for more information. Note: This feature is not yet supported by the JRuby native launcher, installed by default in RVM. We will release an update to the native launcher soon. (#5824, #5826)
You can now pass to the JRuby launcher to get a log of exactly how we will execute your application. (#5840)
JRuby’s dev mode (via the flag) adds additional options for Java 9+ and the OpenJ9 JVM. On OpenJ9, the and flags are passed via the environment variable. (#5831)
Memory Usage Reductions
- Numerous changes in this release reduce the boot-time and run-time memory use of JRuby applications. (#5837, #5832, #5874, #5880, #5885)
Thread-safety Improvements
- Lock interruptibility broken in JRuby 9.2.8 has now been fixed. (#5863, #5875, #5942)
Process.wait APIs are now interruptible
- Threads calling , , or will use the native function to interrupt those operations. Previously these threads were not interruptible. (#1050, #5848)
Native FFI improvements
When running JRuby via the “complete” jar file, we must unpack our native FFI stub to an appropriate temporary location. If the default location we use (the host system’s default “temp” location) is not readable or does not allow executable code, we will present an informational error indicating how to correct the issue. (#1302)
This release also includes native support for DragonFly BSD. (#5768, #5828)
Time Zone Data
- Time zone data has been updated to IANA 2019c. This update includes six years of timezone changes. (#5951)
Github Issues resolved for 9.2.9.0
- #5951 - Update joda-time and joda-timezones to 2019c
- #5950 - Update all jnr dependencies and joni.
- #5943 - properly synchronize globalInlineCount
- #5942 - Mutex fixes for interruptibility
- #5940 - Improve how we acquire ThreadContext to eliminate null refs.
- #5939 - Restructure indy-based math binding.
- #5938 - regressed indy fixnum op with custom equality (==)
- #5935 - TypeError: "warn" with subclass of String constructed from heredoc
- #5934 - [fix] ensure that fnmatch pattern does not contain a NUL character
- #5931 - [test] update MRI test suite from ruby_2_5
- #5930 - dupImpl specializations
- #5929 - NPE json nested-array regression
- #5928 - faster unpack1
- #5927 - Use new RubyStringBuilder.str api to create inspected string for Exception
- #5926 - fix class nesting #5925
- #5925 - Inner Java classes are nested recursively
- #5923 - Exception inspect in wrong encoding
- #5921 - Add native.popen option to disable native popen.
- #5919 - Synchronize variable reification against real class.
- #5917 - Update stdlib to 2.5.7.
- #5915 - encoding parameter for Dir.open, Dir.new #3205 #4495
- #5912 - Deadlock with puma on JRuby 9.2.8.0
- #5910 - 'Cannot cast org.jruby.gen.RubyObject7 to org.jruby.gen.RubyObject4' errors
- #5909 - Concurrent File#flock calls of the same file results in Errno::EINVAL exception on Windows
- #5908 - Implement Java::JavaLang::Throwable#full_message
- #5906 - Java::JavaLang::Throwable missing full_message method
- #5903 - less locking in interpreter mode (due IRMethod)
- #5902 - [fix] avoid locking on class/module creation
- #5901 - singleton class initialization blocks threads
- #5900 - reporting a better error when tmp doesn't work for temporary executables
- #5898 - Enable recursive fd redirection for popen logic.
- #5897 - Simplify and use static scope for local_variables.
- #5893 - [fix] jit.excludes for block using class (and method) name
- #5891 - Clean up some backref and lastline users.
- #5889 - [feat] jit.exclude based on path/to/impl_file.rb
- #5886 - Update types.conf from ffi/ffi
- #5885 - Unable to call inherited instance method on Java class under OpenJDK 12
- #5884 - frozen path helper
- #5882 - Jruby crashes intermittently right before coverage generation
- #5880 - attempt to share loader for JIT-ed classes
- #5877 - make SecureRandom.rand public
- #5875 - Mutex behavior mismatch with MRI since JRuby 9.2.8.0
- #5874 - Reduce bytecode size from JIT
- #5873 - Kernel#warn keyword handling differs from CRuby
- #5872 - Old version of jQuery is present in the JRuby builds
- #5871 - Use Java 8 stack walker when full trace is requested.
- #5870 - respect jit.max to stop compilation
- #5869 - ArrayIndexOutOfBoundsException when using TracePoint
- #5866 - Test passing control between two threads in the ConditionVariable spec
- #5865 - Kernel#system fails with out: $stdout
- #5864 - Illegal Reflective Access Operation Warning
- #5863 - ConditionVariable#wait causes thread to wait forever in 9.2.8.0
- #5860 - automatic-module-name
- #5859 - Invalid `Tracepoint` Behavior for Blocks
- #5858 - update joda time to 2.10.3
- #5855 - Issues using bundle plugin with Java modules
- #5854 - Implement IO#pread and pwrite.
- #5853 - `slice_after` does not work on lazy Enumerators
- #5852 - Return from block broken in 9.2.8.0
- #5851 - Improvements to backtrace
- #5850 - Fix tracer.rb and get it running in CI
- #5849 - Top frame from interpreter gets wrong filename
- #5848 - Wrap Process.wait* calls with pthread_kill logic.
- #5845 - Propagate interrupt after interrupted sleep loop.
- #5843 - Move all JI setAccessible to trySetAccessible.
- #5841 - Can't call methods of private subclasses with java_method in java 12
- #5840 - Consistently resolve path of jruby.bash
- #5837 - Tweaks to reduce memory use of short commands
- #5835 - Fail gracefully when inner class const_missing finds nothing
- #5834 - enumerator review for better compatibility
- #5832 - Reduce overhead of binding Java classes and methods
- #5831 - Further improvements to dev mode
- #5830 - aligned (and faster) uniq impls + less wrapping
- #5829 - Actually release Windows for_fd fixes
- #5828 - Identify DragonFlyBSD as a platform
- #5826 - Add support for .jruby.java_opts home and cwd files
- #5824 - Provide better documentation on java command @file support
- #5816 - IO#pread and pwrite missing
- #5768 - Support for DragonFly BSD
- #5744 - first stab at a spec
- #5722 - use same parameter for DNS.allocate_request_id/free_request_id to fix leak
- #5700 - [ji] align Java array (with post 1.8 conventions)
- #5127 - system() does not return boolean when Dir.pwd is uri:classloader
- #4495 - Dir.open missing optional second keyword argument
- #1302 - JRuby fails to load FFI support with obscure error when /tmp is not writable
- #1050 - Timeout::timeout not throwing exception when timeout period reaches
JRuby 9.2.8.0 Released
Monday, August 12 2019
The JRuby community is pleased to announce the release of JRuby 9.2.8.0
JRuby 9.2.x is compatible with Ruby 2.5.x and stays in sync with C Ruby. As always there is a mix of miscellaneous fixes so be sure to read the issue list below. All users are encouraged to upgrade.
If you do find issues then report them on using our issue tracker at http://bugs.jruby.org. We also encourage users to join our IRC channel (#jruby on Freenode) and mailing lists. You may also follow @jruby on Twitter for updates.
- Substantial memory reduction (~24% less heap with a simple Rails app)
- Reduced runtime generation of specialized objects and variable scopes
- Enumerator#next logic replaced with Fiber
- Better handling of argument lists passing through Enumerator
- Open Java modules bind methods correctly
- IO and process control improvements on Java 9+ and on Windows
- More robust handling of optimized call paths for Fixnum, Float
- 90 issues fixed for 9.2.8.0
Github Issues resolved for 9.2.8.0
- #5820 - Dereference proc from interface impl singleton
- #5819 - Can't write to java.lang.System.out in java 11
- #5818 - Update JRubyPOSIXHandler.java
- #5814 - fix custom call-site performance regression
- #5813 - Allow generating reified Ruby classes with actual name.
- #5812 - [fix] Enumerable#first block signature (matches MRI)
- #5811 - Remove tag for "str".freeze idempotency test.
- #5810 - Add the column caret line when encountering a SyntaxError
- #5809 - MRI compatibility with IO::sysopen for serial ports on windows
- #5807 - [fix] resolve Range marshal compat with MRI
- #5805 - Marshal dump produces wrong output for Range objects
- #5801 - Ripper is missing EXPR_VALUE
- #5800 - #original_name overwrite on second alias_mathod
- #5799 - .singleton_methods returns an empty array after prepending
- #5795 - Re-open #5595: jruby --debug -S irb --tracer is not working
- #5793 - jruby-jars.gemspec: Drop rubyforge_project
- #5791 - In DateTime.jd, some Rational numbers cause RangeError (bignum too big to convert into `long')
- #5788 - kwargs in Array.each mutates argument
- #5781 - Support Time ranges in rand
- #5774 - Add support for IO::for_fd on windows after jnr-enxio#32
- #5773 - SecureRandom does not implement #bytes like MRI
- #5771 - unpack encoding inconsistent with MRI
- #5770 - Tweak the transcode loop to match MRI error behavior.
- #5767 - TCP Connection refused
- #5761 - Pre-generate DynamicScope shapes at build time
- #5760 - Socket error fixes
- #5754 - EHOSTUNREACH when a FTP connection cannot be established
- #5752 - RbConfigLibrary: Set CCDLFLAGS to "-fPIC"
- #5751 - mkmf: CCDLFLAGS is missing -fPIC
- #5750 - RbConfigLibrary: Set COUTFLAG to "-o "
- #5749 - mkmf: COUTFLAG does not have `-o`
- #5741 - Dependency convergence errors
- #5740 - "class is not compiled Ruby" error for string interpolation expression
- #5738 - Backtrace set with set_backtrace is not dup'd properly in 9.2.7.0
- #5737 - Jruby 9.2.7 with Java 11 "NoMethodError: undefined method `separator' for Java::JavaIo::File:Class"
- #5736 - Jruby 9.2.7 with Java 11 is throwing "Native subprocess control requires open access to sun.nio.ch" warning
- #5735 - Tempfile#open doesn't support default argument
- #5733 - Use external when windows filesystem encoding is not found
- #5731 - Fix and deprecate Java interface constant accessors
- #5730 - Constant access via . does not work when using Java 11
- #5728 - RFC: Do not add CLASSPATH to the module path
- #5726 - Ignore nil for ifnone argument in Enumerable#find
- #5723 - 0.0.to_d returns negative zero in jruby-9.2.7.0
- #5715 - Fix indexOf() RubyString method.
- #5714 - Issue when splitting an encoded string with specific characters
- #5712 - Re-add command line specs to CI and tag new failures
- #5711 - Make the PosixShim errno field into a thread-local
- #5709 - Socket#close raises EBADF after unsuccessful connection
- #5707 - Windows Traditional Chinese Edition: unknown encoding name - MS950
- #5706 - IO.read_nonblock raises EOFError with concurrent reads
- #5704 - update joda-time to latest 2.10.1
- #5703 - [ji] to_time conversion for Java DateTime types
- #5702 - #5699:adding the javax maven dependency to avoid "javax.annotation.Ge…
- #5701 - [ji] support java.math.BigDecimal#to_d
- #5698 - Regression on java array slices with a negative index introduced in 9.2.1.0
- #5697 - Test that lazy enumerator doesn't pre-evaluate
- #5695 - Run BEGIN blocks from JVM-compiled scripts.
- #5693 - pass -ea to JVM and fix asserts for test targets
- #5692 - Address all tests failing with asserts enabled
- #5691 - Licensing confusion; perhaps out of date
- #5689 - Update backport9 to 1.3
- #5688 - [test] public field accessiblity in default package
- #5686 - jruby 9.2.7.0 ships with bundler (it didn't before)
- #5685 - Streams created for file parsing are allowed to finalize
- #5684 - Can't access java member variables
- #5683 - Return to interruptible lock acquisition in Mutex.
- #5672 - Use pure-Ruby Fiber-based Enumerator#next
- #5659 - Fix -x command line option to skip header
- #5641 - File.stat.writable? returning false in JRuby, true in MRI
- #5631 - java_send/java_alias and perhaps others are not finding the proper method
- #5616 - Open3.popen3 does not work in jruby 9.2.6 with openjdk 11.0.2
- #5612 - Fix off-by-one error causing Dir.glob("foo" + "{bar}") to fail if Java asserts are enabled
- #5518 - Limit the width of reified objects to 50 by default.
- #5476 - Mutex#lock and Mutex#synchronize are not interruptible by Thread#kill
- #5284 - NoMethodError when calling protected java method from subclass On java 9
- #5249 - use of jruby causes “Errno::EBADF: Bad file descriptor” error
- #5235 - popen3 doesn't works fine with java 9/10 and jruby > 1.9.13
- #5070 - "str".freeze optimization sporadically produces a different object
- #5044 - lazy map adds extra array layer to single-element array output
- #4968 - proc binding(local variables) is not garbage collected (memory leak)
- #4839 - StackOverflow on using method_added in a mixin
- #4834 - Eliminate or configure invasive JDK class accesses for Java 9
- #4736 - Fixnum/Float 'fast-ops' working even when re-opened
- #4536 - Failing "-x" command line option
- #4419 - exit! and --debug events can cause a deadlock
- #4260 - squiggly heredoc with single quotes indent wrong
- #4212 - Lazy enumerable select eagerly evaluates next item
- #4108 - Enumerator's Yielder does not pass through one-elt array properly
- #3735 - JRuby 9.x slower than 1.7.21 when running Brakeman
- #2892 - Numeric#step issues
JRuby 9.2.7.0 Released
Tuesday, April 09 2019
The JRuby community is pleased to announce the release of JRuby 9.2.7.0
JRuby 9.2.x is compatible with Ruby 2.5.x and stays in sync with C Ruby. This version offers significant improvements to refinements. It also has a big performance gain for Rational#/. As always there is a mix of miscellaneous fixes so be sure to read the issue list below. All users are encouraged to upgrade.
If you do find issues then report them on using our issue tracker at https://github.com/jruby/jruby/issues. We also encourage users to join our IRC channel (#jruby on Freenode) and mailing lists. You may also follow @jruby on Twitter for updates.
- 53 issues fixed for 9.2.7.0
Github Issues resolved for 9.2.7.0
- #5679 - Provide better thread name for enumerator/fiber workers.
- #5678 - multicast receive broken everywhere
- #5677 - Use close_on_exec method instead of using fcntl calls for pty. Fixes #5663
- #5675 - speedup BigDecimal division
- #5670 - Update fiber/enumerator threads with info about creation
- #5664 - Incorrect parameters for core methods messes up RSpec proxies
- #5663 - File::write uses nonblocking IO when MRI uses blocking
- #5657 - Multicast Receive Broken On all Unixy machines.
- #5654 - NullPointerException with PTY.open returning null (not nil)
- #5653 - Updage to json 2.2.0
- #5652 - Remove the "Fatal" constant since it's hidden in MRI.
- #5651 - Additional pack/unpack optimizations
- #5650 - decimal performance
- #5648 - Fatal is not a module
- #5647 - Outline case bodies from unpack logic.
- #5645 - Only run deploy against actual pushes to our repo
- #5642 - Open3::capture2 and friends hang on stdin_data on Java GTE 9
- #5639 - update to jruby-openssl 0.10.2
- #5636 - Isolate debug specs and run fast suite without --debug
- #5635 - Ubuntu: JRuby startup warning
- #5634 - singleton method + zsuper issue when contained in another class?
- #5629 - Deploy snapshots after successful builds
- #5628 - Set up CI with Azure Pipelines
- #5627 - Rework method invocation to properly super
- #5626 - [fix] make Date/DateTime equality consistent
- #5625 - [fix] DateTime (civil) Float sec rounding
- #5611 - Revert "Push signal traps and at_exit blocks to a common thread for exec."
- #5610 - Revert "Make autoload dynamically dispatch to require. Fixes #5403."
- #5609 - Revert "Autoload fixes"
- #5608 - Kernel#warn doesn't handle exceptions as expected
- #5607 - Multiple adjustments to the Exception and raise logic.
- #5605 - set_backtrace should disable backtrace generation on raise
- #5604 - Improve refinements implementation
- #5584 - improve sprintf compatibility
- #5557 - Ensure symlink path names passed to File.lstat are dereferenced when necessary
- #5550 - Regression: multiple refinements of the same class
- #5547 - FileUtils.chmod failes when called on symlink under linux
- #5545 - Refinements: method can't use other methods from refinement
- #5542 - new grapheme cluster scheme in c code
- #5541 - Refinements not following inheritance
- #5539 - File::Stat#directory? returns false for symlink to directory with trailing slash
- #5489 - Autoload fixes
- #5441 - Push signal traps and at_exit blocks to a common thread for exec.
- #5404 - Make autoload dynamically dispatch to require. Fixes #5403.
- #5221 - Refinement with `super` vs. inheritance
- #5153 - Fix refinements
- #5054 - Refinement is not activated within itself
- #4531 - Order of prepends and extends can break super
- #4514 - [9.1.7.0] Refinements of a superclass's singleton_class not being honored
- #4489 - Refines coming from included modules aren't recognized by jruby
- #4237 - NullPointerException when using refinement including multiple modules and calling super
- #4236 - Refinement that includes itself does not work
- #2160 - Rational support for %f in sprintf
JRuby 9.2.6.0 Released
Monday, February 11 2019
The JRuby community is pleased to announce the release of JRuby 9.2.6.0
JRuby 9.2.x is our new major version of JRuby. It is expected to be compatible with Ruby 2.5.x and stay in sync with C Ruby. JRuby 9.2.0.0 is our first release for 2.5 support.
If you do find issues then report them on using our issue tracker at https://github.com/jruby/jruby/issues. We also encourage users to join our IRC channel (#jruby on Freenode) and mailing lists. You may also follow @jruby on Twitter for updates.
Highlights:
- 52 issues fixed for 9.2.6.0
Github Issues resolved for 9.2.6.0
- #5597 - "Useless" warnings have file as "null"
- #5596 - proc with no arguments does not pick up current block
- #5595 - IRB with tracer flag is not working
- #5591 - Eliminate all magic builtin libraries
- #5589 - Time, DateTime: fix isTzRelative book keeping
- #5587 - Time: minimal fix for Rails Time.change() problem
- #5586 - Time: fix TZ offset
- #5583 - Time: fix localtime(), getlocal(), parse() for TZ offset
- #5581 - [fix] interpret today TZ-relative but use GJ chrono
- #5580 - fix float formating regression (half-even rounding)
- #5572 - adding RbConfig TOPDIR (and related)
- #5564 - Fix time precision with fractional seconds as Rational
- #5562 - uninitialized constant RbConfig::TOPDIR
- #5558 - Time precision problem
- #5556 - float format-ing regression in 9.2
- #5554 - [fix] Thread#status should reflect exited exception
- #5548 - Define a proper annotation parameter for DynamicMethod.Version
- #5538 - Multi-rescue should not eagerly evaluate its elements
- #5533 - File modification time not properly set
- #5531 - Validate ivar and const symbols from Java before adding to table.
- #5529 - Update to psych 3.1.
- #5528 - Handle symbol dumping properly
- #5527 - Fixes #5517 (returns in unexpected place)
- #5526 - Use atomics to reduce contention within failover invaldator.
- #5525 - High lock contention invalidating "failover global" invalidator
- #5524 - backport fd leak in resolv
- #5523 - Regression with Marshal.load(a Hash)
- #5522 - test, review & avoid (regressed) mutex behavior
- #5520 - Mutex gets 'broken' sporadically (since 9.2.1)
- #5517 - NPE due to unhandled non-local return
- #5516 - Fix sub-millisecond datetime difference handling
- #5515 - Add log.singletons and .verbose to track singleton class creation.
- #5514 - Executors are not shut down during tearDown
- #5513 - String#scan raises java.lang.ArrayIndexOutOfBoundsException with multi-byte characters
- #5512 - Eliminate transient objects for looking up symbol by bytelist
- #5506 - review thread sync and clear references
- #5505 - Update stdlib to Ruby 2.5.3.
- #5504 - Also fix up return values when frame is present, for backref.
- #5503 - Problem when method returns Regexp capture group using special variable $1
- #5500 - Use Java 9 stack walking to reduce the cost of #caller and friends
- #5499 - Fix known binary compat issues with new Java 9 overloads.
- #5493 - Difference of DateTimes with fractional milliseconds calculated incorrectly
- #5479 - Update ERB stdlib from MRI 2.5.0 to at least 2.5.1
- #5462 - add java 10, 11 opcodes
- #5451 - improve cross compile compatibility
- #5450 - java.lang.NoSuchMethodError: java.nio.ByteBuffer.clear()
- #5418 - Date.today does not appear to take the local TZ into account
- #5383 - Create new pgroup when spawning process in chdir
- #5312 - test_status_and_stop_p exposes a race in Thread status
- #5169 - Reflective methods should not create symbols for nonexistent elements
- #4784 - DateTime to_time does not preserve UTC-ness
- #4157 - Kernel.sprintf("%f",...) rounds to even on MRI but JRuby rounds away from zero
JRuby 9.2.5.0 Released
Thursday, December 06 2018
The JRuby community is pleased to announce the release of JRuby 9.2.5.0
JRuby 9.2.x is our new major version of JRuby. It is expected to be compatible with Ruby 2.5.x and stay in sync with C Ruby. JRuby 9.2.0.0 is our first release for 2.5 support.
If you do find issues then report them on using our issue tracker at https://github.com/jruby/jruby/issues. We also encourage users to join our IRC channel (#jruby on Freenode) and mailing lists. You may also follow @jruby on Twitter for updates.
Highlights:
- 29 issues fixed for 9.2.5.0
Github Issues resolved for 9.2.5.0
- #5495 - Remove failed tag for Array#to_h MRI tests
- #5491 - improved error message for "wrong number of arguments"
- #5488 - [fix] RubyException#toJava(Object) shouldn't return null
- #5487 - [#5288] Overwrite parent class with module wrapper
- #5483 - Java::JavaLang::ArrayStoreException when running cucumber tests
- #5481 - Never return the internal module name as a mutable string.
- #5480 - Class names are mutable
- #5477 - mongoid driver does not work in JRuby on Windows or JRuby loads incorrect socket constants on Windows.
- #5474 - less sync-ing with thread registration
- #5461 - fix duplicate declaration
- #5460 - Revisit symbol hash and marshal fixes from #4576
- #5458 - Tempfile.open should have arity 3, to allow IO options through.
- #5456 - Tempfile.open does not recognize the 3rd argument (options to pass to File.open)
- #5455 - Fix multi-arity method binding.
- #5453 - Splatted kwarg struct init
- #5452 - Use default sg ITALY with getChronology here.
- #5448 - RubyStruct.java gives ArgumentError: unknown keywords: keyword
- #5447 - sigsev on installing gems on aarch64
- #5445 - fix max range for usec
- #5444 - fix an edge case in gcd calculation
- #5443 - fix overflow in #i_gcd
- #5435 - Allows CompiledIRMethod to inline methods when it is the host scope.
- #5433 - update jruby-readline de-ja-vu (for JRuby::Util.load_ext)
- #5417 - Improve errno detect
- #5410 - remove getClass from RubyRegexp
- #5409 - synchronize RubyHash#iteratorExitSync
- #5387 - Updated jruby-readline alters terminal settings, breaking interactive prompts
- #5288 - Regression: Refinements Broken from 9.1 to 9.2
- #5242 - OpenSSL::Cipher#update doesn't accept a buffer argument
JRuby 9.2.4.1 Released
Wednesday, November 28 2018
The JRuby community is pleased to announce the release of JRuby 9.2.4.1
JRuby 9.2.x is our new major version of JRuby. It is expected to be compatible with Ruby 2.5.x and stay in sync with C Ruby. JRuby 9.2.0.0 is our first release for 2.5 support.
If you do find issues then report them on using our issue tracker at https://github.com/jruby/jruby/issues. We also encourage users to join our IRC channel (#jruby on Freenode) and mailing lists. You may also follow @jruby on Twitter for updates.
This is a security release that updates the native Windows executables shipped in the bin directory. A user reported that several virus scanners appear to flag one of these executables, jrubyw.exe, as containing a virus. We scanned the systems used for building those executables, and were unable to find any evidence of infection, but as a precaution we have rebuilt them on a known clean system for this release.
Github Issues resolved for 9.2.4.1
- #5478 - Trojaner ALERT for JRuby 9.2.4.0 from repo1.maven.org
- #5468 - Fix generated javadoc
JRuby 9.2.4.0 Released
Tuesday, November 13 2018
The JRuby community is pleased to announce the release of JRuby 9.2.4.0
JRuby 9.2.x is our new major version of JRuby. It is expected to be compatible with Ruby 2.5.x and stay in sync with C Ruby. JRuby 9.2.0.0 is our first release for 2.5 support.
If you do find issues then report them on using our issue tracker at https://github.com/jruby/jruby/issues. We also encourage users to join our IRC channel (#jruby on Freenode) and mailing lists. You may also follow @jruby on Twitter for updates.
Highlights:
- 4 issues fixed for 9.2.4.0
Github Issues resolved for 9.2.4.0
- #5442 - fix potential int overflow
- #5439 - Local variable not updated in closure state
- #5438 - Negative nsec on Time initialisation
- #5407 - normalized Float::MIN
JRuby 9.2.3.0 Released
Friday, November 09 2018
The JRuby community is pleased to announce the release of JRuby 9.2.3.0
JRuby 9.2.x is our new major version of JRuby. It is expected to be compatible with Ruby 2.5.x and stay in sync with C Ruby. JRuby 9.2.0.0 is our first release for 2.5 support.
If you do find issues then report them on using our issue tracker at https://github.com/jruby/jruby/issues. We also encourage users to join our IRC channel (#jruby on Freenode) and mailing lists. You may also follow @jruby on Twitter for updates.
Highlights:
- 1 issues fixed for 9.2.3.0
Github Issues resolved for 9.2.3.0
- #5431 - Java::JavaLang::RuntimeException: org.jruby.runtime.scopes.DynamicScope0 only supports scopes with 0 variables
JRuby 9.2.2.0 Released
Thursday, November 08 2018
The JRuby community is pleased to announce the release of JRuby 9.2.2.0
JRuby 9.2.x is our new major version of JRuby. It is expected to be compatible with Ruby 2.5.x and stay in sync with C Ruby. JRuby 9.2.0.0 is our first release for 2.5 support.
If you do find issues then report them on using our issue tracker at https://github.com/jruby/jruby/issues. We also encourage users to join our IRC channel (#jruby on Freenode) and mailing lists. You may also follow @jruby on Twitter for updates.
Highlights:
- 4 issues fixed for 9.2.2.0
Github Issues resolved for 9.2.2.0
- #5426 - Java::JavaLang::ArrayIndexOutOfBoundsException (invalid bucket size: 0) for Set init with empty array & block
- #5423 - Process.kill(:KILL, $$) doesn't work on Windows
- #5421 - bundler on Windows - permission denied
- #5420 - jruby-dist-9.2.1.0-bin.tar.gz files is missing gem lib/exe folders
JRuby 9.2.1.0 Released
Tuesday, November 06 2018
1. About Cygwin
- 1.1. What is it?
- 1.2. What versions of Windows are supported?
- 1.3. Where can I get it?
- 1.4. Is it free software?
- 1.5. What version of Cygwin is this, anyway?
- 1.6. Who's behind the project?
1.1.
What is it?
Cygwin is a distribution of popular GNU and other Open Source tools running on Microsoft Windows. The core part is the Cygwin library which provides the POSIX system calls and environment these programs expect.
The Cygwin distribution contains thousands of packages from the Open Source world including most GNU tools, many BSD tools, an X server and a full set of X applications. If you're a developer you will find tools, headers and libraries allowing to write Windows console or GUI applications that make use of significant parts of the POSIX API. Cygwin allows easy porting of many Unix programs without the need for extensive changes to the source code. This includes configuring and building most of the available GNU or BSD software, including the packages included with the Cygwin distribution themselves. They can be used from one of the provided Unix shells like bash, tcsh or zsh.
1.2.
What versions of Windows are supported?
Cygwin can be expected to run on all modern, released versions of Windows. State January 2016 this includes Windows Vista, Windows Server 2008 and all later versions of Windows up to Windows 10 and Windows Server 2016. The 32 bit version of Cygwin also runs in the WOW64 32 bit environment on released 64 bit versions of Windows, the 64 bit version of course only on 64 bit Windows.
Keep in mind that Cygwin can only do as much as the underlying OS supports. Because of this, Cygwin will behave differently, and exhibit different limitations, on the various versions of Windows.
1.3.
Where can I get it?
The home page for the Cygwin project is https://cygwin.com/. There you should find everything you need for Cygwin, including links for download and setup, a current list of mirror sites, a User's Guide, an API Reference, mailing lists and archives.
You can find documentation for the individual GNU tools typically as man pages or info pages as part of the Cygwin net distribution. Additionally you can get the latest docs at http://www.gnu.org/manual.
1.4.
Is it free software?
Yes. Parts are GNU software (gcc, gas, ld, etc...), parts are covered by the standard X11 license, some of it is public domain, some of it was written by Red Hat (or the former Cygnus Solutions) and placed under the GPL. None of it is shareware. You don't have to pay anyone to use it but you should be sure to read the copyright section of the FAQ for more information on how the GNU General Public License may affect your use of these tools.
Note that when we say "free" we mean freedom, not price. The goal of such freedom is that the people who use a given piece of software should be able to change it to fit their needs, learn from it, share it with their friends, etc. The GPL or LGPL licenses allows you those freedoms, so it is free software.
1.5.
What version of Cygwin is this, anyway?
To find the version of the Cygwin DLL installed, you can use as on Linux or . Refer to each command's output and the Cygwin User's Guide for more information.
If you are looking for the version number for the whole Cygwin release, there is none. Each package in the Cygwin release has its own version. The packages in Cygwin are continually improving, thanks to the efforts of net volunteers who maintain the Cygwin binary ports. Each package has its own version numbers and its own release process.
So, how do you get the most up-to-date version of Cygwin? Easy. Just download the Cygwin Setup program by following the instructions here. The setup program will handle the task of updating the packages on your system to the latest version. For more information about using Cygwin's , see Setting Up Cygwin in the Cygwin User's Guide.
1.6.
Who's behind the project?
(Please note that if you have cygwin-specific questions, all of these people will appreciate it if you use the cygwin mailing lists rather than sending personal email.)
Corinna Vinschen is the current project lead. Corinna is a senior Red Hat engineer. Corinna is responsible for the Cygwin library and maintains a couple of packages, for instance OpenSSH, OpenSSL, and a lot more.
Yaakov Selkowitz is another Red Hat engineer working on the Cygwin project. He's the guy behind the current build and packaging system and maintains by far the most packages in the Cygwin distribution.
Jon Turney is developer and maintainer of the Cygwin X server and a couple of related packages.
The packages in the Net release are maintained by a large group of people; a complete list can be found here.
Please note that all of us working on Cygwin try to be as responsive as possible and deal with patches and questions as we get them, but realistically we don't have time to answer all of the email that is sent to the main mailing list. Making Net releases of the Win32 tools and helping people on the Net out is not our primary job function, so some email will have to go unanswered.
Many thanks to everyone using the tools for their many contributions in the form of advice, bug reports, and code fixes. Keep them coming!
2. Setting up Cygwin
- 2.1. What is the recommended installation procedure?
- 2.2. What about an automated Cygwin installation?
- 2.3. Does Setup accept command-line arguments?
- 2.4. Can I install Cygwin without administrator rights?
- 2.5. Why not install in C:\?
- 2.6. Can I use Cygwin Setup to get old versions of packages (like gcc-2.95)?
- 2.7. How does Cygwin secure the installation and update process?
- 2.8. What else can I do to ensure that my installation and updates are secure?
- 2.9. Is Cygwin Setup, or one of the packages, infected with a virus?
- 2.10. My computer hangs when I run Cygwin Setup!
- 2.11. What packages should I download? Where are 'make', 'gcc', 'vi', etc?
- 2.12. How do I just get everything?
- 2.13. How much disk space does Cygwin require?
- 2.14. How do I know which version I upgraded from?
- 2.15. What if setup fails?
- 2.16. My Windows logon name has a space in it, will this cause problems?
- 2.17. My HOME environment variable is not what I want.
- 2.18. How do I uninstall individual packages?
- 2.19. How do I uninstall a Cygwin service?
- 2.20. How do I uninstall all of Cygwin?
- 2.21. How do I install snapshots?
- 2.22. Can Cygwin Setup maintain a ``mirror''?
- 2.23. How can I make my own portable Cygwin on CD?
- 2.24. How do I save, restore, delete, or modify the Cygwin information stored in the registry?
2.1.
What is the recommended installation procedure?
There is only one recommended way to install Cygwin, which is to use the GUI installer setup-*.exe. It is flexible and easy to use. You can pick and choose the packages you wish to install, and update them individually. Full source code is available for all packages and tools. More information on using Cygwin Setup may be found at https://cygwin.com/cygwin-ug-net/setup-net.html.
If you do it any other way, you're on your own! If something doesn't work right for you, and it's not covered here or in the latest development snapshot at https://cygwin.com/snapshots/, then by all means report it to the mailing list.
For a searchable list of packages that can be installed with Cygwin, see https://cygwin.com/packages/.
2.2.
What about an automated Cygwin installation?
The Cygwin Setup program is designed to be interactive, but there are a few different ways to automate it. If you are deploying to multiple systems, the best way is to run through a full installation once, saving the entire downloaded package tree. Then, on target systems, run Cygwin Setup as a "Local Install" pointed at your downloaded package tree. You could do this non-interactively with the command line options , where your downloaded package tree is in (see the next FAQ for an explanation of those options.)
For other options, search the mailing lists with terms such as cygwin automated setup or automated cygwin install.
2.3.
Does Setup accept command-line arguments?
Yes, run or for a list.
--allow-unsupported-windows Allow old, unsupported Windows versions -a --arch architecture to install (x86_64 or x86) -C --categories Specify entire categories to install -o --delete-orphans remove orphaned packages -A --disable-buggy-antivirus Disable known or suspected buggy anti virus software packages during execution. -D --download Download from internet -f --force-current select the current version for all packages -h --help print help -I --include-source Automatically include source download -i --ini-basename Use a different basename, e.g. "foo", instead of "setup" -U --keep-untrusted-keys Use untrusted keys and retain all -L --local-install Install from local directory -l --local-package-dir Local package directory -m --mirror-mode Skip availability check when installing from local directory (requires local directory to be clean mirror!) -B --no-admin Do not check for and enforce running as Administrator -d --no-desktop Disable creation of desktop shortcut -r --no-replaceonreboot Disable replacing in-use files on next reboot. -n --no-shortcuts Disable creation of desktop and start menu shortcuts -N --no-startmenu Disable creation of start menu shortcut -X --no-verify Don't verify setup.2.4.
Can I install Cygwin without administrator rights?
Yes. The default installation requests administrator rights because this allows to set up the Cygwin environment so that all users can start a Cygwin shell out of the box. However, if you don't have administrator rights for your machine, and the admins don't want to install it for you, you can install Cygwin just for yourself by downloading setup-x86.exe (for a 32 bit install) or setup-x86_64.exe (for a 64 bit install) and then start it from the command line or via the "Run..." dialog from the start menu using the option, for instance:
setup-x86.exe --no-admin2.5.
Why not install in C:\?
The Cygwin Setup program will prompt you for a "root" directory. The default is , but you can change it. You are urged not to choose something like (the root directory on the system drive) for your Cygwin root. If you do, then critical Cygwin system directories like , and could easily be corrupted by other (non-Cygwin) applications or packages that use , or . Perhaps there is no conflict now, but who knows what you might install in the future? It's also just good common sense to segregate your Cygwin "filesystems" from the rest of your Windows system disk.
(In the past, there had been genuine bugs that would cause problems for people who installed in , but we believe those are gone now.)
2.6.
Can I use Cygwin Setup to get old versions of packages (like gcc-2.95)?
Cygwin Setup can be used to install any packages that are on a Cygwin mirror, which usually includes one version previous to the current one. The complete list may be searched at https://cygwin.com/packages/. There is no complete archive of older packages. If you have a problem with the current version of a Cygwin package, please report it to the mailing list using the guidelines at https://cygwin.com/problems.html.
That said, if you really need an older package, you may be able to find an outdated or archival mirror by searching the web for an old package version (for example, ), but keep in mind that this older version will not be supported by the mailing list and that installing the older version will not help improve Cygwin.
2.7.
How does Cygwin secure the installation and update process?
Here is how Cygwin secures the installation and update process to counter man-in-the-middle (MITM) attacks:
The Cygwin website provides the setup program ( or ) using HTTPS (SSL/TLS). This authenticates that the setup program came from the Cygwin website (users simply use their web browsers to download the setup program). You can use tools like Qualsys' SSL Server Test, https://www.ssllabs.com/ssltest/, to check the HTTPS configuration of Cygwin. The cygwin.com site supports HTTP Strict Transport Security (HSTS), which forces the browser to keep using HTTPS once the browser has seen it before (this counters many downgrade attacks).
The setup program has the Cygwin public key embedded in it. The Cygwin public key is protected from attacker subversion during transmission by the previous step, and this public key is then used to protect all later steps. You can confirm that the key is in setup by looking at the setup project (http://sourceware.org/cygwin-apps/setup.html) source code file (the key is automatically generated from file ).
The setup program downloads the package list from a mirror and checks its digital signature. The package list is in the file (compressed) or (uncompressed) on the selected mirror. The package list includes for every official Cygwin package the package name, cryptographic hash, and length (in bytes). The setup program also gets the relevant (signature) file for that package list, and checks that the package list is properly signed with the Cygwin public key embedded in the setup program. A mirror could corrupt the package list and/or signature, but this would be detected by setup program's signature detection (unless you use the option to disable signature checking). The setup program also checks the package list timestamp/version and reports to the user if the file goes backwards in time; that process detects downgrade attacks (e.g., where an attacker subverts a mirror to send a signed package list that is older than the currently-downloaded version).
The packages to be installed (which may be updates) are downloaded and both their lengths and cryptographic hashes (from the signed file) are checked. Non-matching packages are rejected, countering any attacker's attempt to subvert the files on a mirror. Cygwin currently uses the cryptographic hash function SHA-512 for the files.
Cygwin uses the cryptographic hash algorithm SHA-512 as of 2015-03-23. The earlier 2015-02-06 update of the setup program added support for SHA-512 (Cygwin previously used MD5). There are no known practical exploits of SHA-512 (SHA-512 is part of the widely-used SHA-2 suite of cryptographic hashes).
2.8.
What else can I do to ensure that my installation and updates are secure?
To best secure your installation and update process, download the setup program (32-bit) or (64-bit), and then check its signature (using a signature-checking tool you trust) using the Cygwin public key (https://cygwin.com/key/pubring.asc). This was noted on the front page for installing and updating.
If you use the actual Cygwin public key, and have an existing secure signature-checking process, you will counter many other attacks such as subversion of the Cygwin website and malicious certificates issued by untrustworthy certificate authorities (CAs). One challenge, of course, is ensuring that you have the actual Cygwin public key. You can increase confidence in the Cygwin public key by checking older copies of the Cygwin public key (to see if it's been the same over time). Another challenge is having a secure signature-checking process. You can use GnuPG to check signatures; if you have a trusted Cygwin installation you can install GnuPG. Otherwise, to check the signature you must use an existing trusted tool or install a signature-checking tool you can trust.
Not everyone will go through this additional effort, but we make it possible for those who want that extra confidence. We also provide automatic mechanisms (such as our use of HTTPS) for those with limited time and do not want to perform the signature checking on the setup program itself. Once the correct setup program is running, it will counter other attacks as described in https://cygwin.com/faq/faq.html#faq.setup.install-security.
2.9.
Is Cygwin Setup, or one of the packages, infected with a virus?
Unlikely. Unless you can confirm it, please don't report it to the mailing list. Anti-virus products have been known to detect false positives when extracting compressed tar archives. If this causes problems for you, consider disabling your anti-virus software when running . Read the next entry for a fairly safe way to do this.
2.10.
My computer hangs when I run Cygwin Setup!
Both Network Associates (formerly McAfee) and Norton anti-virus products have been reported to "hang" when extracting Cygwin tar archives. If this happens to you, consider disabling your anti-virus software when running Cygwin Setup. The following procedure should be a fairly safe way to do that:
Download or and scan it explicitly.
Turn off the anti-virus software.
Run setup to download and extract all the tar files.
Re-activate your anti-virus software and scan everything in C:\cygwin (or wherever you chose to install), or your entire hard disk if you are paranoid.
This should be safe, but only if Cygwin Setup is not substituted by something malicious. See also https://cygwin.com/faq/faq.html#faq.setup.install-security for a description of how the Cygwin project counters man-in-the-middle (MITM) attacks.
See also https://cygwin.com/faq/faq.html#faq.using.bloda for a list of applications that have been known, at one time or another, to interfere with the normal functioning of Cygwin.
2.11.
What packages should I download? Where are 'make', 'gcc', 'vi', etc?
When using Cygwin Setup for the first time, the default is to install a minimal subset of all available packages. If you want anything beyond that, you will have to select it explicitly. See https://cygwin.com/packages/ for a searchable list of available packages, or use as described in the Cygwin User's Guide at https://cygwin.com/cygwin-ug-net/cygcheck.html.
If you want to build programs, of course you'll need , , and probably other packages from the ``Devel'' category. Text editors can be found under ``Editors''.
2.12.
How do I just get everything?
Long ago, the default was to install everything, much to the irritation of most users. Now the default is to install only a basic core of packages. Cygwin Setup is designed to make it easy to browse categories and select what you want to install or omit from those categories. It's also easy to install everything:
At the ``Select Packages'' screen, in ``Categories'' view, at the line marked ``All'', click on the word ``default'' so that it changes to ``install''. (Be patient, there is some computing to do at this step. It may take a second or two to register the change.) This tells Setup to install everything, not just what it thinks you should have by default.
Now click on the ``View'' button (twice) until you get to the ``Pending'' view. This shows exactly which packages are about to be downloaded and installed.
This procedure only works for packages that are currently available. There is no way to tell Cygwin Setup to install all packages by default from now on. As new packages become available that would not be installed by default, you have to repeat the above procedure to get them.
In general, a better method (in my opinion), is to:
First download & install all packages that would normally be installed by default. This includes fundamental packages and any updates to what you have already installed. Then...
Run Cygwin Setup again, and apply the above technique to get all new packages that would not be installed by default. You can check the list in the ``Pending'' view before proceeding, in case there's something you really don't want.
In the latest version of Cygwin Setup, if you click the ``View'' button (twice) more, it shows packages not currently installed. You ought to check whether you really want to install everything!
2.13.
How much disk space does Cygwin require?
That depends, obviously, on what you've chosen to download and install. A full installation today is probably larger than 1 GB installed, not including the package archives themselves nor the source code.
After installation, the package archives remain in your ``Local Package Directory''. By default the location of . You may conserve disk space by deleting the subdirectories there. These directories will have very weird looking names, being encoded with their URLs (named ).
Of course, you can keep them around in case you want to reinstall a package. If you want to clean out only the outdated packages, Michael Chase has written a script called , available at in a Cygwin mirror.
2.14.
How do I know which version I upgraded from?
Detailed logs of the most recent Cygwin Setup session can be found in and less verbose information about prior actions is in .
2.15.
What if setup fails?
First, make sure that you are using the latest version of Cygwin Setup. The latest version is always available from the Cygwin Home Page at https://cygwin.com/.
If you are downloading from the Internet, setup will fail if it cannot download the list of mirrors at https://cygwin.com/mirrors.html. It could be that the network is too busy. Something similar could be the cause of a download site not working. Try another mirror, or try again later.
If setup refuses to download a package that you know needs to be upgraded, try deleting that package's entry from /etc/setup. If you are reacting quickly to an announcement on the mailing list, it could be that the mirror you are using doesn't have the latest copy yet. Try another mirror, or try again tomorrow.
If setup has otherwise behaved strangely, check the files and in ( by default). It may provide some clues as to what went wrong and why.
If you're still baffled, search the Cygwin mailing list for clues. Others may have the same problem, and a solution may be posted there. If that search proves fruitless, send a query to the Cygwin mailing list. You must provide complete details in your query: version of setup, options you selected, contents of setup.log and setup.log.full, what happened that wasn't supposed to happen, etc.
2.16.
My Windows logon name has a space in it, will this cause problems?
Most definitely yes! UNIX shells (and thus Cygwin) use the space character as a word delimiter. Under certain circumstances, it is possible to get around this with various shell quoting mechanisms, but you are much better off if you can avoid the problem entirely.
You have two choices:
You can rename the user in the Windows User Manager GUI.
If that's not possible, you can create an /etc/passwd file using the mkpasswd command. Then you can simply edit your Cygwin user name (first field). It's also a good idea to avoid spaces in the home directory.
2.17.
My environment variable is not what I want.
When starting Cygwin from Windows, is determined as follows:
If is set in the Windows environment, translated to POSIX form.
Otherwise, use the pw_home field from the passwd entry as returned by getent passwd. If you want to learn how this field is set by Cygwin and how you can change it, this is explained in great detail in the Cygwin User's Guide at https://cygwin.com/cygwin-ug-net/ntsec.html.
When using Cygwin from a network login (via ssh for instance), is always taken from the passwd entry.
If your is set to a value such as /cygdrive/c, it is likely that it was set in Windows. Start a DOS Command Window and type "set HOME" to verify if this is the case.
Access to shared drives is often restricted when starting from the network, thus Domain users may wish to have a different in the Windows environment (on shared drive) than in Cygwin (on local drive). Note that ssh only considers the account information as retrieved by getpwnam(3), disregarding .
2.18.
How do I uninstall individual packages?
Run Cygwin Setup as you would to install packages. In the list of packages to install, browse the relevant category or click on the ``View'' button to get a full listing. Click on the cycle glyph until the action reads ``Uninstall''. Proceed by clicking ``Next''.
2.19.
How do I uninstall a Cygwin service?
List all services you have installed with . If you do not have installed, skip this FAQ.
Before removing the service, you should stop it with . If you have configured to run as a standalone service, it will not show up in the list, but will work to stop it as well.
Lastly, remove the service with .
2.20.
How do I uninstall all of Cygwin?
Setup has no automatic uninstall facility. The recommended method to remove all of Cygwin is as follows:
If you have any Cygwin services running, remove by repeating the instructions in https://cygwin.com/faq/faq.html#faq.setup.uninstall-service for all services that you installed. Common services that might have been installed are , , , , , , and so on.
Stop the X11 server if it is running, and terminate any Cygwin programs that might be running in the background. Exit the command prompt and ensure that no Cygwin processes remain. Note: If you want to save your mount points for a later reinstall, first save the output of as described at https://cygwin.com/cygwin-ug-net/mount.html.
If you installed by running the shell script as described in https://cygwin.com/cygwin-ug-net/ntsec.html, then you need to configure Windows to stop using the LSA authentication package. You do so by editing the registry and restoring back to it's original value of , and then rebooting.
Delete the Cygwin root folder and all subfolders. If you get an error that an object is in use, then ensure that you've stopped all services and closed all Cygwin programs. If you get a 'Permission Denied' error then you will need to modify the permissions and/or ownership of the files or folders that are causing the error. For example, sometimes files used by system services end up owned by the SYSTEM account and not writable by regular users.
The quickest way to delete the entire tree if you run into this problem is to take ownership of all files and folders to your account. To do this in Windows Explorer, right click on the root Cygwin folder, choose Properties, then the Security tab. If you are using Simple File Sharing, you will need to boot into Safe Mode to access the Security tab. Select Advanced, then go to the Owner tab and make sure your account is listed as the owner. Select the 'Replace owner on subcontainers and objects' checkbox and press Ok. After Explorer applies the changes you should be able to delete the entire tree in one operation. Note that you can also achieve by using other tools such as or directly from Cygwin by using . Please note that you shouldn't use the recursive form of chown on directories that have other file systems mounted under them (specifically you must avoid ) since you'd change ownership of the files under those mount points as well.
Delete the Cygwin shortcuts on the Desktop and Start Menu, and anything left by setup-x86{_64}.exe in the download directory. However, if you plan to reinstall Cygwin it's a good idea to keep your setup-x86{_64}.exe download directory since you can reinstall the packages left in its cache without redownloading them.
If you added Cygwin to your system path, you should remove it unless you plan to reinstall Cygwin to the same location. Similarly, if you set your CYGWIN environment variable system-wide and don't plan to reinstall, you should remove it.
Finally, if you want to be thorough you can delete the registry tree under and/or . However, if you followed the directions above you will have already removed everything important. Typically only the installation directory has been stored in the registry at all.
2.21.
How do I install snapshots?
First, are you sure you want to do this? Snapshots are risky. They have not been tested. Use them only if there is a feature or bugfix that you need to try, and you are willing to deal with any problems, or at the request of a Cygwin developer.
You cannot use Cygwin Setup to install a snapshot.
First, you will need to download the snapshot from the snapshots page at https://cygwin.com/snapshots/. Note the directory where you saved the snapshot tarball.
Before installing a snapshot, you must first Close all Cygwin applications, including shells and services (e.g., , ). You will not be able to replace if any Cygwin process is running. You may have to restart Windows to clear the DLL from memory (beware of automatic service startup).
Most of the downloaded snapshot can be installed using . Cygwin won't be able to update (because it's used by itself), but it should succeed with everything else. If you are only installing the DLL snapshot, skip the first tar command. Open a shell (it should be the only running Cygwin process) and issue the following commands:
/bin/tar -C / -xvf /posix/path/to/cygwin-inst-YYYYMMDD.tar.* --exclude=usr/bin/cygwin1.dll /bin/tar -C /tmp -xvf /posix/path/to/cygwin-inst-YYYYMMDD.tar.* usr/bin/cygwin1.dllExit the bash shell, and use Explorer or the Windows command shell to first rename to and then move to (assuming you installed Cygwin in ).
The operative word in trying the snapshots is "trying". If you notice a problem with the snapshot that was not present in the release DLL (what we call a "regression"), please report it to the Cygwin mailing list (see https://cygwin.com/problems.html for problem reporting guidelines). If you wish to go back to the older version of the DLL, again, close all Cygwin processes, delete , and rename back to (again assuming that your "" is ). To restore the rest of the snapshot files, reinstall the "" package using Setup.
2.22.
Can Cygwin Setup maintain a ``mirror''?
NO. Cygwin Setup cannot do this for you. Use a tool designed for this purpose. See http://rsync.samba.org/, http://www.gnu.org/software/wget/ for utilities that can do this for you. For more information on setting up a custom Cygwin package server, see the Cygwin Setup homepage at https://sourceware.org/cygwin-apps/setup.html.
2.23.
How can I make my own portable Cygwin on CD?
While some users have successfully done this, for example Indiana University's XLiveCD http://racinfo.indiana.edu/research/xlivecd.php, there is no easy way to do it. Full instructions for constructing a portable Cygwin on CD by hand can be found on the mailing list at https://www.cygwin.com/ml/cygwin/2003-07/msg01117.html (Thanks to fergus at bonhard dot uklinux dot net for these instructions.) Please note that these instructions are very old and are referring to the somewhat different setup of a Cygwin 1.5.x release. As soon as somebody set this up for recent Cygwin releases, we might add this information here.
2.24.
How do I save, restore, delete, or modify the Cygwin information stored in the registry?
Cygwin doesn't store anything important in the registry anymore for quite some time. There's no reason to save, restore or delete it.
3. Further Resources
- 3.1. Where's the documentation?
- 3.2. What Cygwin mailing lists can I join?
- 3.3. What if I have a problem? (Or: Why won't you/the mailing list answer my questions?)
3.1.
Where's the documentation?
If you have installed Cygwin, you can find lots of documentation in . Some packages have Cygwin specific instructions in a file . In addition, many packages ship with standard documentation, which you can find in or by using the or tools. (Hint: use to list what man pages the package includes.) Some older packages still keep their documentation in instead of .
There are links to quite a lot of documentation on the main Cygwin project web page, https://cygwin.com/, including this FAQ. Be sure to at least read any 'Release Notes' or 'Readme' or 'read this' links on the main web page, if there are any.
There is a comprehensive Cygwin User's Guide at https://cygwin.com/cygwin-ug-net/cygwin-ug-net.html and an API Reference at https://cygwin.com/cygwin-api/cygwin-api.html.
You can find documentation for the individual GNU tools at http://www.gnu.org/manual/.
3.2.
What Cygwin mailing lists can I join?
Comprehensive information about the Cygwin mailing lists can be found at https://cygwin.com/lists.html.
3.3.
What if I have a problem? (Or: Why won't you/the mailing list answer my questions?)
Comprehensive information about reporting problems with Cygwin can be found at https://cygwin.com/problems.html.
4. Using Cygwin
- 4.1. Why can't my application locate cygncurses-8.dll? or cygintl-3.dll? or cygreadline6.dll? or ...?
- 4.2. Starting a new terminal window is slow. What's going on?
- 4.3. Why is Cygwin suddenly so slow?
- 4.4. Why can't my services access network shares?
- 4.5. How should I set my PATH?
- 4.6. Bash (or another shell) says "command not found", but it's right there!
- 4.7. How do I convert between Windows and UNIX paths?
- 4.8. Why doesn't bash read my .bashrc file on startup?
- 4.9. How can I get bash filename completion to be case insensitive?
- 4.10. Can I use paths/filenames containing spaces in them?
- 4.11. Why can't I cd into a shortcut to a directory?
- 4.12. I'm having basic problems with find. Why?
- 4.13. Why doesn't su work?
- 4.14. Why doesn't man -k, apropos or whatis work?
- 4.15. Why doesn't chmod work?
- 4.16. Why doesn't my shell script work?
- 4.17. How do I print under Cygwin?
- 4.18. Why don't international (Unicode) characters work?
- 4.19. My application prints international characters but I only see gray boxes
- 4.20. Is it OK to have multiple copies of the DLL?
- 4.21. I read the above but I want to bundle Cygwin with a product, and ship it to customer sites. How can I do this without conflicting with any Cygwin installed by the user?
- 4.22. Can I bundle Cygwin with my product for free?
- 4.23. But doesn't that mean that if some application installs an older Cygwin DLL on top of a newer DLL, my application will break?
- 4.24. Why isn't package XYZ available in Cygwin?
- 4.25. Why is the Cygwin package of XYZ so out of date?
- 4.26. How can I access other drives?
- 4.27. How can I copy and paste into Cygwin console windows?
- 4.28. What firewall should I use with Cygwin?
- 4.29. How can I share files between Unix and Windows?
- 4.30. Is Cygwin case-sensitive??
- 4.31. What about DOS special filenames?
- 4.32. When it hangs, how do I get it back?
- 4.33. Why the weird directory structure?
- 4.34. How do anti-virus programs like Cygwin?
- 4.35. Is there a Cygwin port of GNU Emacs?
- 4.36. Is there a Cygwin port of XEmacs?
- 4.37. Why don't some of my old symlinks work anymore?
- 4.38. Why don't symlinks work on Samba-mounted filesystems?
- 4.39. Why does public key authentication with ssh fail after updating to Cygwin 1.7.34 or later?
- 4.40. Why is my .rhosts file not recognized by rlogin anymore after updating to Cygwin 1.7.34?
- 4.41. Why do my files have extra permissions after updating to Cygwin 1.7.34?
- 4.42. Why do my Tk programs not work anymore?
- 4.43. What applications have been found to interfere with Cygwin?
- 4.44. How do I fix fork() failures?
- 4.45. How do I fix find_fast_cwd warnings?
4.1.
Why can't my application locate cygncurses-8.dll? or cygintl-3.dll? or cygreadline6.dll? or ...?
Well, something has gone wrong somehow...
To repair the damage, you must run Cygwin Setup again, and re-install the package which provides the missing DLL package.
If you already installed the package at one point, Cygwin Setup won't show the option to install the package by default. In the ``Select packages to install'' dialog, click on the button. This lists all packages, even those that are already installed. Scroll down to locate the missing package, for instance . Click on the ``cycle'' glyph until it says ``Reinstall''. Continue with the installation.
For a detailed explanation of the general problem, and how to extend it to other missing DLLs and identify their containing packages, see https://cygwin.com/ml/cygwin/2002-01/msg01619.html.
4.2.
Starting a new terminal window is slow. What's going on?
There are many possible causes for this.
If your terminal windows suddenly began starting slowly after a Cygwin upgrade, it may indicate issues in the authentication setup.
For almost all its lifetime, Cygwin has used Unix-like and files to mirror the contents of the Windows SAM and AD databases. Although these files can still be used, since Cygwin 1.7.34, new installations now use the SAM/AD databases directly.
To switch to the new method, move these two files out of the way and restart the Cygwin terminal. That runs Cygwin in its new default mode.
If you are on a system that isn't using AD domain logins, this makes Cygwin use the native Windows SAM database directly, which may be faster than the old method involving and such. At worst, it will only be a bit slower. (The speed difference you see depends on which benchmark you run.) For the AD case, it can be slower than the old method, since it is trading a local file read for a network request. Version 1.7.35 will reduce the number of AD server requests the DLL makes relative to 1.7.34, with the consequence that you will now have to alter in order to change your Cygwin home directory, instead of being able to change it from the AD configuration.
If you are still experiencing very slow shell startups, there are a number of other things you can look into:
One common cause of slow Cygwin Terminal starts is a bad DNS setup. This particularly affects AD clients, but there may be other things in your Cygwin startup that depend on getting fast answers back from a network server.
Keep in mind that this may affect Cygwin even when the domain controller is on the same machine as Cygwin, or is on a nearby server. A bad DNS server IP can cause long delays while the local TCP/IP stack times out on a connection to a server that simply isn't there, for example.
Another cause for AD client system is slow DC replies, commonly observed in configurations with remote DC access. The Cygwin DLL queries information about every group you're in to populate the local cache on startup. You may speed up this process a little by caching your own information in local files. Run these commands in a Cygwin terminal with write access to :
getent passwd $(id -u) > /etc/passwd getent group $(id -G) > /etc/groupAlso, set as follows:
passwd: files db group: files dbThis will limit the need for Cygwin to contact the AD domain controller (DC) while still allowing for additional information to be retrieved from DC, such as when listing remote directories.
Either in addition to the previous item or instead of it, you can run cygserver as a local caching service to speed up DC requests.
Cygwin programs will check with cygserver before trying to query the DC directly.
A less preferable option is to create a static read-only cache of the authentication data. This is the old-fashioned method of making Cygwin integrate with AD, the only method available in releases before 1.7.34. To do this, run mkpasswd and mkgroup, then put the following into to make Cygwin treat these files as the only sources of user and group information:
passwd: files group: filesBy leaving out the option, we are telling the Cygwin DLL not to even try to do AD lookups. If your AD servers are slow, this local cache will speed things up. The downside is that you open yourself up to the stale cache problem: any time the AD databases change, your local cache will go out of date until you update the files manually.
If none of the above helps, the best troubleshooting method is to run your startup scripts in debug mode. Right-click your Cygwin Terminal icon, go to Properties, and edit the command. It should be something like C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico -. Assuming you are using Bash for your login shell, change it to C:\cygwin\bin\mintty /bin/bash -lx then try running Cygwin Terminal again. The option tells Bash to write every command it runs to the terminal before launching it. If the terminal immediately starts filling with lines of text but then pauses, the line where the output paused is your clue as to what's going on. The Cygwin DLL proper probably isn't the cause of the slowdown in this case, since those delays happen before the first line of text appears in the terminal.
4.3.
Why is Cygwin suddenly so slow?
If suddenly every command takes a very long time, then something is probably attempting to access a network share. You may have the obsolete notation in your PATH or startup files. Using means to contact the network server, which will slow things down tremendously if it does not exist.
4.4.
Why can't my services access network shares?
If your service is one of those which switch the user context (sshd, inetd, etc), then it depends on the method used to switch to another user. This problem as well as its solution is described in detail in the Cygwin User's Guide, see https://cygwin.com/cygwin-ug-net/ntsec.html.
Workarounds include using public network share that does not require authentication (for non-critical files), providing your password to a net use command, or running the service as your own user with (see for more information).
4.5.
How should I set my PATH?
This is done for you in the file /etc/profile, which is sourced by bash when you start it from the Desktop or Start Menu shortcut, created by . The line is
PATH="/usr/local/bin:/usr/bin:/bin:$PATH"Effectively, this prepends /usr/local/bin and /usr/bin to your Windows system path. If you choose to reset your PATH, say in $HOME/.bashrc, or by editing etc/profile directly, then you should follow this rule. You must have in your PATH before any Windows system directories. (And you must not omit the Windows system directories!) Otherwise you will likely encounter all sorts of problems running Cygwin applications.
If you're using another shell than bash (say, tcsh), the mechanism is the same, just the names of the login scripts are different.
4.6.
Bash (or another shell) says "command not found", but it's right there!
If you compile a program, you might find that you can't run it:
bash$ gcc -o hello hello.c bash$ hello bash: hello: command not foundUnlike the Windows default behaviour, Unix shells like bash do not look for programs in (the current directory) by default. You can add to your PATH (see above), but this is not recommended (at least on UNIX) for security reasons. Just tell bash where to find it, when you type it on the command line:
bash$ gcc -o hello hello.c bash$ ./hello Hello World!4.7.
How do I convert between Windows and UNIX paths?
Use the 'cygpath' utility. Type '' for information. For example (on my installation):
bash$ cygpath --windows ~/.bashrc D:\starksb\.bashrc bash$ cygpath --unix C:/cygwin/bin/ls.exe /usr/bin/ls.exe bash$ cygpath --unix C:\\cygwin\\bin\\ls.exe /usr/bin/ls.exeNote that bash interprets the backslash '\' as an escape character, so you must type it twice in the bash shell if you want it to be recognized as such.
4.8.
Why doesn't bash read my .bashrc file on startup?
Your .bashrc is read from your home directory specified by the HOME environment variable. It uses /.bashrc if HOME is not set. So you need to set HOME (and the home dir in your passwd account information) correctly.
4.9.
How can I get bash filename completion to be case insensitive?
Add the following to your file:
shopt -s nocasegloband add the following to your file:
set completion-ignore-case on4.10.
Can I use paths/filenames containing spaces in them?
Cygwin does support spaces in filenames and paths. That said, some utilities that use the library may not, since files don't typically contain spaces in Unix. If you stumble into problems with this, you will need to either fix the utilities or stop using spaces in filenames used by Cygwin tools.
In particular, bash interprets space as a word separator. You would have to quote a filename containing spaces, or escape the space character. For example:
bash-2.03$ cd '/cygdrive/c/Program Files'or
bash-2.03$ cd /cygdrive/c/Program\ Files4.11.
Why can't I cd into a shortcut to a directory?
Cygwin does not follow MS Windows Explorer Shortcuts (*.lnk files). It sees a shortcut as a regular file and this you cannot "cd" into it.
Cygwin is also capable to create POSIX symlinks as Windows shortcuts (see the CYGWIN environment variable option "winsymlinks"), but these shortcuts are different from shortcuts created by native Windows applications. Windows applications can usually make use of Cygwin shortcuts but not vice versa. This is by choice. The reason is that Windows shortcuts may contain a bunch of extra information which would get lost, if, for example, Cygwin tar archives and extracts them as symlinks.
Changing a Cygwin shortcut in Windows Explorer usually changes a Cygwin shortcut into a Windows native shortcut. Afterwards, Cygwin will not recognize it as symlink anymore.
4.12.
I'm having basic problems with find. Why?
Make sure you are using the find that came with Cygwin and that you aren't picking up the Win32 find command instead. You can verify that you are getting the right one by doing a "type find" in bash.
If the path argument to find, including current directory (default), is itself a symbolic link, then find will not traverse it unless you specify the option. This behavior is different than most other UNIX implementations, but is not likely to change.
If find does not seem to be producing enough results, or seems to be missing out some directories, you may be experiencing a problem with one of find's optimisations. The absence of and directories on some filesystems, such as DVD-R UDF, can confuse find. See the documentation for the option in the man page.
4.13.
Why doesn't work?
The command has been in and out of Cygwin distributions, but it has not been ported to Cygwin and has never worked. It is currently installed as part of the sh-utils, but again, it does not work.
You should rather install and use as a replacement.
For some technical background into why doesn't work, read https://www.cygwin.com/ml/cygwin/2003-06/msg00897.html and related messages.
4.14.
Why doesn't , or work?
Before you can use , or , you must create the whatis database. Just run the command
mandb(it may take a few minutes to complete).
4.15.
Why doesn't work?
If you're using FAT32 instead of NTFS, will fail since FAT32 does not provide any permission information. You should really consider converting the drive to NTFS with . FAT and FAT32 are barely good enough for memory cards or USB sticks to exchange pictures...
For other cases, understand that Cygwin attempts to show UNIX permissions based on the security features of Windows, so the Windows ACLs are likely the source of your problem. See the Cygwin User's Guide at https://cygwin.com/cygwin-ug-net/ntsec.html for more information on how Cygwin maps Windows permissions.
4.16.
Why doesn't my shell script work?
There are two basic problems you might run into. One is the fact that /bin/sh is really bash. It could be missing some features you might expect in /bin/sh, if you are used to /bin/sh actually being zsh (MacOS X "Panther") or ksh (Tru64).
Or, it could be a permission problem, and Cygwin doesn't understand that your script is executable. On NTFS or NFS just make the script executable using . However, may not work due to restrictions of the filesystem (see FAQ entry above). In this case Cygwin must read the contents of files to determine if they are executable. If your script does not start with
#! /bin/sh(or any path to a script interpreter, it does not have to be /bin/sh) then Cygwin will not know it is an executable script. The Bourne shell idiom
: # This is the 2nd line, assume processing by /bin/shalso works.
Note that you can use the filesystem flag in to force Cygwin to treat all files under the mount point as executable. This can be used for individual files as well as directories. Then Cygwin will not bother to read files to determine whether they are executable.
4.17.
How do I print under Cygwin?
lpr is available in the cygutils package. Some usage hints are available courtesy of Rodrigo Medina.
Jason Tishler has written a couple of messages that explain how to use a2ps (for nicely formatted text in PostScript) and ghostscript (to print PostScript files on non-PostScript Windows printers). Start at https://cygwin.com/ml/cygwin/2001-04/msg00657.html. Note that these are old mails and a2ps as well as file are long available as part of the Cygwin distribution.
Alternatively, you can use the Windows print command. Type
bash$ print /\?for usage instructions (note the must be escaped from the shell).
Finally, you can simply cat the file to the printer's share name:
bash$ cat myfile > //host/printerYou may need to press the formfeed button on your printer or append the formfeed character to your file.
4.18.
Why don't international (Unicode) characters work?
Internationalization is a complex issue. The short answer is that Cygwin relies on the setting of the setting of LANG/LC_xxx environment variables. The long answer can be found in the User's Guide in the section Internationalization
Cygwin uses UTF-8 by default. To use a different character set, you need to set the LC_ALL, LC_CTYPE or LANG environment variables.
4.19.
My application prints international characters but I only see gray boxes
In the case of Cygwin programs, this likely means that the character set as determined by the LC_ALL, LC_CTYPE or LANG environment variables does not match the one set on the Text page of the Cygwin Terminal's options. Setting the locale in the terminal's options will set the LANG variable accordingly.
Non-Cygwin programs in the Cygwin Terminal do not usually take heed of the locale environment variables. Instead, they often use the so-called console codepage, which can be determined with the command cmd /c chcp followed by the appropriate Windows codepage number. The codepage number for Cygwin's default UTF-8 character set is 65001.
4.20.
Is it OK to have multiple copies of the DLL?
Yes, as long as they are used in strictly separated installations.
The Cygwin DLL has to handle various sharing situations between multiple processes. It has to keep a process table. It has to maintain a mount table which is based on the installation path of the Cygwin DLL.
For that reason, the Cygwin DLL maintains shared resources based on a hash value created from its own installation path. Each Cygwin DLL on the machine constitutes a Cygwin installation, with the directory the Cygwin DLL resides in treated as "/bin", the parent directory as "/".
Therefore, you can install two or more separate Cygwin distros on a single machine. Each of these installations use their own Cygwin DLL, and they don't share the default POSIX paths, nor process tables, nor any other shared resource used to maintain the installation.
However, a clean separation requires that you don't try to run executables of one Cygwin installation from processes running in another Cygwin installation. This may or may not work, but the chances that the result is not what you expect are pretty high.
If you get the error "shared region is corrupted" or "shared region version mismatch" it means you have multiple versions of cygwin1.dll running at the same time which conflict with each other. Apart from mixing executables of different Cygwin installations, this could also happen if you have one a single Cygwin installation, for example, if you update the Cygwin package without exiting all Cygwin apps (including services like sshd) beforehand.
The only DLL that is sanctioned by the Cygwin project is the one that you get by running setup-x86.exe or setup-x86_64.exe, installed in a directory controlled by this program. If you have other versions on your system and desire help from the cygwin project, you should delete or rename all DLLs that are not installed by .
An Introduction to R
Table of Contents
This is an introduction to R (“GNU S”), a language and environment for statistical computing and graphics. R is similar to the award-winning1 S system, which was developed at Bell Laboratories by John Chambers et al. It provides a wide variety of statistical and graphical techniques (linear and nonlinear modelling, statistical tests, time series analysis, classification, clustering, ...).
This manual provides information on data types, programming elements, statistical modelling and graphics.
This manual is for R, version 4.0.2 (2020-06-22).
Copyright © 1990 W. N. Venables
Copyright © 1992 W. N. Venables & D. M. Smith
Copyright © 1997 R. Gentleman & R. Ihaka
Copyright © 1997, 1998 M. Maechler
Copyright © 1999–2018 R Core Team
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the R Core Team.
Preface
This introduction to R is derived from an original set of notes describing the S and S-PLUS environments written in 1990–2 by Bill Venables and David M. Smith when at the University of Adelaide. We have made a number of small changes to reflect differences between the R and S programs, and expanded some of the material.
We would like to extend warm thanks to Bill Venables (and David Smith) for granting permission to distribute this modified version of the notes in this way, and for being a supporter of R from way back.
Comments and corrections are always welcome. Please address email correspondence to R-help@R-project.org.
Suggestions to the reader
Most R novices will start with the introductory session in Appendix A. This should give some familiarity with the style of R sessions and more importantly some instant feedback on what actually happens.
Many users will come to R mainly for its graphical facilities. See Graphics, which can be read at almost any time and need not wait until all the preceding sections have been digested.
1 Introduction and preliminaries
1.1 The R environment
R is an integrated suite of software facilities for data manipulation, calculation and graphical display. Among other things it has
- an effective data handling and storage facility,
- a suite of operators for calculations on arrays, in particular matrices,
- a large, coherent, integrated collection of intermediate tools for data analysis,
- graphical facilities for data analysis and display either directly at the computer or on hardcopy, and
- a well developed, simple and effective programming language (called ‘S’) which includes conditionals, loops, user defined recursive functions and input and output facilities. (Indeed most of the system supplied functions are themselves written in the S language.)
The term “environment” is intended to characterize it as a fully planned and coherent system, rather than an incremental accretion of very specific and inflexible tools, as is frequently the case with other data analysis software.
R is very much a vehicle for newly developing methods of interactive data analysis. It has developed rapidly, and has been extended by a large collection of packages. However, most programs written in R are essentially ephemeral, written for a single piece of data analysis.
1.2 Related software and documentation
R can be regarded as an implementation of the S language which was developed at Bell Laboratories by Rick Becker, John Chambers and Allan Wilks, and also forms the basis of the S-PLUS systems.
The evolution of the S language is characterized by four books by John Chambers and coauthors. For R, the basic reference is The New S Language: A Programming Environment for Data Analysis and Graphics by Richard A. Becker, John M. Chambers and Allan R. Wilks. The new features of the 1991 release of S are covered in Statistical Models in S edited by John M. Chambers and Trevor J. Hastie. The formal methods and classes of the methods package are based on those described in Programming with Data by John M. Chambers. See References, for precise references.
There are now a number of books which describe how to use R for data analysis and statistics, and documentation for S/S-PLUS can typically be used with R, keeping the differences between the S implementations in mind. See What documentation exists for R? in The R statistical system FAQ.
1.3 R and statistics
Our introduction to the R environment did not mention statistics, yet many people use R as a statistics system. We prefer to think of it of an environment within which many classical and modern statistical techniques have been implemented. A few of these are built into the base R environment, but many are supplied as packages. There are about 25 packages supplied with R (called “standard” and “recommended” packages) and many more are available through the family of Internet sites (via https://CRAN.R-project.org) and elsewhere. More details on packages are given later (see Packages).
Most classical statistics and much of the latest methodology is available for use with R, but users may need to be prepared to do a little work to find it.
There is an important difference in philosophy between S (and hence R) and the other main statistical systems. In S a statistical analysis is normally done as a series of steps, with intermediate results being stored in objects. Thus whereas SAS and SPSS will give copious output from a regression or discriminant analysis, R will give minimal output and store the results in a fit object for subsequent interrogation by further R functions.
1.4 R and the window system
The most convenient way to use R is at a graphics workstation running a windowing system. This guide is aimed at users who have this facility. In particular we will occasionally refer to the use of R on an X window system although the vast bulk of what is said applies generally to any implementation of the R environment.
Most users will find it necessary to interact directly with the operating system on their computer from time to time. In this guide, we mainly discuss interaction with the operating system on UNIX machines. If you are running R under Windows or macOS you will need to make some small adjustments.
Setting up a workstation to take full advantage of the customizable features of R is a straightforward if somewhat tedious procedure, and will not be considered further here. Users in difficulty should seek local expert help.
1.5 Using R interactively
When you use the R program it issues a prompt when it expects input commands. The default prompt is ‘’, which on UNIX might be the same as the shell prompt, and so it may appear that nothing is happening. However, as we shall see, it is easy to change to a different R prompt if you wish. We will assume that the UNIX shell prompt is ‘’.
In using R under UNIX the suggested procedure for the first occasion is as follows:
- Create a separate sub-directory, say , to hold data files on which you will use R for this problem. This will be the working directory whenever you use R for this particular problem.
- Start the R program with the command
- At this point R commands may be issued (see later).
- To quit the R program the command is
At this point you will be asked whether you want to save the data from your R session. On some systems this will bring up a dialog box, and on others you will receive a text prompt to which you can respond , or (a single letter abbreviation will do) to save the data before quitting, quit without saving, or return to the R session. Data which is saved will be available in future R sessions.
Further R sessions are simple.
- Make the working directory and start the program as before:
- Use the R program, terminating with the command at the end of the session.
To use R under Windows the procedure to follow is basically the same. Create a folder as the working directory, and set that in the field in your R shortcut. Then launch R by double clicking on the icon.
1.6 An introductory session
Readers wishing to get a feel for R at a computer before proceeding are strongly advised to work through the introductory session given in A sample session.
1.7 Getting help with functions and features
R has an inbuilt help facility similar to the facility of UNIX. To get more information on any specific named function, for example , the command is
An alternative is
For a feature specified by special characters, the argument must be enclosed in double or single quotes, making it a “character string”: This is also necessary for a few words with syntactic meaning including , and .
Either form of quote mark may be used to escape the other, as in the string . Our convention is to use double quote marks for preference.
On most R installations help is available in format by running
which will launch a Web browser that allows the help pages to be browsed with hyperlinks. On UNIX, subsequent help requests are sent to the -based help system. The ‘Search Engine and Keywords’ link in the page loaded by is particularly useful as it is contains a high-level concept list which searches though available functions. It can be a great way to get your bearings quickly and to understand the breadth of what R has to offer.
The command (alternatively ) allows searching for help in various ways. For example,
Try for details and more examples.
The examples on a help topic can normally be run by
Windows versions of R have other optional help systems: use
for further details.
1.8 R commands, case sensitivity, etc.
Technically R is an expression language with a very simple syntax. It is case sensitive as are most UNIX based packages, so and are different symbols and would refer to different variables. The set of symbols which can be used in R names depends on the operating system and country within which R is being run (technically on the locale in use). Normally all alphanumeric symbols are allowed2 (and in some countries this includes accented letters) plus ‘’ and ‘’, with the restriction that a name must start with ‘’ or a letter, and if it starts with ‘’ the second character must not be a digit. Names are effectively unlimited in length.
Elementary commands consist of either expressions or assignments. If an expression is given as a command, it is evaluated, printed (unless specifically made invisible), and the value is lost. An assignment also evaluates an expression and passes the value to a variable but the result is not automatically printed.
Commands are separated either by a semi-colon (‘’), or by a newline. Elementary commands can be grouped together into one compound expression by braces (‘’ and ‘’). Comments can be put almost3 anywhere, starting with a hashmark (‘’), everything to the end of the line is a comment.
If a command is not complete at the end of a line, R will give a different prompt, by default
on second and subsequent lines and continue to read input until the command is syntactically complete. This prompt may be changed by the user. We will generally omit the continuation prompt and indicate continuation by simple indenting.
Command lines entered at the console are limited4 to about 4095 bytes (not characters).
1.9 Recall and correction of previous commands
Under many versions of UNIX and on Windows, R provides a mechanism for recalling and re-executing previous commands. The vertical arrow keys on the keyboard can be used to scroll forward and backward through a command history. Once a command is located in this way, the cursor can be moved within the command using the horizontal arrow keys, and characters can be removed with the key or added with the other keys. More details are provided later: see The command-line editor.
The recall and editing capabilities under UNIX are highly customizable. You can find out how to do this by reading the manual entry for the readline library.
Alternatively, the Emacs text editor provides more general support mechanisms (via , Emacs Speaks Statistics) for working interactively with R. See R and Emacs in The R statistical system FAQ.
1.10 Executing commands from or diverting output to a file
If commands5 are stored in an external file, say in the working directory , they may be executed at any time in an R session with the command
For Windows Source is also available on the File menu. The function ,
will divert all subsequent output from the console to an external file, . The command
restores it to the console once again.
1.11 Data permanency and removing objects
The entities that R creates and manipulates are known as objects. These may be variables, arrays of numbers, character strings, functions, or more general structures built from such components.
During an R session, objects are created and stored by name (we discuss this process in the next section). The R command
(alternatively, ) can be used to display the names of (most of) the objects which are currently stored within R. The collection of objects currently stored is called the workspace.
To remove objects the function is available:
All objects created during an R session can be stored permanently in a file for use in future R sessions. At the end of each R session you are given the opportunity to save all the currently available objects. If you indicate that you want to do this, the objects are written to a file called 6 in the current directory, and the command lines used in the session are saved to a file called .
When R is started at later time from the same directory it reloads the workspace from this file. At the same time the associated commands history is reloaded.
It is recommended that you should use separate working directories for analyses conducted with R. It is quite common for objects with names and to be created during an analysis. Names like this are often meaningful in the context of a single analysis, but it can be quite hard to decide what they might be when the several analyses have been conducted in the same directory.
2 Simple manipulations; numbers and vectors
2.1 Vectors and assignment
R operates on named data structures. The simplest such structure is the numeric vector, which is a single entity consisting of an ordered collection of numbers. To set up a vector named , say, consisting of five numbers, namely 10.4, 5.6, 3.1, 6.4 and 21.7, use the R command
This is an assignment statement using the function which in this context can take an arbitrary number of vector arguments and whose value is a vector got by concatenating its arguments end to end.7
A number occurring by itself in an expression is taken as a vector of length one.
Notice that the assignment operator (‘’), which consists of the two characters ‘’ (“less than”) and ‘’ (“minus”) occurring strictly side-by-side and it ‘points’ to the object receiving the value of the expression. In most contexts the ‘’ operator can be used as an alternative.
Assignment can also be made using the function . An equivalent way of making the same assignment as above is with:
The usual operator, , can be thought of as a syntactic short-cut to this.
Assignments can also be made in the other direction, using the obvious change in the assignment operator. So the same assignment could be made using
If an expression is used as a complete command, the value is printed and lost8. So now if we were to use the command
the reciprocals of the five values would be printed at the terminal (and the value of , of course, unchanged).
The further assignment
would create a vector with 11 entries consisting of two copies of with a zero in the middle place.
2.2 Vector arithmetic
Vectors can be used in arithmetic expressions, in which case the operations are performed element by element. Vectors occurring in the same expression need not all be of the same length. If they are not, the value of the expression is a vector with the same length as the longest vector which occurs in the expression. Shorter vectors in the expression are recycled as often as need be (perhaps fractionally) until they match the length of the longest vector. In particular a constant is simply repeated. So with the above assignments the command
generates a new vector of length 11 constructed by adding together, element by element, repeated 2.2 times, repeated just once, and repeated 11 times.
The elementary arithmetic operators are the usual , , , and for raising to a power. In addition all of the common arithmetic functions are available. , , , , , , and so on, all have their usual meaning. and select the largest and smallest elements of a vector respectively. is a function whose value is a vector of length two, namely . is the number of elements in , gives the total of the elements in , and their product.
Two statistical functions are which calculates the sample mean, which is the same as , and which gives
or sample variance. If the argument to is an n-by-p matrix the value is a p-by-p sample covariance matrix got by regarding the rows as independent p-variate sample vectors.
returns a vector of the same size as with the elements arranged in increasing order; however there are other more flexible sorting facilities available (see or which produce a permutation to do the sorting).
Note that and select the largest and smallest values in their arguments, even if they are given several vectors. The parallel maximum and minimum functions and return a vector (of length equal to their longest argument) that contains in each element the largest (smallest) element in that position in any of the input vectors.
For most purposes the user will not be concerned if the “numbers” in a numeric vector are integers, reals or even complex. Internally calculations are done as double precision real numbers, or double precision complex numbers if the input data are complex.
To work with complex numbers, supply an explicit complex part. Thus
will give and a warning, but
will do the computations as complex numbers.
2.3 Generating regular sequences
R has a number of facilities for generating commonly used sequences of numbers. For example is the vector . The colon operator has high priority within an expression, so, for example is the vector . Put and compare the sequences and .
The construction may be used to generate a sequence backwards.
The function is a more general facility for generating sequences. It has five arguments, only some of which may be specified in any one call. The first two arguments, if given, specify the beginning and end of the sequence, and if these are the only two arguments given the result is the same as the colon operator. That is is the same vector as .
Arguments to , and to many other R functions, can also be given in named form, in which case the order in which they appear is irrelevant. The first two arguments may be named and ; thus , and are all the same as . The next two arguments to may be named and , which specify a step size and a length for the sequence respectively. If neither of these is given, the default is assumed.
For example
generates in the vector . Similarly
generates the same vector in .
The fifth argument may be named , which is normally used as the only argument to create the sequence , or the empty sequence if the vector is empty (as it can be).
A related function is which can be used for replicating an object in various complicated ways. The simplest form is
which will put five copies of end-to-end in . Another useful version is
which repeats each element of five times before moving on to the next.
2.4 Logical vectors
As well as numerical vectors, R allows manipulation of logical quantities. The elements of a logical vector can have the values , , and (for “not available”, see below). The first two are often abbreviated as and , respectively. Note however that and are just variables which are set to and by default, but are not reserved words and hence can be overwritten by the user. Hence, you should always use and .
Logical vectors are generated by conditions. For example
sets as a vector of the same length as with values corresponding to elements of where the condition is not met and where it is.
The logical operators are , , , , for exact equality and for inequality. In addition if and are logical expressions, then is their intersection (“and”), is their union (“or”), and is the negation of .
Logical vectors may be used in ordinary arithmetic, in which case they are coerced into numeric vectors, becoming and becoming . However there are situations where logical vectors and their coerced numeric counterparts are not equivalent, for example see the next subsection.
2.5 Missing values
In some cases the components of a vector may not be completely known. When an element or value is “not available” or a “missing value” in the statistical sense, a place within a vector may be reserved for it by assigning it the special value . In general any operation on an becomes an . The motivation for this rule is simply that if the specification of an operation is incomplete, the result cannot be known and hence is not available.
The function gives a logical vector of the same size as with value if and only if the corresponding element in is .
Notice that the logical expression is quite different from since is not really a value but a marker for a quantity that is not available. Thus is a vector of the same length as all of whose values are as the logical expression itself is incomplete and hence undecidable.
Note that there is a second kind of “missing” values which are produced by numerical computation, the so-called Not a Number, , values. Examples are
or
which both give since the result cannot be defined sensibly.
In summary, is both for and values. To differentiate these, is only for s.
Missing values are sometimes printed as when character vectors are printed without quotes.
2.6 Character vectors
Character quantities and character vectors are used frequently in R, for example as plot labels. Where needed they are denoted by a sequence of characters delimited by the double quote character, e.g., , .
Character strings are entered using either matching double () or single () quotes, but are printed using double quotes (or sometimes without quotes). They use C-style escape sequences, using as the escape character, so is entered and printed as , and inside double quotes is entered as . Other useful escape sequences are , newline, , tab and , backspace—see for a full list.
Character vectors may be concatenated into a vector by the function; examples of their use will emerge frequently.
The function takes an arbitrary number of arguments and concatenates them one by one into character strings. Any numbers given among the arguments are coerced into character strings in the evident way, that is, in the same way they would be if they were printed. The arguments are by default separated in the result by a single blank character, but this can be changed by the named argument, , which changes it to , possibly empty.
For example
makes into the character vector
Note particularly that recycling of short lists takes place here too; thus is repeated 5 times to match the sequence . 9
2.7 Index vectors; selecting and modifying subsets of a data set
Subsets of the elements of a vector may be selected by appending to the name of the vector an index vector in square brackets. More generally any expression that evaluates to a vector may have subsets of its elements similarly selected by appending an index vector in square brackets immediately after the expression.
Such index vectors can be any of four distinct types.
- A logical vector. In this case the index vector is recycled to the same length as the vector from which elements are to be selected. Values corresponding to in the index vector are selected and those corresponding to are omitted. For example > y <- x[!is.na(x)]
creates (or re-creates) an object which will contain the non-missing values of , in the same order. Note that if has missing values, will be shorter than . Also
> (x+1)[(!is.na(x)) & x>0] -> zcreates an object and places in it the values of the vector for which the corresponding value in was both non-missing and positive.
- A vector of positive integral quantities. In this case the values in the index vector must lie in the set {1, 2, …, }. The corresponding elements of the vector are selected and concatenated, in that order, in the result. The index vector can be of any length and the result is of the same length as the index vector. For example is the sixth component of and
selects the first 10 elements of (assuming is not less than 10). Also
> c("x","y")[rep(c(1,2,2,1), times=4)](an admittedly unlikely thing to do) produces a character vector of length 16 consisting of repeated four times.
- A vector of negative integral quantities. Such an index vector specifies the values to be excluded rather than included. Thus
gives all but the first five elements of .
- A vector of character strings. This possibility only applies where an object has a attribute to identify its components. In this case a sub-vector of the names vector may be used in the same way as the positive integral labels in item 2 further above. > fruit <- c(5, 10, 1, 20) > names(fruit) <- c("orange", "banana", "apple", "peach") > lunch <- fruit[c("apple","orange")]
The advantage is that alphanumeric names are often easier to remember than numeric indices. This option is particularly useful in connection with data frames, as we shall see later.
An indexed expression can also appear on the receiving end of an assignment, in which case the assignment operation is performed only on those elements of the vector. The expression must be of the form as having an arbitrary expression in place of the vector name does not make much sense here.
For example
replaces any missing values in by zeros and
has the same effect as
2.8 Other types of objects
Vectors are the most important type of object in R, but there are several others which we will meet more formally in later sections.
- matrices or more generally arrays are multi-dimensional generalizations of vectors. In fact, they are vectors that can be indexed by two or more indices and will be printed in special ways. See Arrays and matrices.
- factors provide compact ways to handle categorical data. See Factors.
- lists are a general form of vector in which the various elements need not be of the same type, and are often themselves vectors or lists. Lists provide a convenient way to return the results of a statistical computation. See Lists.
- data frames are matrix-like structures, in which the columns can be of different types. Think of data frames as ‘data matrices’ with one row per observational unit but with (possibly) both numerical and categorical variables. Many experiments are best described by data frames: the treatments are categorical but the response is numeric. See Data frames.
- functions are themselves objects in R which can be stored in the project’s workspace. This provides a simple and convenient way to extend R. See Writing your own functions.
3 Objects, their modes and attributes
3.1 Intrinsic attributes: mode and length
The entities R operates on are technically known as objects. Examples are vectors of numeric (real) or complex values, vectors of logical values and vectors of character strings. These are known as “atomic” structures since their components are all of the same type, or mode, namely numeric10, complex, logical, character and raw.
Vectors must have their values all of the same mode. Thus any given vector must be unambiguously either logical, numeric, complex, character or raw. (The only apparent exception to this rule is the special “value” listed as for quantities not available, but in fact there are several types of ). Note that a vector can be empty and still have a mode. For example the empty character string vector is listed as and the empty numeric vector as .
R also operates on objects called lists, which are of mode list. These are ordered sequences of objects which individually can be of any mode. lists are known as “recursive” rather than atomic structures since their components can themselves be lists in their own right.
The other recursive structures are those of mode function and expression. Functions are the objects that form part of the R system along with similar user written functions, which we discuss in some detail later. Expressions as objects form an advanced part of R which will not be discussed in this guide, except indirectly when we discuss formulae used with modeling in R.
By the mode of an object we mean the basic type of its fundamental constituents. This is a special case of a “property” of an object. Another property of every object is its length. The functions and can be used to find out the mode and length of any defined structure 11.
Further properties of an object are usually provided by , see Getting and setting attributes. Because of this, mode and length are also called “intrinsic attributes” of an object.
For example, if is a complex vector of length 100, then in an expression is the character string and is .
R caters for changes of mode almost anywhere it could be considered sensible to do so, (and a few where it might not be). For example with
we could put
after which is the character vector . A further coercion, or change of mode, reconstructs the numerical vector again:
Now and are the same.12 There is a large collection of functions of the form for either coercion from one mode to another, or for investing an object with some other attribute it may not already possess. The reader should consult the different help files to become familiar with them.
3.2 Changing the length of an object
An “empty” object may still have a mode. For example
makes an empty vector structure of mode numeric. Similarly is a empty character vector, and so on. Once an object of any size has been created, new components may be added to it simply by giving it an index value outside its previous range. Thus
now makes a vector of length 3, (the first two components of which are at this point both ). This applies to any structure at all, provided the mode of the additional component(s) agrees with the mode of the object in the first place.
This automatic adjustment of lengths of an object is used often, for example in the function for input. (see The scan() function.)
Conversely to truncate the size of an object requires only an assignment to do so. Hence if is an object of length 10, then
makes it an object of length 5 consisting of just the former components with even index. (The old indices are not retained, of course.) We can then retain just the first three values by
and vectors can be extended (by missing values) in the same way.
3.3 Getting and setting attributes
The function returns a list of all the non-intrinsic attributes currently defined for that object. The function can be used to select a specific attribute. These functions are rarely used, except in rather special circumstances when some new attribute is being created for some particular purpose, for example to associate a creation date or an operator with an R object. The concept, however, is very important.
Some care should be exercised when assigning or deleting attributes since they are an integral part of the object system used in R.
When it is used on the left hand side of an assignment it can be used either to associate a new attribute with or to change an existing one. For example
allows R to treat as if it were a 10-by-10 matrix.
3.4 The class of an object
All objects in R have a class, reported by the function . For simple vectors this is just the mode, for example , , or , but , , and are other possible values.
A special attribute known as the class of the object is used to allow for an object-oriented style13 of programming in R. For example if an object has class , it will be printed in a certain way, the function will display it graphically in a certain way, and other so-called generic functions such as will react to it as an argument in a way sensitive to its class.
To remove temporarily the effects of class, use the function . For example if has the class then
will print it in data frame form, which is rather like a matrix, whereas
will print it as an ordinary list. Only in rather special situations do you need to use this facility, but one is when you are learning to come to terms with the idea of class and generic functions.
Generic functions and classes will be discussed further in Object orientation, but only briefly.
4 Ordered and unordered factors
A factor is a vector object used to specify a discrete classification (grouping) of the components of other vectors of the same length. R provides both ordered and unordered factors. While the “real” application of factors is with model formulae (see Contrasts), we here look at a specific example.
4.1 A specific example
Suppose, for example, we have a sample of 30 tax accountants from all the states and territories of Australia14 and their individual state of origin is specified by a character vector of state mnemonics as
Notice that in the case of a character vector, “sorted” means sorted in alphabetical order.
A factor is similarly created using the function:
The function handles factors slightly differently from other objects:
To find out the levels of a factor the function can be used.
4.2 The function and ragged arrays
To continue the previous example, suppose we have the incomes of the same tax accountants in another vector (in suitably large units of money)
To calculate the sample mean income for each state we can now use the special function :
giving a means vector with the components labelled by the levels
The function is used to apply a function, here , to each group of components of the first argument, here , defined by the levels of the second component, here 15, as if they were separate vector structures. The result is a structure of the same length as the levels attribute of the factor containing the results. The reader should consult the help document for more details.
Suppose further we needed to calculate the standard errors of the state income means. To do this we need to write an R function to calculate the standard error for any given vector. Since there is an builtin function to calculate the sample variance, such a function is a very simple one liner, specified by the assignment:
(Writing functions will be considered later in Writing your own functions. Note that R’s a builtin function is something different.) After this assignment, the standard errors are calculated by
and the values calculated are then
As an exercise you may care to find the usual 95% confidence limits for the state mean incomes. To do this you could use once more with the function to find the sample sizes, and the function to find the percentage points of the appropriate t-distributions. (You could also investigate R’s facilities for t-tests.)
The function
What’s New in the Dial-Up Magic Version: 1.5.0 serial key or number?
Screen Shot
System Requirements for Dial-Up Magic Version: 1.5.0 serial key or number
- First, download the Dial-Up Magic Version: 1.5.0 serial key or number
-
You can download its setup from given links: