[perl-local-lib] Fix setting undefined variable in CSH

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



commit 659dfb84142755e006e4b5c423d71679c751a6b0
Author: Petr Písař <ppisar@xxxxxxxxxx>
Date:   Thu Nov 21 13:38:40 2013 +0100

    Fix setting undefined variable in CSH

 ...010-Fix-setting-undefined-variable-in-CSH.patch |   48 ++++++++++++++++++++
 perl-homedir.csh                                   |    4 +-
 perl-local-lib.spec                                |    9 +++-
 3 files changed, 58 insertions(+), 3 deletions(-)
---
diff --git a/local-lib-1.008010-Fix-setting-undefined-variable-in-CSH.patch b/local-lib-1.008010-Fix-setting-undefined-variable-in-CSH.patch
new file mode 100644
index 0000000..9005842
--- /dev/null
+++ b/local-lib-1.008010-Fix-setting-undefined-variable-in-CSH.patch
@@ -0,0 +1,48 @@
+From 53297b1441539efdc44fc9c8f4f19fb6ba8290c9 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@xxxxxxxxxx>
+Date: Thu, 21 Nov 2013 12:03:32 +0100
+Subject: [PATCH] Fix setting undefined variable in CSH
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+<https://rt.cpan.org/Public/Bug/Display.html?id=85667>
+
+Signed-off-by: Petr Písař <ppisar@xxxxxxxxxx>
+---
+ lib/local/lib.pm | 19 ++++++++++++++++++-
+ 1 file changed, 18 insertions(+), 1 deletion(-)
+
+diff --git a/lib/local/lib.pm b/lib/local/lib.pm
+index 289e13b..d4f8e2a 100644
+--- a/lib/local/lib.pm
++++ b/lib/local/lib.pm
+@@ -343,7 +343,24 @@ sub build_bourne_env_declaration {
+ sub build_csh_env_declaration {
+   my $class = shift;
+   my($name, $value) = @_;
+-  return defined($value) ? qq{setenv ${name} "${value}";\n} : qq{unsetenv ${name};\n};
++  if (defined($value)) {
++    if ($value =~ /(.*)(\A|\Q$Config{path_sep}\E)(\$)(.+?)(\z|\Q$Config{path_sep}\E)(.*)/) {
++      # If a variable reference exists in the value, we have to delimit it and
++      # dereference it only if it is defined.
++      return
++        qq{test 1 == \$\{?$4\} && } .
++        qq{setenv ${name} "${1}${2}${3}\{${4}\}${5}${6}"} .
++        qq{ || } .
++        qq{setenv ${name} "${1}} .
++          (($2 ne '' and $5 ne '') ?  qq{${2}} : '') .
++          qq{${6}"} .
++        qq{;\n};
++    } else {
++        return qq{setenv ${name} "${value}";\n};
++    }
++  } else {
++    return qq{unsetenv ${name};\n};
++  }
+ }
+ 
+ sub build_win32_env_declaration {
+-- 
+1.8.3.1
+
diff --git a/perl-homedir.csh b/perl-homedir.csh
index ef7ad3b..b00fb0d 100644
--- a/perl-homedir.csh
+++ b/perl-homedir.csh
@@ -11,10 +11,10 @@ if (-f "$HOME/.perl-homedir") then
 	source "$HOME/.perl-homedir"
 endif
 
-alias perlll 'eval `perl -Mlocal::lib`'
+alias perlll 'eval "`perl -Mlocal::lib`"'
 
 # if system default
 if ("x$PERL_HOMEDIR" == "x1") then
-	eval `perl -Mlocal::lib`
+	eval "`perl -Mlocal::lib`"
 endif
 
diff --git a/perl-local-lib.spec b/perl-local-lib.spec
index b74b6f3..6ee542d 100644
--- a/perl-local-lib.spec
+++ b/perl-local-lib.spec
@@ -1,6 +1,6 @@
 Name:       perl-local-lib
 Version:    1.008010
-Release:    3%{?dist}
+Release:    4%{?dist}
 # lib/local/lib.pm -> GPL+ or Artistic
 License:    GPL+ or Artistic
 Group:      Development/Libraries
@@ -8,6 +8,9 @@ Summary:    Create and use a local lib/ for perl modules
 Source:     http://search.cpan.org/CPAN/authors/id/E/ET/ETHER/local-lib-%{version}.tar.gz
 # Allow evaluation in CSH, RHBZ #849609, CPAN RT #60072
 Patch0:     local-lib-1.008009-Append-semicolon-to-setenv.patch
+# Fix setting variables in CSH, RHBZ# 1033018, CPAN RT #85667,
+# upstream is going the refactor the whole code, patch not sent to upstream
+Patch1:     local-lib-1.008010-Fix-setting-undefined-variable-in-CSH.patch
 Url:        http://search.cpan.org/dist/local-lib
 Requires:   perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
 BuildArch:  noarch
@@ -65,6 +68,7 @@ install this package.
 %prep
 %setup -q -n local-lib-%{version}
 %patch0 -p1
+%patch1 -p1
 rm -rf inc
 
 %build
@@ -91,6 +95,9 @@ make test
 %{_sysconfdir}/profile.d/*
 
 %changelog
+* Thu Nov 21 2013 Petr Pisar <ppisar@xxxxxxxxxx> - 1.008010-4
+- Fix setting undefined variable in CSH (bug #1033018)
+
 * Sun Aug 04 2013 Fedora Release Engineering <rel-eng@xxxxxxxxxxxxxxxxxxxxxxx> - 1.008010-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
 
--
Fedora Extras Perl SIG
http://www.fedoraproject.org/wiki/Extras/SIGs/Perl
perl-devel mailing list
perl-devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/perl-devel





[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Legacy Announce]     [Fedora PHP Devel]     [Kernel Devel]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Big List of Linux Books]     [Gimp]     [Yosemite Information]
  Powered by Linux