[Bug 1186698] /etc/profile.d/perl-homedir.csh contains bourne shell "if" code. Makes tcsh prompt "if: Expression Syntax."

bugzilla at redhat.com bugzilla at redhat.com
Mon Jun 1 12:24:27 UTC 2015


https://bugzilla.redhat.com/show_bug.cgi?id=1186698

Eskil Brun <eskil at ifi.uio.no> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|needinfo?(eskil at ifi.uio.no) |



--- Comment #4 from Eskil Brun <eskil at ifi.uio.no> ---
(In reply to Petr Ĺ abata from comment #2)
> Does the attached version, taken from the rawhide branch, of
> perl-homedir.csh work for you?

No. The script has obviously never been tested with csh. It now gives off this
error message:

  setenv: Too many arguments.

And the script fails to perform its tasks.

The trouble lies in the assumption that newlines will be preserved when the
backquoted command is enclosed in double quotes. in bourne shell variants this
works. Not so with csh. I do not know how to preserve newlines from a
backquoted command in csh.

However, one can use tr to replace newlines with semicolons. Below is a
modified version of the script that does this:

#################################################################

# invoke local::lib

# default -- invoke local::lib for all users
setenv PERL_HOMEDIR 1

# load our configs, aka opportunities to set PERL_HOMEDIR=0
if (-f /etc/sysconfig/perl-homedir) then
    eval `sed -ne 's|^[[:blank:]]*\([^#=]\{1,\}\)=\([^=]*\)|setenv \1 \2;|p'
/etc/sysconfig/perl-homedir`
endif
if (-f "$HOME/.perl-homedir") then
    eval `sed -ne 's|^[[:blank:]]*\([^#=]\{1,\}\)=\([^=]*\)|setenv \1 \2;|p'
"$HOME/.perl-homedir"`
endif

alias perlll 'eval "`perl -Mlocal::lib|tr \\n \;`"'

# if system default
if ("x$PERL_HOMEDIR" == "x1") then
    eval "`perl -Mlocal::libtr \\n \;`"
endif

##################################################################

Really, I think the perl-homedir maintainers should just stop pretending to
support csh and remove the /etc/profile.d/perl-homedir.csh from the package if
they can not be bothered to test their script. Obviously they know diddly squat
about csh and are not able to support csh properly. As of now, all they have
done is provide extra error messages for all csh users on systems that use the
perl-homedir package.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the perl-devel mailing list