Author: jsrain
Date: Wed Aug 22 17:07:30 2007
New Revision: 40413
URL: http://svn.opensuse.org/viewcvs/yast?rev=40413&view=rev
Log:
fixed race condition (unfortunate kill of 'dd') (#302551)
Modified:
trunk/live-installer/package/yast2-live-installer.changes
trunk/live-installer/src/control/live-install.xml
trunk/live-installer/src/inst_live_doit.ycp
Modified: trunk/live-installer/package/yast2-live-installer.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/live-installer/package/yast2-live-installer.changes?rev=40413&r1=40412&r2=40413&view=diff
==============================================================================
--- trunk/live-installer/package/yast2-live-installer.changes (original)
+++ trunk/live-installer/package/yast2-live-installer.changes Wed Aug 22 17:07:30 2007
@@ -1,4 +1,9 @@
-------------------------------------------------------------------
+Wed Aug 22 17:06:42 CEST 2007 - jsrain@suse.cz
+
+- fixed race condition (unfortunate kill of 'dd') (#302551)
+
+-------------------------------------------------------------------
Tue Aug 14 09:26:20 CEST 2007 - jsuchome@suse.cz
- added text to .desktop file, correct icon name
Modified: trunk/live-installer/src/control/live-install.xml
URL: http://svn.opensuse.org/viewcvs/yast/trunk/live-installer/src/control/live-install.xml?rev=40413&r1=40412&r2=40413&view=diff
==============================================================================
--- trunk/live-installer/src/control/live-install.xml (original)
+++ trunk/live-installer/src/control/live-install.xml Wed Aug 22 17:07:30 2007
@@ -145,6 +145,10 @@
<label>Welcome</label>
<name>inst_live_welcome</name>
</module>
+ <module>
+ <label>License Agreement</label>
+ <name>inst_license</name>
+ </module>
<module>
<label>Installation Settings</label>
<name>inst_live_simple_proposal</name>
Modified: trunk/live-installer/src/inst_live_doit.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/live-installer/src/inst_live_doit.ycp?rev=40413&r1=40412&r2=40413&view=diff
==============================================================================
--- trunk/live-installer/src/inst_live_doit.ycp (original)
+++ trunk/live-installer/src/inst_live_doit.ycp Wed Aug 22 17:07:30 2007
@@ -31,11 +31,17 @@
if (total_mb == 0)
total_mb = 1024*1024*1024; // should be big enough
- string tmp_pipe = (string)SCR::Read (.target.tmpdir) + "/system_clone_fifo";
+ string tmp_pipe1 = (string)SCR::Read (.target.tmpdir) + "/system_clone_fifo_1";
+ string tmp_pipe2 = (string)SCR::Read (.target.tmpdir) + "/system_clone_fifo_2";
// FIXME this does not copy pipes in filesystem (usually not an issue)
cmd = sformat (
- "mkfifo %3 ; tar -C %1 -cSf - --one-file-system . | dd bs=1048576 of=%3 & echo $! >&2 ; tar -C %2 -xSf %3",
- from, to, tmp_pipe);
+ "mkfifo %3 ;
+ mkfifo %4 ;
+ tar -C %1 -cSf %3 --one-file-system . &
+ dd bs=1048576 if=%3 of=%4 >&2 &
+ jobs -l >&2;
+ tar -C %2 -xSf %4",
+ from, to, tmp_pipe1, tmp_pipe2);
y2milestone ("Executing %1", cmd);
SCR::Execute(.background.run_output_err, cmd);
string pid = "";
@@ -50,13 +56,17 @@
pid = lines[0]:"";
lines[0] = nil;
lines = filter (string l, lines, { return l != nil; });
- if (! regexpmatch (pid, "^[0-9]+$"))
+ if (! regexpmatch (pid, sformat ("dd bs=1048576 if=%1 of=%2", tmp_pipe1, tmp_pipe2)))
pid = "";
else
+ {
+ pid = regexpsub (pid, "([0-9]+) [^ 0-9]+ +dd", "\\1");
y2milestone ("DD's pid: %1", pid);
+ // sleep in order not to kill -USR1 to dd too early, otherwise it finishes
+ sleep (5000);
+ }
}
foreach (string l, lines, {
-y2internal ("Line: %1", l);
if (regexpmatch (l, "^[0-9]+ "))
done = regexpsub (l, "^([0-9]+) ", "\\1");
});
@@ -64,18 +74,21 @@
}
if (pid != "")
{
- SCR::Execute (.target.bash, sformat ("/bin/kill -USR1 %1", pid));
+ cmd = sformat ("/bin/kill -USR1 %1", pid);
+ y2milestone ("Executing %1", cmd);
+ SCR::Execute (.target.bash, cmd);
}
sleep (100);
if (done != nil)
{
integer progress = progress_start + (progress_finish - progress_start) * tointeger (done) / total_mb / 1024 / 1024;
Progress::Step (progress);
- y2milestone ("Setting progress to %1", progress);
+ y2debug ("Setting progress to %1", progress);
}
}
y2milestone ("Result: %1", SCR::Read (.background.status));
- SCR::Execute (.target.remove, tmp_pipe);
+ SCR::Execute (.target.remove, tmp_pipe1);
+ SCR::Execute (.target.remove, tmp_pipe2);
cmd = sformat ("chown --reference=%1 %2; chmod --reference=%1 %2",
from, to);
y2milestone ("Executing %1", cmd);
@@ -133,6 +146,11 @@
* @return boolean true on success
*/
boolean CopySymlinkedImage (map