Control: tags -1 patch On 07-10-14 08:31, Paul Gevers wrote: > So the fix needs to be implemented otherwise. I have > ideas, but I have to figure it out.
So, try number two. If anybody wants to review the patch, please leave your comments here. Unfortunately, the code became difficult to read if I didn't change the indentation, so the patch contains a little bit of that. Not too bad though. Paul
From e59bbac759009e3de32436fd5803f4c12988f223 Mon Sep 17 00:00:00 2001 From: Paul Gevers <elb...@debian.org> Date: Tue, 7 Oct 2014 21:33:09 +0200 Subject: [PATCH] Only parse file ownership/perms when a file does not yet exist Closes: #720517 --- dpkg/common | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/dpkg/common b/dpkg/common index 1d8e31e..96ab8fc 100644 --- a/dpkg/common +++ b/dpkg/common @@ -521,23 +521,32 @@ EOF if [ "$dbc_install" != "true" ] && [ "$dbc_dgi_on_manual" != "true" ]; then return 0 elif [ "$dbc_generate_include" ]; then - if [ "$dbc_generate_include_owner" ]; then - dbc_generate_include_args="$dbc_generate_include_args -O $dbc_generate_include_owner" - fi - if [ "$dbc_generate_include_perms" ]; then - dbc_generate_include_args="$dbc_generate_include_args -m $dbc_generate_include_perms" - fi - - if echo $dbc_generate_include | grep -q -E "^[^:]*:"; then - iformat=`echo $dbc_generate_include | cut -d: -f1` - ofile=`echo $dbc_generate_include | cut -d: -f2` - dbconfig-generate-include -a -f "$iformat" $dbc_generate_include_args -U "$dbc_packageconfig" "$ofile" - ucfr "$dbc_package" "$dbc_packageconfig" - else - dbc_error="maintainer did not properly set dbc_generate_include" - dbc_install_error "writing package config" - fi - fi + if echo $dbc_generate_include | grep -q -E "^[^:]*:"; then + iformat=`echo $dbc_generate_include | cut -d: -f1` + ofile=`echo $dbc_generate_include | cut -d: -f2` + + # Changing the owner and perms should only be done during installation, + # as administrator changes to configuration files must be respected. + # Therefor, only processing owner and perms items when the target + # file does not exist. This also works correctly when the configuration + # file is removed alltogether, as ucf won't create the file. + # See BTS: #720517 + if [ ! -e "$ofile" ]; then + if [ "$dbc_generate_include_owner" ]; then + dbc_generate_include_args="$dbc_generate_include_args -O $dbc_generate_include_owner" + fi + if [ "$dbc_generate_include_perms" ]; then + dbc_generate_include_args="$dbc_generate_include_args -m $dbc_generate_include_perms" + fi + fi + + dbconfig-generate-include -a -f "$iformat" $dbc_generate_include_args -U "$dbc_packageconfig" "$ofile" + ucfr "$dbc_package" "$dbc_packageconfig" + else + dbc_error="maintainer did not properly set dbc_generate_include" + dbc_install_error "writing package config" + fi + fi } -- 1.7.10.4
signature.asc
Description: OpenPGP digital signature