diff options
author | Piotr Strzelczyk <piotr@eps.gda.pl> | 2011-07-02 06:31:51 +0000 |
---|---|---|
committer | Piotr Strzelczyk <piotr@eps.gda.pl> | 2011-07-02 06:31:51 +0000 |
commit | b568316c57a65ca9faa1252a4adba29011822b94 (patch) | |
tree | 6697cec819207e0816d4901919b167ac8a13ecf9 /Master/tlpkg/TeXLive | |
parent | b6580f32abeaa98b671fe4136c6739991458a171 (diff) |
fix install from/to path with spaces
git-svn-id: svn://tug.org/texlive/trunk@23179 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 4 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 25 |
2 files changed, 24 insertions, 5 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index 85e52cdc411..a644db08522 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -291,7 +291,7 @@ sub from_file { } $xzfile_quote = "\"$xzfile\""; $tlpdbfile_quote = "\"$tlpdbfile\""; - my $xzdec = "\"$::progs{'xzdec'}\""; + my $xzdec = TeXLive::TLUtils::quotify_path_with_spaces($::progs{'xzdec'}); debug("trying to download $path.xz to $xzfile\n"); my $ret = TeXLive::TLUtils::download_file("$path.xz", "$xzfile"); # better to check both, the return value AND the existence of the file @@ -1293,7 +1293,7 @@ sub _install_package { # we assume that $::progs has been set up! my $wget = $::progs{'wget'}; - my $xzdec = "\"$::progs{'xzdec'}\""; + my $xzdec = TeXLive::TLUtils::quotify_path_with_spaces($::progs{'xzdec'}); if (!defined($wget) || !defined($xzdec)) { tlwarn("_install_package: programs not set up properly, strange.\n"); return(0); diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 2a8399f1ea4..04e5a6189b7 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -90,6 +90,7 @@ C<TeXLive::TLUtils> -- utilities used in the TeX Live infrastructure TeXLive::TLUtils::member($item, @list); TeXLive::TLUtils::merge_into(\%to, \%from); TeXLive::TLUtils::texdir_check($texdir); + TeXLive::TLUtils::quotify_path_with_spaces($path); TeXLive::TLUtils::conv_to_w32_path($path); TeXLive::TLUtils::native_slashify($internal_path); TeXLive::TLUtils::forward_slashify($path_from_user); @@ -156,6 +157,7 @@ BEGIN { &texdir_check &member "ewords + "ify_path_with_spaces &conv_to_w32_path &native_slashify &forward_slashify @@ -1369,7 +1371,7 @@ sub install_package { # we assume that $::progs has been set up! my $wget = $::progs{'wget'}; - my $xzdec = "\"$::progs{'xzdec'}\""; + my $xzdec = quotify_path_with_spaces($::progs{'xzdec'}); if (!defined($wget) || !defined($xzdec)) { tlwarn("install_package: wget/xzdec programs not set up properly.\n"); return 0; @@ -3176,6 +3178,23 @@ sub process_logging_options { } } +=pod + +This function takes a single argument I<path> and adds +an additional C<"> around it if I<path> contains any spaces or +(on Windows only) some other special characters. + +=cut + +sub quotify_path_with_spaces { + my $p = shift; + my $m = win32() ? '[+=^&();,!%\s]' : ' '; + if ( $p =~ m/$m/ ) { + $p =~ s/"//g; # remove any existing double quotes + $p = "\"$p\""; + } + return($p); +} =pod @@ -3202,7 +3221,7 @@ sub conv_to_w32_path { chomp($cwd); $p = "$cwd\\$p"; } - if ($p =~ m/ /) { $p = "\"$p\""; } + $p = quotify_path_with_spaces($p); return($p); } @@ -3327,7 +3346,7 @@ sub check_on_working_mirror tlwarn ("check_on_working_mirror: Programs not set up, trying wget\n"); $wget = "wget"; } - $wget = "\"wget\""; + $wget = quotify_path_with_spaces($wget); # # the test is currently not completely correct, because we do not # use the LWP if it is set up for it, but I am currently too lazy |