[devel-distro] I: mkimage-profiles 1.1.7
Michael Shigorin
mike at osdn.org.ua
Mon Sep 16 20:58:22 MSK 2013
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
-------------- next part --------------
>From 3454fc91f7b9a3c7e4f45d0ec18b6d06be659cc2 Mon Sep 17 00:00:00 2001
From: Michael Shigorin <mike at 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
-------------- next part --------------
>From 44504838a2cd3da0681365f906da959e5aefe3e6 Mon Sep 17 00:00:00 2001
From: Michael Shigorin <mike at 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
-------------- next part --------------
>From ba9f2df24c60b93bebcc788f0c0a0e418fef6b9e Mon Sep 17 00:00:00 2001
From: Michael Shigorin <mike at 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
-------------- next part --------------
>From 23ebbd7984492f740eda2ccd665a6745fd47d2d8 Mon Sep 17 00:00:00 2001
From: Michael Shigorin <mike at 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
More information about the devel-distro
mailing list