[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#486926: Installed system does not have correct permissions on directories



Chris Lamb wrote:
> Package: live-installer
> Severity: normal
> Version: 5
> 
> After installation via live-installer, permisions on directories are all
> 0755. This is especially noticable on /tmp, /var/mail, /etc/ssl/private, etc.

If that's the case, the bug should probably be RC; a system with such
busted permissions is generally broken.

And it looks like the bug is that it simply runs mkdir -p before copying
w/o trying to preserve dir perms at all:

                        if [ -d "$item" ] && [ ! -h "$item" ]; then
                                mkdir -p /target/"$item"
                        else
                                mkdir -p /target/"$(dirname $item)"
                                rm -f /target/"$item"
                                cp -a "$item" /target/"$item"
                        fi

The thing to do seems to be to use tar instead.

I cannot test the attached patch easily, since I have no live CDs to use
it with. Can someone please give it a try?

-- 
see shy jo
From 8b0ed77c1eeb00076ce97e553d1ed21a9ad39ba8 Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kodama.kitenet.net>
Date: Wed, 18 Jun 2008 22:16:50 -0400
Subject: [PATCH] Copy files using tar, avoids permissions problems and other nonsense

I suggest getting rid of this mkdir/rm/cp nonsense and just pipe tar to
tar. d-i busybox tar cannot create tar archives, but that's ok, we have
a live filesystem with a fullfledged tar on it available to use.

This patch has not yet been tested.
---
 packages/live-installer/debian/changelog |    7 +++++++
 packages/live-installer/debian/postinst  |   20 +++++++++-----------
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/packages/live-installer/debian/changelog b/packages/live-installer/debian/changelog
index 2ad2913..9b03bc0 100644
--- a/packages/live-installer/debian/changelog
+++ b/packages/live-installer/debian/changelog
@@ -1,3 +1,10 @@
+live-installer (6) UNRELEASED; urgency=low
+
+  * Copy files using tar, avoids permissions problems and other nonsense.
+    Closes: #486926
+
+ -- Joey Hess <joeyh@debian.org>  Wed, 18 Jun 2008 21:23:06 -0400
+
 live-installer (5) unstable; urgency=low
 
   [ Updated translations ]
diff --git a/packages/live-installer/debian/postinst b/packages/live-installer/debian/postinst
index cd3313d..2608e00 100755
--- a/packages/live-installer/debian/postinst
+++ b/packages/live-installer/debian/postinst
@@ -37,17 +37,15 @@ install_live_system () {
 		COUNT=0
 		OLD_IFS=$IFS
 		IFS=$NEWLINE
-		for item in `find .`; do
-			# We need to be ensure it's not a symbolic link otherwise
-			# it breaks links for directories.
-			if [ -d "$item" ] && [ ! -h "$item" ]; then
-				mkdir -p /target/"$item"
-			else
-				mkdir -p /target/"$(dirname $item)"
-				rm -f /target/"$item"
-				cp -a "$item" /target/"$item"
-			fi
-
+		mkdir -p /target
+		# use tar from inside the live filesystem to create
+		# the tarball, because busybox tar in d-i does not 
+		# support creating tarballs.
+		# 
+		# The --exclude is a paranoia measure, in case this program
+		# is running from the toplevel of a live filesystem,
+		# which is not normally the case.
+		for line in $(chroot . tar c . --exclude=target | (chdir /target && tar xv)); do
 			COUNT=$(($COUNT + 1))
 			CURRENT=$(($COUNT * 100 / $STEPS))
 
-- 
1.5.5.4

Attachment: signature.asc
Description: Digital signature


Reply to: