From: pabs3@... Date: 2017-04-03T02:31:40+00:00 Subject: [ruby-core:80539] [Ruby trunk Feature#12695] File.expand_path should resolve ~/ using /etc/passwd when HOME is not set Issue #12695 has been updated by pabs (Paul Wise). Does anyone know if this also fixes the Dir.home value? Currently (in 2.3) that doesn't work when HOME is unset either. pabs@chianamo ~ $ unset HOME pabs@chianamo /home/pabs $ ruby -e 'print Dir.home' -e:1:in `home': couldn't find HOME environment -- expanding `~' (ArgumentError) from -e:1:in `
' ---------------------------------------- Feature #12695: File.expand_path should resolve ~/ using /etc/passwd when HOME is not set https://bugs.ruby-lang.org/issues/12695#change-64042 * Author: fursten (M��rten Svantesson) * Status: Closed * Priority: Normal * Assignee: * Target version: ---------------------------------------- I would expect a call like File.expand_path('~/.ssh/known_hosts') to work even though HOME is not set. A reason this is important to fix is that libraries (in my use case Net::SSH) do calls like File.expand_path('~/.ssh/known_hosts'), but this will often fail when the code is run in a unix service, since HOME often isn't set then. I considered reporting this as a bug, but the current behaviour is actually documented. -- https://bugs.ruby-lang.org/ Unsubscribe: