How can I add/set Ruby path on bash? - ruby

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

Related

Ruby 2.3: time_zone.rb:272: warning: circular argument reference - now

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

Prevent logging a specific command in Concourse CI

I have a shell-based concourse task which uses semi-sensitive credentials (a key to a test server) in one of its commands. I'd like to avoid this being logged in the task output.
The gist of the pipeline is:
jobs:
- name: foobar
plan:
<...>
- task: build
config:
platform: linux
image_resource:
type: docker-image
source:
repository: ubuntu
<...>
run:
path: bash
args:
- -exc
- |
command-which-is-ok-to-print
foobar {{my-secret-data}} # <-- hide this one!
another-command-which-is-ok-to-print
Currently the output appears as:
+ command-which-is-ok-to-print
results of first command which are OK to print
+ foobar "oh-no-secret-data-here!" <-- hide this one!
more results which are OK to print
+ another-command-which-is-ok-to-print
even more results which are OK to print
Is there a way to suppress printing this specific line?
I twigged that -exc was actually setting the flags e and x (I'd assumed it was short-hand for execute!
The -x is what causes the commands to be echoed (by bash itself rather than concourse), so this successfully prevented a single command being executed:
<...>
run:
path: bash
args:
- -exc
- |
command-which-is-ok-to-print
set +x
foobar {{my-secret-data}}
set -x
another-command-which-is-ok-to-print

Vagrant - Not Supported the capability 'change_host_name'

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\plugin‌​s\guests\ubuntu\gues‌​t.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

How to make Guard watch files in a subdirectory

I'm trying to have Guard compile my CoffeeScript files to JS files, and then have Juicer merge and minify them. I use a tmp directory to store the intermediate JS files. From what I understand this should work, but it doesn't:
guard :coffeescript, :input => "src/coffee", :output => "tmp"
guard :shell do
watch %r{^tmp/.+\.js$} do
system 'juicer', 'merge', 'tmp/app.js', '-sfo', 'js/app.js'
end
end
CoffeeScript files are correctly compiled into the tmp directory every time they are touched, but then the shell guard does not fire.
Launching guard with --debug and changing one of the JS files in tmp by hand, I don't get any debug line in the terminal. It seems like those files are not being monitored.
$ guard --debug
18:53:51 - DEBUG - Command execution: which notify-send
18:53:51 - DEBUG - Command execution: emacsclient --eval '1' 2> /dev/null || echo 'N/A'
18:53:51 - INFO - Guard is using TerminalTitle to send notifications.
18:53:51 - DEBUG - Command execution: hash stty
18:53:51 - DEBUG - Guard starts all plugins
18:53:51 - DEBUG - Hook :start_begin executed for Guard::CoffeeScript
18:53:51 - DEBUG - Hook :start_end executed for Guard::CoffeeScript
18:53:51 - DEBUG - Hook :start_begin executed for Guard::Shell
18:53:51 - DEBUG - Hook :start_end executed for Guard::Shell
18:53:51 - INFO - Guard is now watching at '/home/tobia/my_project'
18:53:51 - DEBUG - Start interactor
[1] guard(main)>
^^^ if I modify the JS files in /home/tobia/my_project/tmp at this point, nothing happens.
I'm using Ruby 1.9.1 from Debian stable, Guard 1.8.2 and Guard-shell 0.5.1 installed with sudo gem install
After some investigation I realized that tmp is in the default ignore list, so this is why Guard doesn't pick up changes from the generated JavaScript files. To work around this, you can either...
1. Remove tmp from the ignored directories list
ignore! /.git/
guard :coffeescript, :input => "src/coffee", :output => "tmp"
guard :shell do
watch %r{^tmp/.+\.js$} do
system 'juicer', 'merge', 'tmp/app.js', '-sfo', 'js/app.js'
end
end
2. Compile the JavaScript to a different directory
guard :coffeescript, :input => "src/coffee", :output => "src/js"
guard :shell do
watch %r{^src/.+\.js$} do
system 'juicer', 'merge', 'tmp/app.js', '-sfo', 'js/app.js'
end
end

system(): why do I not have the same permissions when using R in EMACS as I do in the bash terminal?

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.

Resources