As part of upgrading a Dockerfile I'm trying to make a specific gem run that contains guides written some 8+ years ago.
I have found out I have to use Ruby <= 2.3 for it because above that it gives endless syntax errors most probably because of some major changes in 2.4.
I'm installing Ruby 2.3.8 with rvm this way:
# Install libssl-1.0 from 'stretch' repositories (needed for ruby 2.3)
RUN echo "deb http://deb.debian.org/debian/ stretch main contrib non-free" > /etc/apt/sources.list.d/libssl-legacy.lenter code hereist \
&& echo "deb-src http://deb.debian.org/debian stretch main contrib non-free" >> /etc/apt/sources.list.d/libssl-legacy.list \
&& echo "APT::Default-Release "bullseye";" > /etc/apt/apt.conf.d/libssl-legacy \
&& apt update && apt install -y libssl1.0-dev
# Install Ruby 2.3 with RVM (to /usr/local/rvm/rubies/ruby-2.3.8/bin/ruby)
ENV PATH="/usr/local/rvm/bin:$PATH"
ENV rvm_path="/usr/local/rvm"
RUN curl -sSL https://rvm.io/mpapis.asc | gpg2 --import - \
&& curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import - \
&& curl -sSL https://get.rvm.io | bash \
&& rvm install 2.3
A few days ago I managed to make this guide build without a problem, but I can't seem to make it work now. What am I missing?
I get the following error while trying to build the gem with 'guides build':
/usr/local/rvm/gems/ruby-2.3.8/gems/activesupport3.0.20/lib/active_support/values/time_zone.rb:272: warning: circular argument reference - now
It points to this function in time_zone.rb:
# Method for creating new ActiveSupport::TimeWithZone instance in time zone of +self+ from parsed string. Example:
#
# Time.zone = "Hawaii" # => "Hawaii"
# Time.zone.parse('1999-12-31 14:00:00') # => Fri, 31 Dec 1999 14:00:00 HST -10:00
#
# If upper components are missing from the string, they are supplied from TimeZone#now:
#
# Time.zone.now # => Fri, 31 Dec 1999 14:00:00 HST -10:00
# Time.zone.parse('22:30:00') # => Fri, 31 Dec 1999 22:30:00 HST -10:00
def parse(str, now=now)
date_parts = Date._parse(str)
return if date_parts.blank?
time = Time.parse(str, now) rescue DateTime.parse(str)
if date_parts[:offset].nil?
ActiveSupport::TimeWithZone.new(nil, self, time)
else
time.in_time_zone(self)
end
end
ruby -v:
ruby 2.3.8p459 (2018-10-18 revision 65136) [x86_64-linux]
gem -v:
3.3.10
bundler -v:
Bundler version 2.3.10
def parse(str, now=now) <- here is your issue.
you are trying to set now to itself. A circular argument reference means that a variable is looking for itself.
/active_support/values/time_zone.rb:272:: warning: circular argument reference
Related
The problem is about the capability 'change_host_name' isn't supported by the guest when I try to execute the following command line:
vagrant up
It gives me an error as the following:
Vagrant attempted to execute the capability 'change_host_name'
on the detect guest OS 'linux', but the guest doesn't
support that capability. This capability is required for your
configuration of Vagrant. Please either reconfigure Vagrant to
avoid this capability or fix the issue by creating the capability.
Note that my OS is:
OS X Yosemite 10.10.5
Guest Additions Version: 4.2.0 and VirtualBox Version: 5.0
I've tried many solutions of others who face this issue, but I couldn't fix it.
This is https://github.com/mitchellh/vagrant/issues/7625. It will be fixed in the next release, until then if its blocking you, you can patch vagrant yourself
If you want to patch yourself
Method1 :
search for the plugins/guests/ubuntu/guest.rb file in your vagrant installation
e.g. /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/guests/ubuntu/guest.rb on mac/linux default install
or /opt/vagrant/embedded/gems/vagrant-1.8.5/plugins/guests/ubuntu/guest.rb
windows : C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.8.5\plugins\guests\ubuntu\guest.rb
replace with
https://raw.githubusercontent.com/carlosefr/vagrant/1c631c18d1a654405f6954459a42ac19a1a2f096/plugins/guests/ubuntu/guest.rb (make sure to be with correct rights if you install as admin, you must be admin user to save the file)
alternatively edit the file and replace all contents by
module VagrantPlugins
module GuestUbuntu
class Guest < Vagrant.plugin("2", :guest)
def detect?(machine)
# This command detects if we are running on Ubuntu. /etc/os-release is
# available on modern Ubuntu versions, but does not exist on 14.04 and
# previous versions, so we fall back to lsb_release.
#
# GH-7524
# GH-7625
#
machine.communicate.test <<-EOH.gsub(/^ {10}/, "")
if test -r /etc/os-release; then
source /etc/os-release && test xubuntu = x$ID
elif test -x /usr/bin/lsb_release; then
/usr/bin/lsb_release -i 2>/dev/null | grep -q Ubuntu
else
exit 1
fi
EOH
end
end
end
end
Method2 : An Alternative method to patch the file using patch command :
save the following file under vagrant-guest.patch
commit 00fa49191dba2bb7c6322fa8df9327ca505c0b41
Author: Seth Vargo <sethvargo#gmail.com>
Date: Sat Jul 23 11:40:36 2016 -0400
guests/ubuntu: Revert detection
- Semi-reverts GH-7524
- Fixes GH-7625
diff --git a/plugins/guests/ubuntu/guest.rb b/plugins/guests/ubuntu/guest.rb
index 9aeb7aa..f60108e 100644
--- a/plugins/guests/ubuntu/guest.rb
+++ b/plugins/guests/ubuntu/guest.rb
## -2,7 +2,22 ## module VagrantPlugins
module GuestUbuntu
class Guest < Vagrant.plugin("2", :guest)
def detect?(machine)
- machine.communicate.test("test -r /etc/os-release && . /etc/os-release && test xubuntu = x$ID")
+ # This command detects if we are running on Ubuntu. /etc/os-release is
+ # available on modern Ubuntu versions, but does not exist on 14.04 and
+ # previous versions, so we fall back to lsb_release.
+ #
+ # GH-7524
+ # GH-7625
+ #
+ machine.communicate.test <<-EOH.gsub(/^ {10}/, "")
+ if test -r /etc/os-release; then
+ source /etc/os-release && test xubuntu = x$ID
+ elif test -x /usr/bin/lsb_release; then
+ /usr/bin/lsb_release -i 2>/dev/null | grep -q Ubuntu
+ else
+ exit 1
+ fi
+ EOH
end
end
end
and run the following command to apply the patch
sudo patch -p1 --directory /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/ < vagrant-guest.patch
Just replace /opt/vagrant/embedded/gems/gems/vagrant-1.8.5 (or /opt/vagrant/embedded/gems/vagrant-1.8.5/plugins/guests/ubuntu/guest.rb) with your vagrant folder installation
I'm having an issue while installing wp-scan, expecially with the command:
sudo gem install bundler && bundle install --without test
which returns:
WARNING: You don't have /root/.gem/ruby/2.3.0/bin in your PATH,
gem executables will not run.
Successfully installed bundler-1.12.4
Parsing documentation for bundler-1.12.4
Done installing documentation for bundler after 5 seconds
1 gem installed
bash: bundle: command not found
I searched and it seems I didn't set the Ruby path, but when I try to set it using "Setup", bash returns:
-e:1: unexpected fraction part after numeric literal
/root/.gem/ruby/2.3.0/
^
This is the .bashrc file:
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
PS1='[\u#\h \W]\$ '
# >>>>BEGIN ADDED BY CNCHI INSTALLER<<<< #
BROWSER=/usr/bin/chromium
EDITOR=/usr/bin/nano
# >>>>>END ADDED BY CNCHI INSTALLER<<<<< #
#la riga inferiore serve a creare il path corretto di gem /ruby
PATH="$(ruby -e '/root/.gem/ruby/2.3.0/')/bin:$PATH"
What am I doing wrong?
Here is the gem env return:
RubyGems Environment:
- RUBYGEMS VERSION: 2.5.1
- RUBY VERSION: 2.3.1 (2016-04-26 patchlevel 112) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/2.3.0
- USER INSTALLATION DIRECTORY: /home/thecave3/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- SPEC CACHE DIRECTORY: /home/thecave3/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/lib/ruby/gems/2.3.0
- /home/thecave3/.gem/ruby/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--user-install"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/sbin
- /usr/local/bin
- /usr/bin
- /usr/bin/site_perl
- /usr/bin/vendor_perl
- /usr/bin/core_perl
- /root/.gem/ruby/2.3.0/bin
Adding the following to your .bashrc should do the trick:
export PATH="$PATH:/root/.gem/ruby/2.3.0/bin"
$(..) is a command substitution and it a way to capture the output from a command:
a=$(echo 1234)
will assign the value 1234 to a, of course, the same can be achieved with a=1234.
ruby -e '...'
will evaluate the code passed after -e, in your case /root/.gem/ruby/2.3.0/ which is not valid Ruby code, but a path to find executables.
I also added the Ruby path to the end of the PATH variable. This is considered the best approach since the shell will search though it to find the desired program. Consider this:
~/bin % export PATH="$HOME/bin:/bin:/usr/bin"
~/bin % cat grep
#!/bin/sh
echo "got ya"
~/bin % grep '...' '...'
got ya
I'm trying to install RVM in my workstation.
But in my work's network, the internet is reached via an proxy. This proxy eventually blocks some URLs based in a internal security policy.
I shall to do a request to network administrators about URLs that is being blocked so that they can unblock them for a group of workstations.
This is very important because the policy need to be constantly updated.
What I need is to know which URL the installation is trying to download and that are being blocked.
When I try to install RVM it try to download the archives. The blocked ones arrives corrupted in my computer. I can see messages in the output complaining checksum errors.
e.g.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.0.0-p0, this may take a while depending on your cpu(s)...
ruby-2.0.0-p0 - #downloading ruby-2.0.0-p0, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:06 --:--:-- 0
100 3198 100 3198 0 0 532 0 0:00:06 0:00:06 --:--:-- 532
Downloaded archive checksum did not match, archive was removed!
If you wish to continue with not matching download add '--verify-downloads 2' after the command.
There has been an error fetching the ruby interpreter. Halting the installation.
How can I see the URLs beings downloaded in the RVM install? Probably I'll need this for the gems bundler too.
Thanks in advance.
run:
rvm get head # make sure you use latest rvm code
rvm cleanup archives # clean up all downloaded files so far
rvm install 2.0.0 --debug # install with debug - it will show the downloaded urls
It gives a lot of output, but if you install with the --debug --trace switches then you see everything that RVM is doing, including the URLs that it requests:
$ rvm install 2.0.0 --debug --trace
# ...
# a whole boatload of output
# such as...
+++ 1365712695.744278786 /scripts/functions/utility : __rvm_ruby_package_file() 569 > rvm_ruby_package_file=/ruby-2.0.0-rc2.tar.bz2
+++ 1365712695.856579187 /scripts/functions/utility : __rvm_calculate_remote_file() 583 > __remote_file=https://rvm.io/binaries/ubuntu/12.10/i386/ruby-2.0.0-rc2.tar.bz2
+++ 1365712695.948514158 /scripts/functions/utility : __rvm_remote_server_path_single() 592 > [[ -z https://rvm.io/binaries/ubuntu/12.10/i386/ruby-2.0.0-rc2.tar.bz2 ]]
+++ 1365712696.053688755 /scripts/functions/utility : __rvm_remote_server_path_single() 597 > file_exists_at_url https://rvm.io/binaries/ubuntu/12.10/i386/ruby-2.0.0-rc2.tar.bz2
+++ 1365712696.171561756 /scripts/functions/utility : file_exists_at_url() 714 > [[ -n https://rvm.io/binaries/ubuntu/12.10/i386/ruby-2.0.0-rc2.tar.bz2 ]]
+++ 1365712696.266908604 /scripts/functions/utility : file_exists_at_url() 716 > unset curl
+++ 1365712696.482119274 /scripts/functions/utility : file_exists_at_url() 717 > curl -slkL --max-time 3 --head https://rvm.io/binaries/ubuntu/12.10/i386/ruby-2.0.0-rc2.tar.bz2
+++ 1365712696.512878217 /scripts/functions/utility : file_exists_at_url() 718 > GREP_OPTIONS=
+++ 1365712696.732889205 /scripts/functions/utility : file_exists_at_url() 718 > grep -E 'HTTP/[0-9\.]+ 200 OK'
I'm on RedHat, I need to get the value in the Release field.
Take "wget" for an example.
Here's the output I'm expected to get
WGET: 1.4.el6
Here's the output from rpm -qi wget
[luke#machine ~]# rpm -qi wget
Name : wget Relocations: (not relocatable)
Version : 1.12 Vendor: Red Hat, Inc.
Release : 1.4.el6 Build Date: Mon May 10 14:56:18 2010
Install Date: Wed Oct 3 16:48:58 2012 Build Host: x86-012.build.bos.redhat.com
Group : Applications/Internet Source RPM: wget-1.12-1.4.el6.src.rpm
Size : 1877597 License: GPLv3+ and GFDL
Signature : RSA/8, Mon Aug 16 21:21:35 2010, Key ID 199e2f91fd431d51
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL : http://wget.sunsite.dk/
Summary : A utility for retrieving files using the HTTP or FTP protocols
How can I write a script to extract the "1.4.el6" from the Release field.
I currently have
#!/bin/bash
RELwg= rpm -qi wget
# Do string manipulation of $RELwg here
wg="WGET: "
echo $wg$RELwg
But here's the output I get;
Release : 1.4.el6 Build Date: Mon May 10 14:56:18 2010
WGET:
I know I have to do some string extraction, to get the number.
Get the index of the 1, seems to always be constant at 15
Get the index of the B in Build Date
Get the sub string inbetween 15 and whatever B is
Removing the space between "RELwg= rpm -qi wget" in my current script, I just get an error saying that
./GetRPMVersions.sh: line 12: -qi: command not found
Mainly my current predicament is to addign the ouput of rpm -qi wget | grep Release to a variable.
Any input on the string manipulation is welcome.
something like
RELwg=$(rpm -qi wget | awk -- '/^Release/ { print $3 }')
How about this:
RELwg=$(rpm -q --queryformat='%{RELEASE}' wget)
update: the error only occurs when logged into R from within emacs
what works:
When I ssh into a remote server and run
$ ./foo.rb
from the bash shell, it works. Furthermore, if I launch R and execute
$ R
system('./foo.rb')
I am in a group with permission to read/write/execute the file. File permissions are -rwxrwx---
what doesn't work:
Launch emacs and start an R session:
M-x R
ssh-myserver:.
system('./foo.rb')
I get the following error:
ruby: Permission denied -- foo.rb (LoadError)
why is this? Is there a way to work around this?
I can not find any information from ?system or ?system2
Here is the output from sessionInfo()
> sessionInfo()
R version 2.12.2 (2011-02-25)
Platform: x86_64-redhat-linux-gnu (64-bit)
locale:
[1] C
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] PECAn_0.1.1 xtable_1.5-6 gridExtra_0.7 RMySQL_0.7-5
[5] DBI_0.2-5 ggplot2_0.8.9 proto_0.3-8 reshape_0.8.3
[9] plyr_1.6 rjags_2.2.0-2 coda_0.13-5 lattice_0.19-17
[13] randtoolbox_1.09 rngWELL_0.9 MASS_7.3-11 XML_3.2-0
loaded via a namespace (and not attached):
[1] digest_0.4.2
Warning message:
'DESCRIPTION' file has 'Encoding' field and re-encoding is not possible
output of 'id' and 'env' from ssh and emacs, per comment by #sarnold (changed user names, group names, and ip addresses)
1. server
1.1 'id'
uid=1668(dleb) gid=1668(dleb) groups=117(ebusers),159(lab_admin),166(lab),1340(pal_web),1668(dleb)
1.2 'env'
LC_PAPER=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
SHELL=/usr/local/bin/system-specific
KDE_NO_IPV6=1
SSH_CLIENT=888.888.888.88 51857 22
NCARG_FONTCAPS=/usr/lib64/ncarg/fontcaps
LC_NUMERIC=en_US.UTF-8
USER=dleb
LS_COLORS=
LC_TELEPHONE=en_US.UTF-8
KDEDIR=/usr
NCARG_GRAPHCAPS=/usr/lib64/ncarg/graphcaps
MAIL=/var/mail/dleb
PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/opt/dell/srvadmin/bin
LC_IDENTIFICATION=en_US.UTF-8
LC_COLLATE=en_US.UTF-8
R_LIBS=/home/a-m/dleb/lib/R
PWD=/home/dleb
NCARG_ROOT=/usr
KDE_IS_PRELINKED=1
LANG=en_US.UTF-8
NCARG_DATABASE=/usr/lib64/ncarg/database
MODULEPATH=/usr/share/Modules/modulefiles:/etc/modulefiles
LOADEDMODULES=
LC_MEASUREMENT=en_US.UTF-8
NCARG_LIB=/usr/lib64/ncarg
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
NCARG_NCARG=/usr/share/ncarg
SHLVL=1
HOME=/home/a-m/dleb
LOGNAME=dleb
CVS_RSH=ssh
SSH_CONNECTION=888.888.888.88 51857 999.999.999.99 22
LC_CTYPE=en_US.UTF-8
MODULESHOME=/usr/share/Modules
LESSOPEN=|/usr/bin/lesspipe.sh %s
DISPLAY=localhost:15.0
LC_TIME=en_US.UTF-8
G_BROKEN_FILENAMES=1
LC_NAME=en_US.UTF-8
_=/bin/env
emacs/ess R session
2.1 system('id')
uid=1668(dleb) gid=1668(dleb) groups=117(ebusers),159(lab_admin),166(lab),1340(pal_web),1668(dleb)
2.2 system('env')
LN_S=ln -s
R_TEXI2DVICMD=/usr/bin/texi2dvi
LC_PAPER=en_US.UTF-8
SED=/bin/sed
LC_ADDRESS=en_US.UTF-8
R_PDFVIEWER=/usr/bin/xdg-open
LC_MONETARY=en_US.UTF-8
HOSTNAME=ebi-forecast
R_INCLUDE_DIR=/usr/include/R
R_PRINTCMD=lpr
SHELL=/usr/local/bin/system-specific
TERM=dumb
AWK=gawk
HISTSIZE=1
R_RD4DVI=ae
SSH_CLIENT=888.888.888.88 51159 22
KDE_NO_IPV6=1
R_RD4PDF=times,hyper
R_PAPERSIZE=a4
NCARG_FONTCAPS=/usr/lib64/ncarg/fontcaps
PERL=/usr/bin/perl
LC_NUMERIC=en_US.UTF-8
SSH_TTY=/dev/pts/14
LC_ALL=C
EMACS=t
USER=dleb
LC_TELEPHONE=en_US.UTF-8
LS_COLORS=
LD_LIBRARY_PATH=/usr/lib64/R/lib:/usr/local/lib64:/usr/lib/jvm/jre/lib/amd64/server:/usr/lib/jvm/jre/lib/amd64:/usr/lib/jvm/java/lib/amd64:/usr/java/packages/lib/amd64:/lib:/usr/lib
TAR=/bin/gtar
ENV=
R_ZIPCMD=/usr/bin/zip
KDEDIR=/usr
PAGER=/usr/bin/less
NCARG_GRAPHCAPS=/usr/lib64/ncarg/graphcaps
R_GZIPCMD=/usr/bin/gzip
PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin
LC_COLLATE=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
EGREP=/bin/grep -E
PWD=/home/a-m/dleb/pecan
INPUTRC=/etc/inputrc
R_LIBS=/home/a-m/dleb/lib/R
NCARG_ROOT=/usr
R_SHARE_DIR=/usr/share/R
WHICH=/usr/bin/which
EDITOR=vi
LANG=en_US.UTF-8
KDE_IS_PRELINKED=1
R_LIBS_SITE=/usr/local/lib/R/site-library:/usr/local/lib/R/library:/usr/lib64/R/library:/usr/share/R/library
M ODULEPATH=/usr/share/Modules/modulefiles:/etc/modulefiles
NCARG_DATABASE=/usr/lib64/ncarg/database
LC_MEASUREMENT=en_US.UTF-8
LOADEDMODULES=
PS3=
R_BROWSER=/usr/bin/xdg-open
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
NCARG_LIB=/usr/lib64/ncarg
HOME=/home/a-m/dleb
SHLVL=1
NCARG_NCARG=/usr/share/ncarg
R_ARCH=
TR=/usr/bin/tr
MAKE=make
R_UNZIPCMD=/usr/bin/unzip
LOGNAME=dleb
CVS_RSH=ssh
LC_CTYPE=en_US.UTF-8
SSH_CONNECTION=888.888.888.88 51159 999.999.999.99 22
R_BZIPCMD=/usr/bin/bzip2
MODULESHOME=/usr/share/Modules
LESSOPEN=|/usr/bin/lesspipe.sh %s
PROMPT_COMMAND=
R_HOME=/usr/lib64/R
DISPLAY=localhost:22.0
R_PLATFORM=x86_64-redhat-linux-gnu
INSIDE_EMACS=23.2.1,tramp:2.1.18-23.2
R_LIBS_USER=~/R/x86_64-redhat-linux-gnu-library/2.12
LC_TIME=en_US.UTF-8
R_DOC_DIR=/usr/share/doc/R-2.12.2
R_SESSION_TMPDIR=/tmp/RtmpqA6bpJ
HISTFILE=/home/a-m/dleb/.tramp_history
G_BROKEN_FILENAMES=1
LC_NAME=en_US.UTF-8
_=/bin/env
Assuming you started up R as the same user, you do. You error is not coming from a permissions problem for foo.rb, however, or else your shell would be giving the error. (i.e. sh: ./test.rb: Permission denied; see example below). Here, ruby itself is giving the error. Without knowing exactly what is in your foo.rb, I would suggest digging in there to see what it is trying to load/source, and checking the permissions on those.
#!/usr/bin/env ruby
puts 'Hello world'
Now in R....
> system('ls -l test.rb')
-rw-r--r-- 1 jcolby staff 40 Oct 21 08:23 test.rb
> system('./test.rb')
sh: ./test.rb: Permission denied
> system('chmod a+x test.rb')
> system('./test.rb')
Hello world
I presume the M ODULEPATH in the Emacs-derived output is simply a copy and paste typo.
The differences between the two env outputs is much greater than I expected; I've selected the ones that look slightly suspicious to me:
$ diff -u works fails
--- works 2011-10-24 15:04:02.000000000 -0700
+++ fails 2011-10-24 15:12:36.000000000 -0700
...
+LD_LIBRARY_PATH=/usr/lib64/R/lib:/usr/local/lib64:/usr/lib/jvm/jre/lib/amd64/server:/usr/lib/jvm/jre/lib/amd64:/usr/lib/jvm/java/lib/amd64:/usr/java/packages/lib/amd64:/lib:/usr/lib
...
-PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/opt/dell/srvadmin/bin
-PWD=/home/dleb
...
+PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin
...
+PWD=/home/a-m/dleb/pecan
...
In the emacs-derived session, your LD_LIBRARY_PATH environment variable may be changing specifics of which dynamically linked libraries are being used when executing ruby. If you ssh in to your server and execute your foo.rb with the changed LD_LIBRARY_PATH, does it work or fail?
LD_LIBRARY_PATH=/usr/lib64/R/lib:/usr/local/lib64:/usr/lib/jvm/jre/lib/amd64/server:/usr/lib/jvm/jre/lib/amd64:/usr/lib/jvm/java/lib/amd64:/usr/java/packages/lib/amd64:/lib:/usr/lib ./foo.rb
The PATH environment variable between the two sessions is different; perhaps you have permission to execute /usr/local/bin/ruby (or the libraries in /usr/local/lib/ruby/) but not /usr/bin/ruby (or the libraries in /usr/lib/ruby/). Does your script use #!env ruby or does it use #!/usr/bin/ruby (or some other fixed path)?
Your pwd in one instance is /home/dleb, the other /home/a-m/dleb/pecan -- but HOME is set to /home/a-m/dleb on both systems. Is /home/dleb a symbolic link or does it actually exist separate from /home/a-m/dleb? (This really is grasping at straws -- I don't think this is it, but this problem is baffling.)
One last thing to consider: is your server confined with a tool such as AppArmor, SELinux, TOMOYO, or SMACK? Any of these mandatory access control tools can prevent an application from writing in specific locations, perhaps they aren't yet configured for your site. Check dmesg(1) output to see if there are any rejection messages, most or all these tools log to dmesg(1) if auditd(8) isn't running.