lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 12 Jun 2009 09:59:52 +0200
From:	Nico Schottelius <nico-linuxsetlocalversion@...ottelius.org>
To:	Christian Kujau <lists@...dbynature.de>,
	Sam Ravnborg <sam@...nborg.org>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	nico-linuxsetlocalversion@...ottelius.org,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] scripts/setlocalversion on readonly source

Hello everybody,

Christian Kujau [Tue, Jun 09, 2009 at 01:30:18PM -0700]:
> [...] 
>   + git update-index --refresh --unmerged
>   fatal: Unable to create '.git/index.lock': Read-only file system
> 
> [...] throw this error [...] takes quite a long time to run, 
> [...] on a read-only NFS mount.

Agreed, one can spent time better.

But

> The following patch makes the error go away:
> [...] 
> +	touch . 2>/dev/null && git update-index --refresh --unmerged > /dev/null

changing stuff (mtime here) where it is not necessary is maybe not
the best thing todo. I suggest instead checking for a writable directory
(which is what you want todo anyway):

[ -w . ] && git update-index --refresh --unmerged > /dev/null

Full patch including comment cleanup is attached below.

Sincerly,

Nico


Do not update index on read only media.
Idea published by Christian Kujau <lists@...dbynature.de>.

diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 0079047..46989b8 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -39,8 +39,10 @@ if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
 	        printf -- '-svn%s' "`git svn find-rev $head`"
 	fi
 
-	# Are there uncommitted changes?
-	git update-index --refresh --unmerged > /dev/null
+	# Update index only on r/w media
+	[ -w . ] && git update-index --refresh --unmerged > /dev/null
+
+	# Check for uncommitted changes
 	if git diff-index --name-only HEAD | grep -v "^scripts/package" \
 	    | read dummy; then
 		printf '%s' -dirty

-- 
Currently moving *.schottelius.org to http://www.nico.schottelius.org/ ...

PGP: BFE4 C736 ABE5 406F 8F42  F7CF B8BE F92A 9885 188C

Download attachment "signature.asc" of type "application/pgp-signature" (198 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ