[Pkg-samba-maint] [samba] 01/01: abort if tdb move can't be done on upgrade

Steve Langasek vorlon at debian.org
Mon Oct 21 23:31:55 UTC 2013


On Mon, Oct 21, 2013 at 10:25:31PM +0000, Ivo De Decker wrote:
> diff --git a/debian/samba.postinst b/debian/samba.postinst
> index 94667f8..28c606e 100644
> --- a/debian/samba.postinst
> +++ b/debian/samba.postinst
> @@ -42,33 +42,26 @@ then
>  fi

>  # Move files to private subdir now fhs patch is finally gone
> -if dpkg --compare-versions "$2" lt-nl 2:4.0.6 \
> -	&& [ -e /var/lib/samba/schannel_store.tdb ] \
> -	&& ! [ -e /var/lib/samba/private/schannel_store.tdb ]
> +if dpkg --compare-versions "$2" lt-nl 2:4.0.6
>  then
> -	mv /var/lib/samba/schannel_store.tdb /var/lib/samba/private/schannel_store.tdb
> +	for file in passdb.tdb secrets.tdb schannel_store.tdb idmap2.tdb
> +	do
> +		if [ -e /var/lib/samba/$file ]
> +		then
> +			if [ -e /var/lib/samba/private/$file ]
> +			then
> +				echo $file exists in /var/lib/samba and /var/lib/samba/private, aborting samba postinst
> +				echo rename one of them to allow the upgrade to continue
> +				echo http://bugs.debian.org/726472
> +				ls -al /var/lib/samba /var/lib/samba/private
> +				exit 1
> +			else
> +				mv /var/lib/samba/$file /var/lib/samba/private/$file
> +			fi
> +		fi
> +	done
>  fi

This code is not idempotent.  If two of the files are moved, and the third
one fails, then someone (incorrectly) restarts smbd on the system, the first
two files may be recreated, causing even more failures.

Do all the checks first, then do all the moves in a separate pass.

But I don't know why you're committing this anyway, when we're still
discussing whether to keep the upstream location for these files.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-samba-maint/attachments/20131021/5ec8378b/attachment.sig>


More information about the Pkg-samba-maint mailing list