Bugzilla – Attachment 101285 Details for
Bug 211576
inst_kickoff is buggy
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
[patch]
Proposed patch
packager.diff (text/plain), 13.99 KB, created by
Lukas Ocilka
on 2006-10-12 06:57:23 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Lukas Ocilka
Created:
2006-10-12 06:57:23 UTC
Size:
13.99 KB
patch
obsolete
>Index: src/clients/inst_rpmcopy.ycp >=================================================================== >--- src/clients/inst_rpmcopy.ycp (revision 33326) >+++ src/clients/inst_rpmcopy.ycp (working copy) >@@ -35,6 +35,7 @@ > import "Kernel"; > import "Service"; > import "SourceManager"; >+ import "String"; > > // variables related to installation source caching > >@@ -92,6 +93,7 @@ > { > map<string,string> product_data = (map<string,string>)Pkg::SourceProduct (id); > y2milestone ("Id %1: SourceProduct %2", id, product_data); >+ // FIXME: find() > if (find (product_data["flags"]:"", "cache") >= 0) > { > cached_id = id; >@@ -270,7 +272,7 @@ > } > > map ta_out = (map)SCR::Execute (.target.bash_output, >- sformat ("mkdir -p %1", Installation::destdir + cache_dir)); >+ sformat ("mkdir -p '%1'", String::Quote (Installation::destdir + cache_dir))); > y2milestone ("Created cached dir '%1': %2", Installation::destdir+cache_dir, ta_out); > if (ta_out["exit"]:0 != 0) > { >@@ -284,7 +286,7 @@ > > string tmp_dir = cache_dir; > ta_out = (map)SCR::Execute (.target.bash_output, >- sformat ("mktemp -d -p %1", Installation::destdir + cache_dir)); >+ sformat ("mktemp -d -p '%1'", String::Quote (Installation::destdir + cache_dir))); > y2milestone ("Created temp dir %1: %2", Installation::destdir+cache_dir, ta_out); > if (ta_out["exit"]:0 != 0) > { >@@ -301,16 +303,16 @@ > ta_out = (map)SCR::Execute (.target.bash_output, > // first line is in target system > // the second one in installation system >- sformat ("rm -rf %3%1/%4; ln -s %3%2 %3%1/%4; >- rm -rf %1/%4; ln -s %3%2 %1/%4;", >+ sformat ("rm -rf '%3%1/%4'; ln -s '%3%2' '%3%1/%4'; >+ rm -rf '%1/%4'; ln -s '%3%2' '%1/%4';", > tmp_dir, > substring (cache_dir, size (Installation::destdir)), >- Installation::destdir, cached_source_datadir)); >- y2milestone ("rm -rf %3%1/%4; ln -s %3%2 %3%1/%4; >- rm -rf %1/%4; ln -s %3%2 %1/%4;", >+ String::Quote (Installation::destdir), cached_source_datadir)); >+ y2milestone ("rm -rf '%3%1/%4'; ln -s '%3%2' '%3%1/%4'; >+ rm -rf '%1/%4'; ln -s '%3%2' '%1/%4';", > tmp_dir, > substring (cache_dir, size (Installation::destdir)), >- Installation::destdir, cached_source_datadir); >+ String::Quote (Installation::destdir), cached_source_datadir); > y2milestone ("Result %1", ta_out); > if (ta_out["exit"]:0 != 0) > { >@@ -585,6 +587,7 @@ > Pkg::SourceMoveDownloadArea (download_dir); > } > >+ // FIXME: find() > if (find (Kernel::GetCmdLine (), "yastnocache") != -1) > { > y2milestone ("'yastnocache' found, disabling source cache"); >Index: src/clients/inst_dirinstall_finish.ycp >=================================================================== >--- src/clients/inst_dirinstall_finish.ycp (revision 33326) >+++ src/clients/inst_dirinstall_finish.ycp (working copy) >@@ -23,6 +23,7 @@ > import "Timezone"; > import "Console"; > import "RunlevelEd"; >+ import "String"; > > list<string> progress_stages = > [ >@@ -116,9 +117,9 @@ > DirInstall::image_name != "") > { > Progress::NextStage(); >- string cmd = sformat("cd %1 && tar -zcf %2 . && cd - ", >- DirInstall::target, >- DirInstall::image_dir + "/" + DirInstall::image_name + ".tgz"); >+ string cmd = sformat("cd '%1' && tar -zcf '%2' . && cd - ", >+ String::Quote (DirInstall::target), >+ String::Quote (DirInstall::image_dir + "/" + DirInstall::image_name + ".tgz")); > y2debug("cmd: %1", cmd); > // progress title > Progress::Title(_("Building directory image...")); >Index: src/clients/inst_dirinstall.ycp >=================================================================== >--- src/clients/inst_dirinstall.ycp (revision 33326) >+++ src/clients/inst_dirinstall.ycp (working copy) >@@ -20,15 +20,16 @@ > import "PackageCallbacks"; > import "Wizard"; > import "Progress"; >+ import "String"; > > Pkg::TargetFinish (); > DirInstall::MountFilesystems (); > > // create /dev/zero and /dev/null devices in the target directory, > // some packages require them in the postinstall script >- SCR::Execute(.target.bash, sformat("mkdir -p %1/dev", DirInstall::target)); >- SCR::Execute(.target.bash, sformat("mknod -m 666 %1/dev/zero c 1 5", DirInstall::target)); >- SCR::Execute(.target.bash, sformat("mknod -m 666 %1/dev/null c 1 3", DirInstall::target)); >+ SCR::Execute(.target.bash, sformat("mkdir -p '%1/dev'", String::Quote (DirInstall::target))); >+ SCR::Execute(.target.bash, sformat("mknod -m 666 '%1/dev/zero' c 1 5", String::Quote (DirInstall::target))); >+ SCR::Execute(.target.bash, sformat("mknod -m 666 '%1/dev/null' c 1 3", String::Quote (DirInstall::target))); > > /* > if(Pkg::TargetInit (Installation::destdir,true) != true) >Index: src/clients/inst_kickoff.ycp >=================================================================== >--- src/clients/inst_kickoff.ycp (revision 33326) >+++ src/clients/inst_kickoff.ycp (working copy) >@@ -25,6 +25,7 @@ > import "Arch"; > import "FileUtils"; > import "ProductFeatures"; >+ import "String"; > > void AcpiToInitrd () { > if (! (Arch::i386 () || Arch::x86_64 () || Arch::ia64 ())) >@@ -47,10 +48,12 @@ > string mtab = (string) WFM::Read(.local.string, mtabname); > > SCR::Write(.target.string, tmpdir + "/mtab", mtab); >- SCR::Execute (.target.bash, "/bin/cat " + tmpdir + "/mtab" >+ SCR::Execute (.target.bash, "/bin/cat " >+ + "'" + String::Quote (tmpdir + "/mtab") + "'" > + " | /bin/sed \"s: " + Installation::destdir > + "/: /:\"| /bin/sed \"s: " + Installation::destdir >- + ": /:\" > " + Installation::destdir + mtabname); >+ + ": /:\" " >+ + "> '" + String::Quote (Installation::destdir) + "'" + mtabname); > > } > >@@ -62,7 +65,7 @@ > > // remove old junk, script is in yast2-update > SCR::Execute (.target.bash, Directory::ybindir + "/remove_junk " + >- Installation::destdir); >+ "'" + String::Quote (Installation::destdir) + "'"); > > // possibly remove /usr/share/info/dir > if (!Pkg::TargetFileHasOwner ("/usr/share/info/dir")) >@@ -93,8 +96,8 @@ > > if (Update::remove_old_backups) > { >- SCR::Execute (.target.bash, "/bin/rm -f " + Installation::destdir + >- Update::backup_path + "/*-*-*.tar.{gz,bz2}"); >+ SCR::Execute (.target.bash, "cd '" + String::Quote (Installation::destdir) + "'; " + >+ "/bin/rm -f " + Update::backup_path + "/*-*-*.tar.{gz,bz2}"); > } > > if (true) >@@ -115,9 +118,8 @@ > num = num + 1; > } > >- if (SCR::Execute (.target.bash, "cd " + Installation::destdir + >- " ; /bin/tar czf " + Installation::destdir + >- filename + " " + "var/log/YaST2") != 0) >+ if (SCR::Execute (.target.bash, "cd '" + String::Quote (Installation::destdir) + "'; " + >+ "/bin/tar czf ." + filename + " " + "var/log/YaST2") != 0) > { > y2error ("backup of %1 to %2 failed", Directory::logdir, filename); > // an error popup >@@ -126,8 +128,8 @@ > } > else > { >- SCR::Execute (.target.bash, "/bin/rm -rf " + Installation::destdir + >- "var/log/YaST2/*"); >+ SCR::Execute (.target.bash, "cd '" + String::Quote (Installation::destdir) + "'; " + >+ "/bin/rm -rf var/log/YaST2/*"); > } > } > >@@ -151,9 +153,8 @@ > num = num + 1; > } > >- if (SCR::Execute (.target.bash, "cd " + Installation::destdir + >- " ; /bin/tar czf " + Installation::destdir + >- filename + " " + "etc/sysconfig") != 0) >+ if (SCR::Execute (.target.bash, "cd '" + String::Quote (Installation::destdir) + "'; " + >+ "/bin/tar czf ." + filename + " " + "etc/sysconfig") != 0) > { > y2error ("backup of %1 to %2 failed", "/etc/sysconfig", filename); > // an error popup >@@ -178,10 +179,9 @@ > num = num + 1; > } > >- if (SCR::Execute (.target.bash, "cd " + Installation::destdir + >- " ; /bin/tar czf " + Installation::destdir + >- filename + " " + "etc/rc.config" + " " + >- "etc/rc.config.d") != 0) >+ if (SCR::Execute (.target.bash, "cd '" + String::Quote (Installation::destdir) + "'; " + >+ "/bin/tar czf ." + filename + " " + >+ "etc/rc.config etc/rc.config.d") != 0) > { > y2error ("backup of %1 to %2 failed", "/etc/rc.config", filename); > // an error popup >@@ -204,8 +204,9 @@ > // have to handle older version in a special case. > > string idfile = (string) SCR::Read(.target.tmpdir) + "/idline"; >- if (SCR::Execute (.target.bash, "/bin/grep ^id: " + Installation::destdir + >- "/etc/inittab >" + idfile) == 0) >+ if (SCR::Execute (.target.bash, "/bin/grep ^id: " + >+ "'" + String::Quote (Installation::destdir) + "/etc/inittab" + "'" + >+ " >" + idfile) == 0) > { > // idline = "id:X:initdefault:" > >@@ -255,7 +256,9 @@ > } > > // get the current raid configuration >- map out = (map) SCR::Execute (.target.bash_output, "chroot " + Installation::destdir + " mdadm -Ds"); >+ map out = (map) SCR::Execute (.target.bash_output, >+ "chroot '" + String::Quote (Installation::destdir) + "' " + >+ "mdadm -Ds"); > if (out["exit"]:-1 != 0) { > y2error ("Error occurred while getting raid configuration: %1", out); > return; >@@ -318,16 +321,18 @@ > { > string template_dir= "/var/adm/fillup-templates"; > // hack 'pre-req' cyclic dependency between bash, aaa_base, and perl >- SCR::Execute(.target.bash, "/bin/cp " + template_dir + "/passwd.aaa_base " >- + Installation::destdir + "/etc/passwd"); >- SCR::Execute(.target.bash, "/bin/cp " + template_dir + "/group.aaa_base " >- + Installation::destdir + "/etc/group"); >- SCR::Execute(.target.bash, "/bin/cp " + template_dir + "/shadow.aaa_base " >- + Installation::destdir + "/etc/shadow"); >+ SCR::Execute(.target.bash, "/bin/cp " + template_dir + "/passwd.aaa_base " + >+ "'" + String::Quote (Installation::destdir) + "/etc/passwd" + "'"); >+ SCR::Execute(.target.bash, "/bin/cp " + template_dir + "/group.aaa_base " + >+ "'" + String::Quote (Installation::destdir) + "/etc/group" + "'"); >+ SCR::Execute(.target.bash, "/bin/cp " + template_dir + "/shadow.aaa_base " + >+ "'" + String::Quote (Installation::destdir) + "/etc/shadow" + "'"); > } else > { >- SCR::Execute(.target.bash, "/bin/cp /etc/passwd " + Installation::destdir + "/etc"); >- SCR::Execute(.target.bash, "/bin/cp /etc/group " + Installation::destdir + "/etc"); >+ SCR::Execute(.target.bash, "/bin/cp /etc/passwd " + >+ "'" + String::Quote (Installation::destdir) + "/etc" + "'"); >+ SCR::Execute(.target.bash, "/bin/cp /etc/group " + >+ "'" + String::Quote (Installation::destdir) + "/etc" + "'"); > } > > // fake mtab >@@ -368,7 +373,7 @@ > > // check passwd and group of target > SCR::Execute (.target.bash, "/usr/lib/YaST2/bin/update_users_groups " + >- Installation::destdir); >+ "'" + String::Quote (Installation::destdir) + "'"); > > // update inittab > update_inittab (); >@@ -397,9 +402,9 @@ > { > ProductFeatures::Save(); > WFM::Execute (.local.bash, sformat ( >- "/bin/mkdir -p %1/etc/YaST2", Installation::destdir)); >+ "/bin/mkdir -p '%1/etc/YaST2'", String::Quote (Installation::destdir))); > WFM::Execute (.local.bash, sformat ( >- "/bin/cp %1 %2/%1", "/etc/YaST2/ProductFeatures", Installation::destdir)); >+ "/bin/cp '%1' '%2/%1'", "/etc/YaST2/ProductFeatures", String::Quote (Installation::destdir))); > } > > return `next; >Index: src/clients/pkg_finish.ycp >=================================================================== >--- src/clients/pkg_finish.ycp (revision 33326) >+++ src/clients/pkg_finish.ycp (working copy) >@@ -17,6 +17,7 @@ > textdomain "packager"; > > import "Installation"; >+import "String"; > > any ret = nil; > string func = ""; >@@ -52,9 +53,9 @@ > > // copy list of failed packages to installed system > WFM::Execute (.local.bash, sformat ( >- "test -f %1 && /bin/cp -a %1 %2%1", >+ "test -f %1 && /bin/cp -a %1 '%2%1'", > "/var/lib/YaST2/failed_packages", >- Installation::destdir)); >+ String::Quote (Installation::destdir))); > } > else > { >Index: src/modules/DirInstall.ycp >=================================================================== >--- src/modules/DirInstall.ycp (revision 33326) >+++ src/modules/DirInstall.ycp (working copy) >@@ -14,8 +14,8 @@ > import "Stage"; > import "HTML"; > import "ProductControl"; >+import "String"; > >- > global boolean runme_at_boot = false; > global string target = "/var/tmp/dirinstall"; > >@@ -83,9 +83,9 @@ > string dev = descr[1]:""; > string type = descr[2]:""; > mp = target + mp; >- WFM::Execute (.local.bash, sformat ("test -d %1 || mkdir -p %1", mp)); >- WFM::Execute (.local.bash, sformat ("/bin/mount -t %1 %2 %3", >- type, dev, mp)); >+ WFM::Execute (.local.bash, sformat ("test -d '%1' || mkdir -p '%1'", String::Quote (mp))); >+ WFM::Execute (.local.bash, sformat ("/bin/mount -t %1 %2 '%3'", >+ type, dev, String::Quote (mp))); > mounted_fs = add (mounted_fs, mp); > }); > y2milestone ("Mounted filesystems: %1", mounted_fs); >@@ -94,7 +94,7 @@ > global void UmountFilesystems () { > y2milestone ("Mounted filesystems: %1", mounted_fs); > foreach (string mp, mounted_fs, { >- WFM::Execute (.local.bash, sformat ("/bin/umount %1", mp)); >+ WFM::Execute (.local.bash, sformat ("/bin/umount '%1'", String::Quote (mp))); > }); > mounted_fs = []; > } >Index: src/modules/PackageCallbacks.ycp >=================================================================== >--- src/modules/PackageCallbacks.ycp (revision 33326) >+++ src/modules/PackageCallbacks.ycp (working copy) >@@ -359,8 +359,8 @@ > if (error != 0) > { > string infopath = (string) SCR::Read (.target.tmpdir) + "/rpmlog"; >- SCR::Execute (.target.bash, "/usr/bin/tail " + Installation::destdir >- + Directory::logdir + "/y2logRPM > " + infopath); >+ SCR::Execute (.target.bash, "/usr/bin/tail '" + String::Quote (Installation::destdir) >+ + Directory::logdir + "/y2logRPM' > " + infopath); > string info = reason + "\n---\n" + (string) SCR::Read (.target.string, [infopath, "-?-"]); > > string message = sformat ( _deleting_package ?
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 211576
:
101217
|
101225
|
101285
|
101286