[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1306091640270.13746@trent.utfs.org>
Date: Sun, 9 Jun 2013 17:50:49 -0700 (PDT)
From: Christian Kujau <lists@...dbynature.de>
To: LKML <linux-kernel@...r.kernel.org>
cc: nico-linuxsetlocalversion@...ottelius.org
Subject: [RFC] scripts/setlocalversion on write-protected source tree
Hi,
I just stumbled across another[0] issue when scripts/setlocalversion
operates on a write-protected source tree. Back then[0] the source tree
was on an read-only NFS share, so "test -w" was introduced before "git
update-index" was run.
This time, the source tree is on read/write NFS share, but the permissions
are world-readable and only a specific user (or root) can write.
Thus, "test -w ." returns "0" and then runs "git update-index",
producing the following message (on a dirty tree):
fatal: Unable to create '/usr/local/src/linux-git/.git/index.lock': Permission denied
While it says "fatal", compilation continues just fine.
The patch below adds yet another (clumsy) check before "git
update-index", but I'm not sure if this is the right way to go.
On a side note, I don't think a kernel compilation should alter the source
tree (or the .git directory) in any way and I don't see how removing
"git update-index" could do any harm. The Mercurial and SVN routines in
scripts/setlocalversion don't have any tree-modifying commands, AFAICS.
So, maybe the attached patch would be acceptable.
Thoughts?
Christian.
[0] https://patchwork.kernel.org/patch/29718/
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
old mode 100755
new mode 100644
index 84b88f1..2560718
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -72,7 +72,8 @@ scm_version()
fi
# Update index only on r/w media
- [ -w . ] && git update-index --refresh --unmerged > /dev/null
+ [ -w . ] && touch .git/index.lock 2>/dev/null && rm -f .git/index.lock && \
+ git update-index --refresh --unmerged > /dev/null
# Check for uncommitted changes
if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then
--
BOFH excuse #359:
YOU HAVE AN I/O ERROR -> Incompetent Operator error
View attachment "setlocalversion_no-update-index.diff" of type "TEXT/x-diff" (492 bytes)
Powered by blists - more mailing lists