ALT Linux Distributions development
 help / color / mirror / Atom feed
From: Michael Shigorin <mike@osdn.org.ua>
To: devel-distro@lists.altlinux.org
Subject: Re: [devel-distro] I: mkimage-profiles 1.1.7
Date: Mon, 16 Sep 2013 19:58:22 +0300
Message-ID: <20130916165822.GA1080@osdn.org.ua> (raw)
In-Reply-To: <521B6626.6060400@altlinux.ru>

[-- Attachment #1: Type: text/plain, Size: 904 bytes --]

On Mon, Aug 26, 2013 at 06:28:54PM +0400, Alexey Gladkov wrote:
> > к mkimage тоже нужно добить патчи для работы под ядром 3.6+
> > с нынешним udev (насчёт /proc/sys/fs/protected_hardlinks),
> > они отчасти готовы, продолжаю читать и экспериментировать.
> Можно ли их увидеть ?

Упс, проморгал, прилагаю.

Первый можно брать (его уже обсуждали в жабере,
это коммит с нормальным сообщением).

Остальные -- это попытки выяснить, получается ли объехать
в mki-copy-subdirs.  Похоже, не получается.

Промежуточный вердикт -- громко ругаться о необходимости
echo 0 > /proc/sys/fs/protected_hardlinks; остаётся вопрос
о том, вываливаться ли при этом или не ставить -l в cp_args
(в последнем случае резко, вплоть до катастрофически для tmpfs
разумного размера, растёт потребление места в каталоге сборки).

-- 
 ---- WBR, Michael Shigorin / http://altlinux.org
  ------ http://opennet.ru / http://anna-news.info

[-- Attachment #2: 0001-mki-image-prepare-work-around-protected_hardlinks.patch --]
[-- Type: text/plain, Size: 1224 bytes --]

>From 3454fc91f7b9a3c7e4f45d0ec18b6d06be659cc2 Mon Sep 17 00:00:00 2001
From: Michael Shigorin <mike@altlinux.org>
Date: Mon, 26 Aug 2013 13:19:17 +0300
Subject: [PATCH 1/4] mki-image-prepare: work around protected_hardlinks

There's an issue with Linux 3.6+ feature controlled via
/proc/sys/fs/protected_hardlinks that is now enabled by default
and destroys the assumtion mkimage uses heavily: being able to
hardlink to others' files to spare space within the filesystem
where workdirs are situated.

And the script is actually cleaner this way.
---
 tools/mki-image-prepare | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/tools/mki-image-prepare b/tools/mki-image-prepare
index 63faf1a..83e2896 100755
--- a/tools/mki-image-prepare
+++ b/tools/mki-image-prepare
@@ -27,10 +27,7 @@ inode2="$(stat -c '%i' "$chroot/.image/.fakedata")"
 [ "$inode1" != "$inode2" ] ||
 	exit 0
 
-mki-run chmod 666 /.fakedata
-cat "$chroot"/.image/.fakedata >> "$chroot"/.fakedata
-mki-run chmod 644 /.fakedata
+mki-run sh -c "cat /.image/.fakedata >> /.fakedata"
 
 rm -f -- "$chroot"/.image/.fakedata
-
-ln -- "$chroot"/.fakedata "$chroot"/.image/.fakedata
+mki-run ln -- /.fakedata /.image/.fakedata
-- 
1.8.3.4


[-- Attachment #3: 0002-TMP-mki-sh-functions-check_protected_hardlinks.patch --]
[-- Type: text/plain, Size: 1021 bytes --]

>From 44504838a2cd3da0681365f906da959e5aefe3e6 Mon Sep 17 00:00:00 2001
From: Michael Shigorin <mike@altlinux.org>
Date: Sat, 7 Sep 2013 18:47:32 +0400
Subject: [PATCH 2/4] TMP: mki-sh-functions: check_protected_hardlinks()

---
 tools/mki-sh-functions | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tools/mki-sh-functions b/tools/mki-sh-functions
index 46fb3f2..0fb9625 100755
--- a/tools/mki-sh-functions
+++ b/tools/mki-sh-functions
@@ -51,14 +51,27 @@ makefile="$(opt_check_read 'MYMAKEFILE' "$makefile")"
 
 export PATH="$bindir:$PATH"
 
+check_protected_hardlinks() {
+	[ -f /proc/sys/fs/protected_hardlinks ] ||
+		return 0
+
+	ln "$chroot/bin/true" "$chroot/var/tmp" 2>/dev/null &&
+		rm -f "$chroot/var/tmp"
+}
+
 cp_args=
 get_copy_args() {
 	[ "$#" -ge 2 ] ||
 		fatal "get_copy_args(): more arguments required"
 
 	cp_args=
+
 	[ $(find "$@" -printf '%D\n' 2>/dev/null |sort -u |wc -l) -eq 1 ] ||
 		return 0
+
+	check_protected_hardlinks ||
+		return 0
+
 	cp_args='-l'
 }
 
-- 
1.8.3.4


[-- Attachment #4: 0003-TMP-mki-copy-subdirs-use-cp_args.patch --]
[-- Type: text/plain, Size: 839 bytes --]

>From ba9f2df24c60b93bebcc788f0c0a0e418fef6b9e Mon Sep 17 00:00:00 2001
From: Michael Shigorin <mike@altlinux.org>
Date: Sat, 7 Sep 2013 18:49:18 +0400
Subject: [PATCH 3/4] TMP: mki-copy-subdirs: use $cp_args

---
 tools/mki-copy-subdirs | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/mki-copy-subdirs b/tools/mki-copy-subdirs
index dacbbae..00d53b2 100755
--- a/tools/mki-copy-subdirs
+++ b/tools/mki-copy-subdirs
@@ -46,5 +46,13 @@ for d in $subdirs; do
 
 done
 
+echo HERE5 >&2
+mki-run ls -lRn /.in ||:
+#mki-run chown -v -R 500:502 /.in/
+#mki-run ls -lRn /.in ||:
+echo HERE6 >&2
+mki-run whoami
+echo HERE7 >&2
 mki-run /.host/find "/.in/" -mindepth 2 -maxdepth 2 \
-	-execdir cp -alft /.image/ -- '{}' '+'
+	-execdir cp $verbose $cp_args -aft /.image/ -- '{}' '+'
+echo HERE8 >&2
-- 
1.8.3.4


[-- Attachment #5: 0004-TMP-mki-sh-functions-get_copy_args-warning.patch --]
[-- Type: text/plain, Size: 1184 bytes --]

>From 23ebbd7984492f740eda2ccd665a6745fd47d2d8 Mon Sep 17 00:00:00 2001
From: Michael Shigorin <mike@altlinux.org>
Date: Tue, 10 Sep 2013 16:34:35 +0400
Subject: [PATCH 4/4] TMP: mki-sh-functions: get_copy_args() += warning

---
 tools/mki-sh-functions | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/mki-sh-functions b/tools/mki-sh-functions
index 0fb9625..99b126a 100755
--- a/tools/mki-sh-functions
+++ b/tools/mki-sh-functions
@@ -55,8 +55,9 @@ check_protected_hardlinks() {
 	[ -f /proc/sys/fs/protected_hardlinks ] ||
 		return 0
 
-	ln "$chroot/bin/true" "$chroot/var/tmp" 2>/dev/null &&
-		rm -f "$chroot/var/tmp"
+	# /proc file unreadable, do a functional test
+	ln "$chroot/bin/true" "$chroot/var/tmp/" 2>/dev/null &&
+		rm -f "$chroot/var/tmp/true"
 }
 
 cp_args=
@@ -69,8 +70,11 @@ get_copy_args() {
 	[ $(find "$@" -printf '%D\n' 2>/dev/null |sort -u |wc -l) -eq 1 ] ||
 		return 0
 
-	check_protected_hardlinks ||
+	# can do with data copies but it's very expensive resource-wise
+	if ! check_protected_hardlinks; then
+		message "Warning: echo 0 > /proc/sys/fs/protected_hardlinks"
 		return 0
+	fi
 
 	cp_args='-l'
 }
-- 
1.8.3.4


  reply	other threads:[~2013-09-16 16:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-26 14:16 Michael Shigorin
2013-08-26 14:28 ` Alexey Gladkov
2013-09-16 16:58   ` Michael Shigorin [this message]
2013-09-16 18:40     ` Alexey Gladkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130916165822.GA1080@osdn.org.ua \
    --to=mike@osdn.org.ua \
    --cc=devel-distro@lists.altlinux.org \
    --cc=shigorin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Distributions development

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel-distro/0 devel-distro/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel-distro devel-distro/ http://lore.altlinux.org/devel-distro \
		devel-distro@lists.altlinux.org devel-distro@lists.altlinux.ru devel-distro@lists.altlinux.com
	public-inbox-index devel-distro

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel-distro


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git