* extfs/deb.in (mcdebfs_list): Separated the use of quoted and unquoted variables. (mcdebfs_copyout): likewise. (mcdebfs_run): likewise. From Leonard den Ottolander <leonard@den.ottolander.nl>

This commit is contained in:
Roland Illig 2004-08-19 17:37:01 +00:00
parent 2c4ca680bb
commit a37fdaca96
2 changed files with 26 additions and 8 deletions

View File

@ -1,3 +1,11 @@
2004-08-19 Roland Illig <roland.illig@gmx.de>
* extfs/deb.in (mcdebfs_list): Separated the use of quoted and
unquoted variables. (mcdebfs_copyout): likewise.
(mcdebfs_run): likewise.
From Leonard den Ottolander <leonard@den.ottolander.nl>
2004-08-19 Roland Illig <roland.illig@gmx.de> 2004-08-19 Roland Illig <roland.illig@gmx.de>
* extfs/deba.in (list): Separated the use of quoted and unquoted * extfs/deba.in (list): Separated the use of quoted and unquoted

View File

@ -26,8 +26,10 @@ sub mcdebfs_list
# Empty directories do not appear at all # Empty directories do not appear at all
# #
local($archivename)=@_; local($archivename)=@_;
local $qarchivename = $archivename;
$qarchivename =~ s/([^\w\/.+-])/\\$1/g;
chop($date=`LC_ALL=C date "+%b %d %Y %H:%M"`); chop($date=`LC_ALL=C date "+%b %d %Y %H:%M"`);
chop($info_size=`dpkg -I $archivename | wc -c`); chop($info_size=`dpkg -I $qarchivename | wc -c`);
$install_size=length($pressinstall); $install_size=length($pressinstall);
print "dr-xr-xr-x 1 root root 0 $date CONTENTS\n"; print "dr-xr-xr-x 1 root root 0 $date CONTENTS\n";
@ -36,7 +38,7 @@ sub mcdebfs_list
print "-r--r--r-- 1 root root $info_size $date INFO\n"; print "-r--r--r-- 1 root root $info_size $date INFO\n";
print "-r-xr--r-- 1 root root $install_size $date INSTALL\n"; print "-r-xr--r-- 1 root root $install_size $date INSTALL\n";
if ( open(PIPEIN, "dpkg-deb -c $archivename |") ) if ( open(PIPEIN, "dpkg-deb -c $qarchivename |") )
{ {
while(<PIPEIN>) while(<PIPEIN>)
{ {
@ -81,7 +83,7 @@ sub mcdebfs_list
} }
} }
# begin from Patrik Rak # begin from Patrik Rak
if ( open(PIPEIN, "dpkg-deb -I $archivename |") ) if ( open(PIPEIN, "dpkg-deb -I $qarchivename |") )
{ {
while(<PIPEIN>) while(<PIPEIN>)
{ {
@ -109,16 +111,22 @@ sub mcdebfs_list
sub mcdebfs_copyout sub mcdebfs_copyout
{ {
local($archive,$filename,$destfile)=@_; local($archive,$filename,$destfile)=@_;
local $qarchive = $archive;
$qarchive =~ s/([^\w\/.+-])/\\$1/g;
local $qfilename = $filename;
$qfilename =~ s/([^\w\/.+-])/\\$1/g;
local $qdestfile = $destfile;
$qdestfile =~ s/([^\w\/.+-])/\\$1/g;
if($filename eq "INFO") if($filename eq "INFO")
{ {
system("dpkg-deb -I $archive > $destfile"); system("dpkg-deb -I $qarchive > $qdestfile");
# begin from Patrik Rak # begin from Patrik Rak
} }
elsif($filename =~ /^DEBIAN/) elsif($filename =~ /^DEBIAN/)
{ {
$filename=~s!^DEBIAN/!!; $filename=~s!^DEBIAN/!!;
system("dpkg-deb -I $archive $filename > $destfile"); system("dpkg-deb -I $qarchive $qfilename > $qdestfile");
# end from Patrik Rak # end from Patrik Rak
} }
@ -128,24 +136,26 @@ sub mcdebfs_copyout
{ {
print FILEOUT $pressinstall; print FILEOUT $pressinstall;
close FILEOUT; close FILEOUT;
system("chmod a+x $destfile"); system("chmod a+x $qdestfile");
} }
} }
else else
{ {
# files can be prepended with ./ or not, depending on the version of tar # files can be prepended with ./ or not, depending on the version of tar
$filename=~s!^CONTENTS/!!; $filename=~s!^CONTENTS/!!;
system("dpkg-deb --fsys-tarfile $archive | tar xOf - $filename ./$filename > $destfile 2>/dev/null"); system("dpkg-deb --fsys-tarfile $qarchive | tar xOf - $qfilename ./$qfilename > $qdestfile 2>/dev/null");
} }
} }
sub mcdebfs_run sub mcdebfs_run
{ {
local($archive,$filename)=@_; local($archive,$filename)=@_;
local $qarchive = $archive;
$qarchive =~ s/([^\w\/.+-])/\\$1/g;
if($filename eq "INSTALL") if($filename eq "INSTALL")
{ {
print "Installing $archive\n"; print "Installing $archive\n";
system("dpkg -i $archive"); system("dpkg -i $qarchive");
} }
else else
{ {