mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scripts/setlocalversion on readonly source
@ 2009-06-09 20:30   ` Christian Kujau
  2009-06-12  7:59     ` Nico Schottelius
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Kujau @ 2009-06-09 20:30 UTC (permalink / raw)
  To: LKML; +Cc: nico-linuxsetlocalversion

Hi,

I'm building kernels with O=/some/dir and at some point 
scripts/setlocalversion is being called, doing:

  + git update-index --refresh --unmerged
  fatal: Unable to create '.git/index.lock': Read-only file system

Not only does it throw this error but it takes quite a long time to run, 
only to fail anyway because the kernel source dir is located on a 
read-only NFS mount.

The following patch makes the error go away:

--- linux-2.6-git/scripts/setlocalversion	2009-05-29 07:14:34.746191990 +0200
+++ /home/dummy/tmp/scripts/setlocalversion.edited	2009-06-09 22:20:29.000000000 +0200
@@ -39,8 +39,8 @@
 	        printf -- '-svn%s' "`git svn find-rev $head`"
 	fi
 
-	# Are there uncommitted changes?
-	git update-index --refresh --unmerged > /dev/null
+	# Are there uncommitted changes? (and can we update the repo?)
+	touch . 2>/dev/null && git update-index --refresh --unmerged > /dev/null
 	if git diff-index --name-only HEAD | grep -v "^scripts/package" \
 	    | read dummy; then
 		printf '%s' -dirty


Thanks,
Christian.
-- 
BOFH excuse #426:

internet is needed to catch the etherbunny

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scripts/setlocalversion on readonly source
  2009-06-09 20:30   ` [PATCH] scripts/setlocalversion on readonly source Christian Kujau
@ 2009-06-12  7:59     ` Nico Schottelius
  2009-06-12 17:03       ` Christian Kujau
  2009-06-14 20:27       ` Sam Ravnborg
  0 siblings, 2 replies; 5+ messages in thread
From: Nico Schottelius @ 2009-06-12  7:59 UTC (permalink / raw)
  To: Christian Kujau, Sam Ravnborg
  Cc: LKML, nico-linuxsetlocalversion, Andrew Morton

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

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@nerdbynature.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

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scripts/setlocalversion on readonly source
  2009-06-12  7:59     ` Nico Schottelius
@ 2009-06-12 17:03       ` Christian Kujau
  2009-06-14 20:27       ` Sam Ravnborg
  1 sibling, 0 replies; 5+ messages in thread
From: Christian Kujau @ 2009-06-12 17:03 UTC (permalink / raw)
  To: Nico Schottelius; +Cc: Sam Ravnborg, LKML, Andrew Morton

On Fri, 12 Jun 2009, Nico Schottelius wrote:
> 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

Even better, thanks!

Christian.
-- 
BOFH excuse #187:

Reformatting Page. Wait...

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scripts/setlocalversion on readonly source
  2009-06-12  7:59     ` Nico Schottelius
  2009-06-12 17:03       ` Christian Kujau
@ 2009-06-14 20:27       ` Sam Ravnborg
  2009-06-14 20:46         ` Christian Kujau
  1 sibling, 1 reply; 5+ messages in thread
From: Sam Ravnborg @ 2009-06-14 20:27 UTC (permalink / raw)
  To: Nico Schottelius, Christian Kujau, LKML, Andrew Morton

> 
> 
> Do not update index on read only media.
> Idea published by Christian Kujau <lists@nerdbynature.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

Please sign-off future patches.
I applied this with no signoff - but this is an exception.

	Sam

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scripts/setlocalversion on readonly source
  2009-06-14 20:27       ` Sam Ravnborg
@ 2009-06-14 20:46         ` Christian Kujau
  0 siblings, 0 replies; 5+ messages in thread
From: Christian Kujau @ 2009-06-14 20:46 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Nico Schottelius, LKML, Andrew Morton

On Sun, 14 Jun 2009, Sam Ravnborg wrote:
> > Do not update index on read only media.
> > Idea published by Christian Kujau <lists@nerdbynature.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
> 
> Please sign-off future patches.
> I applied this with no signoff - but this is an exception.

I'm not sure if we want to have patches w/o a signoff in the tree; but I 
could only add a

   Tested-by: Christian Kujau <lists@nerdbynature.de>

since it's Nico's patch now.

Thanks,
Christian.
-- 
BOFH excuse #446:

Mailer-daemon is busy burning your message in hell.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-06-14 20:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20090611153332.d168e58e.akpm@linux-foundation.org>
     [not found] ` <20090612043922.GA13001@uranus.ravnborg.org>
2009-06-09 20:30   ` [PATCH] scripts/setlocalversion on readonly source Christian Kujau
2009-06-12  7:59     ` Nico Schottelius
2009-06-12 17:03       ` Christian Kujau
2009-06-14 20:27       ` Sam Ravnborg
2009-06-14 20:46         ` Christian Kujau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®