Package: piuparts
Version: 0.40
Severity: wishlist
Tags: patch
Attached patch addresses TODO item re libeatmydata ..
"- use libeatmydata - either install it in all chroots or find a
better way to use it."
With Squeeze release, the version of dpkg in stable has had an option
"--force-unsafe-io" which, while it certainly does not disable ALL
fsync() calls, does disable some of them (sorry, that is extent of
my knowledge).
So, while installing libeatmydata into chroot would be superior,
the attached patch provides for running dpkg with the ”force-unsafe-io”
option (whether directly or via apt) in the chroot.
I added a command-line option to allow the user to DISABLE
this behavior; i.e. the default is to use force-unsafe-io. If
the user specifies "--dpkg-noforce-unsafe-io" on piuparts
command line, dpkg runs as normal (safe, but slower).
Hopefully, the text of the option in piuparts --help, and in man
page is clear.
diff --git a/piuparts.1.txt b/piuparts.1.txt
--- a/piuparts.1.txt
+++ b/piuparts.1.txt
@@ -62,6 +62,9 @@
*--dpkg-force-confdef*::
Make dpkg use --force-confdef, which lets dpkg always choose the default action when a modified conffile is found. This option will make piuparts ignore errors it was designed to report and therefore should only be used to hide problems in depending packages. 'This option shall normally not be used.' (See #466118.)
+*--dpkg-noforce-unsafe-io*::
+ Prevent running dpkg with --force-unsafe-io. --force-unsafe-io causes dpkg to skip certain file system syncs known to cause substantial performance degradation on some filesystems. Thus, including this option reverts to safe but slower behavior.
+
*-i* 'filename', *--ignore*='filename'::
Add a filename to the list of filenames to be ignored when comparing changes before and after installation. By default, piuparts ignores files that always change during a package installation and uninstallation, such as *dpkg* status files. The filename should be relative to the root of the chroot (e.g., _var/lib/dpkg/status_). This option can be used as many times as necessary.
diff --git a/piuparts.py b/piuparts.py
--- a/piuparts.py
+++ b/piuparts.py
@@ -698,6 +698,8 @@
proxy = m.group(1)
if proxy:
lines.append('Acquire::http::Proxy "%s";\n' % proxy)
+ if settings.dpkg_force_unsafe_io:
+ lines.append('Dpkg::Options {"--force-unsafe-io";};\n')
if settings.dpkg_force_confdef:
lines.append('Dpkg::Options {"--force-confdef";};\n')
@@ -706,10 +708,15 @@
def create_dpkg_conf(self):
"""Create /etc/dpkg/dpkg.cfg.d/piuparts inside the chroot."""
+ lines = []
+ if settings.dpkg_force_unsafe_io:
+ lines.append('force-unsafe-io\n')
if settings.dpkg_force_confdef:
+ lines.append('force-confdef\n')
+ logging.info("Warning: dpkg has been configured to use the force-confdef option. This will hide problems, see #466118.")
+ if lines:
create_file(self.relative("etc/dpkg/dpkg.cfg.d/piuparts"),
- 'force-confdef\n')
- logging.info("Warning: dpkg has been configured to use the force-confdef option. This will hide problems, see #466118.")
+ "".join(lines))
def create_policy_rc_d(self):
"""Create a policy-rc.d that prevents daemons from running."""
@@ -1953,6 +1960,11 @@
default="-o MaxPriority=required -o UseRecommends=no -f -n apt debfoster",
help="Run debfoster with different parameters (default: -o MaxPriority=required -o UseRecommends=no -f -n apt debfoster).")
+ parser.add_option("--dpkg-noforce-unsafe-io",
+ default=False,
+ action='store_true',
+ help="Default is to run dpkg with --force-unsafe-io option, which causes dpkg to skip certain file system syncs known to cause substantial performance degradation on some filesystems. This option turns that off; i.e. dpkg WILL use safe-io")
+
parser.add_option("--dpkg-force-confdef",
default=False,
action='store_true',
@@ -2142,6 +2154,7 @@
settings.warn_on_others = opts.warn_on_others
settings.warn_on_leftovers_after_purge = opts.warn_on_leftovers_after_purge
settings.debfoster_options = opts.debfoster_options.split()
+ settings.dpkg_force_unsafe_io = not opts.dpkg_noforce_unsafe_io
settings.dpkg_force_confdef = opts.dpkg_force_confdef
if opts.adt_virt is None: