From: Jason Stubbs <jstubbs@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Subject: [gentoo-portage-dev] PATCH: Use lchown and lchgrp no-op functions when operating on symlinks (#99616)
Date: Thu, 21 Jul 2005 23:13:34 +0900 [thread overview]
Message-ID: <200507212313.36804.jstubbs@gentoo.org> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 429 bytes --]
http://bugs.gentoo.org/show_bug.cgi?id=99616
Similar to the usage of chown on Darwin in bug #98827, ebuild.sh uses chown
on symlinks which can alter the target where the intention is to modify the
symlink. This patch adds no-op lchown and lchgrp functions to ebuild.sh.
Profiles should override these to provide the correct implementation for
the specific userland.
(Apologies to the bug poster!)
--
Jason Stubbs
[-- Attachment #1.2: 99616_overridable_lchown_lchgrp.patch --]
[-- Type: text/x-diff, Size: 1447 bytes --]
diff -uNr portage-2.0.51.22-r2/bin/ebuild.sh portage-patched/bin/ebuild.sh
--- portage-2.0.51.22-r2/bin/ebuild.sh 2005-07-19 19:38:32.949904000 +0900
+++ portage-patched/bin/ebuild.sh 2005-07-21 23:03:58.429898000 +0900
@@ -85,6 +85,11 @@
export SANDBOX_PREDICT="$SANDBOX_PREDICT:$1"
}
+lchown()
+{ 0; }
+
+lchgrp()
+{ 0; }
# source the existing profile.bashrc's.
save_IFS
@@ -1075,9 +1080,13 @@
local count=0
find "${D}/" -user portage | while read file; do
count=$(( $count + 1 ))
- [[ ! -L ${file} ]] && s=$(stat_perms $file)
- chown root "$file"
- [[ ! -L ${file} ]] && chmod "$s" "$file"
+ if [ -L "${file}" ]; then
+ lchown root "${file}"
+ else
+ s=$(stat_perms $file)
+ chown root "$file"
+ chmod "$s" "$file"
+ fi
done
if (( $count > 0 )); then
ewarn "$count files were installed with user portage!"
@@ -1086,13 +1095,13 @@
count=0
find "${D}/" -group portage | while read file; do
count=$(( $count + 1 ))
- [[ ! -L ${file} ]] && s=$(stat_perms "$file")
- if [ "$USERLAND" == "BSD" ] || [ "$USERLAND" == "Darwin" ];then
- chgrp wheel "$file"
+ if [ -L ${file} ]; then
+ lchgrp 0 "${file}"
else
- chgrp root "$file"
+ s=$(stat_perms "$file")
+ chgrp 0 "$file"
+ chmod "$s" "$file"
fi
- [[ ! -L ${file} ]] && chmod "$s" "$file"
done
if (( $count > 0 )); then
ewarn "$count files were installed with group portage!"
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next reply other threads:[~2005-07-21 14:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-21 14:13 Jason Stubbs [this message]
2005-07-21 17:17 ` [gentoo-portage-dev] PATCH: Use lchown and lchgrp no-op functions when operating on symlinks (#99616) Brian D. Harring
2005-07-21 23:49 ` Jason Stubbs
2005-08-05 3:31 ` [gentoo-portage-dev] PATCH: properly handle metadata transfer on first sync of an empty tree (#96410) Brian D. Harring
2005-08-05 11:20 ` Jason Stubbs
2005-08-09 7:19 ` Brian Harring
2005-08-06 23:30 ` Zac Medico
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=200507212313.36804.jstubbs@gentoo.org \
--to=jstubbs@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox