dpkg-maintscript-helper 'mv_conffile' fails if target doesn't already exist

Bug #985508 reported by Neil Wilson
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
dpkg (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

The 'mv_conffile' function only works if the target file exists by the postinst stage.

This means the function doesn't support those packages where the new configuration file is optional and may not exist at postinst stage.

The case in point is 'iptables-persistent' where the new 'rules.v4' may not exists after installation. Bug #967018

A simple guard in front of the 'mv' command would add support.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: dpkg 1.16.1.2ubuntu7
ProcVersionSignature: Ubuntu 3.2.0-23.36-virtual 3.2.14
Uname: Linux 3.2.0-23-virtual x86_64
ApportVersion: 2.0.1-0ubuntu5
Architecture: amd64
Date: Thu Apr 19 09:28:11 2012
SourcePackage: dpkg
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Neil Wilson (neil-aldur) wrote :
Revision history for this message
Neil Wilson (neil-aldur) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "dpkg-maintscript-helper.patch" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Revision history for this message
Andreas Rütten (aruetten) wrote :

I'm not sure if this is a defect in 'mv_conffile' of the dpkg-maintscript-helper scripts.

dpkg-maintscript-helper handles conffiles.
But in this case the 'rules.v4' file of the package 'iptables-persistent' is a configuration file not a confile.

Quote from the Depian Policy 10.7 [1]:
"Almost all conffiles are configuration files, but many configuration files are not conffiles."

A configuration file could be any file which customizes the behaviour of a program. But a conffile has to be shipped within the package and listed in a package's 'conffiles' file.

Neither the old 'rules' nor the new 'rules.v4' file are shipped within the package and so they are not a conffile.

[1] http://www.debian.org/doc/debian-policy/ch-files.html#s-config-files

Revision history for this message
Neil Wilson (neil-aldur) wrote : Re: [Bug 985508] Re: dpkg-maintscript-helper 'mv_conffile' fails if target doesn't already exist

On 19 April 2012 13:19, Andreas Rütten <email address hidden> wrote:
> I'm not sure if this is a defect in 'mv_conffile' of the dpkg-
> maintscript-helper scripts.
>
> dpkg-maintscript-helper handles conffiles.
> But in this case the 'rules.v4' file of the package 'iptables-persistent' is a configuration file not a confile.
>

Perhaps it isn't.

But is that any reason not to make the script more flexible so that it
can be used in more situations.

I have the same problem that needs solving. It doesn't appear to make
sense to duplicate a system when just making the existing facility
fractionally more flexible would do the job,

--
Neil Wilson

Revision history for this message
Raphaël Hertzog (hertzog) wrote :

On Thu, 19 Apr 2012, Andreas Rütten wrote:
> Neither the old 'rules' nor the new 'rules.v4' file are shipped within
> the package and so they are not a conffile.

In this case, effectively the usage of dpkg-maintscript-helper is
not welcome, it has clearly been written to deal with conffiles and
it tries to verify if the file is pristine or not
by looking into the "Conffiles" field of the package.

Since a non-conffile would never appear there, it will always assume
that the file has been modified by the admin and will thus always keep
a copy of the old file.

This "pristine check" is the main point of doing all this, otherwise a simple
mv in the preinst is generally enough.

Replying to the initial bug reporter:
> The 'mv_conffile' function only works if the target file exists by the
> postinst stage.

It should better exist since it's a new conffile and it has been just
installed by dpkg (at least that's the assumption made).

Cheers,
--
Raphaël Hertzog ◈ Debian Developer

Pre-order a copy of the Debian Administrator's Handbook and help
liberate it: http://debian-handbook.info/liberation/

Revision history for this message
Adam Conrad (adconrad) wrote :

Marking invalid, based on comments from Raphael and others. mv_conffile is meant for dpkg conffiles, and migrating non-conffile config files is, generally, a much simpler process that doesn't require helpers.

Changed in dpkg (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.